From a0acf1a04010e643353f8dc4e0347abde15fdecc Mon Sep 17 00:00:00 2001 From: VozDuh <61590217+Voz-Duh@users.noreply.github.com> Date: Thu, 10 Jun 2021 23:01:04 +0300 Subject: [PATCH] Melter & Pulverizer Fixed (#5098) Co-authored-by: Anuken --- .../blocks/production/melter-liquid.png | Bin 0 -> 198 bytes .../blocks/production/pulverizer-rotator.png | Bin 210 -> 281 bytes .../blocks/production/pulverizer-top.png | Bin 0 -> 296 bytes .../sprites/blocks/production/pulverizer.png | Bin 292 -> 163 bytes core/src/mindustry/content/Blocks.java | 1 + core/src/mindustry/world/draw/DrawLiquid.java | 34 ++++++++++++++++++ .../src/mindustry/world/draw/DrawRotator.java | 12 ++++--- 7 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 core/assets-raw/sprites/blocks/production/melter-liquid.png create mode 100644 core/assets-raw/sprites/blocks/production/pulverizer-top.png create mode 100644 core/src/mindustry/world/draw/DrawLiquid.java diff --git a/core/assets-raw/sprites/blocks/production/melter-liquid.png b/core/assets-raw/sprites/blocks/production/melter-liquid.png new file mode 100644 index 0000000000000000000000000000000000000000..19d66fa18a06d9ded298f7982a1e8ae673813db6 GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!V6>-;V@QPi+iQkg3<^BX7hnB-A0sFu(!E#^sx;E2~SZkP~ByYbwk151tOu#$MaR-E13I jtcbBYJYN8$u#SBO?~;XlrZ44mwuAVdu6{1-oD!MHZ-@(LP&>?O|yi-8ntNswRge;{D^y^SvzD8O0Z5ebywI}E~%$MaXD00o;o zT^vI!{GVR1=4&wEVGiKh`+uh5w))SjTV^C2oLqP>VB^{L8qQ;)SFg$5Fe_t~x8g{6 z<M1e-zRI)G$H;4*{~2ax0lN(`ac0o3pTMP^VX4kaxfG0wlXTt$6hz4a*Ogh)fXuzvuLWU5^hE#C? vK1Y!20IH>8avVU_)-fp#812xE0%8CF1gs4imsZvJ00000NkvXXu0mjfgpx_5 diff --git a/core/assets-raw/sprites/blocks/production/pulverizer-top.png b/core/assets-raw/sprites/blocks/production/pulverizer-top.png new file mode 100644 index 0000000000000000000000000000000000000000..621e52e4cb60c9cafc9497f5b8cdbb05198b9063 GIT binary patch literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCikh0(?STXUtjxWabq#0Le!#KQ00(mXaX9;Q#;sGdO6i`~u{27I;J!GcfQS z0%1l`4KI+|sh%#5Ar}67CtLD081S%6{P}Bf-Xnn(jzR#_*eZ-Y}pf4 zFOk`8Ctc6|R`GB`%fCgxR=<;9UH?x1@NWSx<*JrL692gmoxY&K-Tp98Y?9-Y*0Tx) h%_kSe?LG08A!I(s%Yd>8%0LG)c)I$ztaD0e0sz8eR=RL1j-D z#}JM4$p;viUNALDFgba7I3$K7yx>^Cz*xfQ2tEP%Ijl2)Dme>0B8wRq_zr_G 0.001f){ + Drawf.liquid(liquid, entity.x, entity.y, + entity.liquids.get(((GenericCrafter)entity.block).outputLiquid.liquid) / entity.block.liquidCapacity, + ((GenericCrafter)entity.block).outputLiquid.liquid.color); + } + + if(top.found()) Draw.rect(top, entity.x, entity.y); + } + + @Override + public void load(Block block){ + top = Core.atlas.find(block.name + "-top"); + liquid = Core.atlas.find(block.name + "-liquid"); + } + + public TextureRegion[] icons(Block block){ + return top.found() ? new TextureRegion[]{block.region, top} : new TextureRegion[]{block.region}; + } +} diff --git a/core/src/mindustry/world/draw/DrawRotator.java b/core/src/mindustry/world/draw/DrawRotator.java index 166245fa6c..0b2fbe7151 100644 --- a/core/src/mindustry/world/draw/DrawRotator.java +++ b/core/src/mindustry/world/draw/DrawRotator.java @@ -6,21 +6,23 @@ import mindustry.world.*; import mindustry.world.blocks.production.GenericCrafter.*; public class DrawRotator extends DrawBlock{ - public TextureRegion rotator; + public TextureRegion rotator, top; @Override - public void draw(GenericCrafterBuild build){ - Draw.rect(build.block.region, build.x, build.y); - Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f); + public void draw(GenericCrafterBuild entity){ + Draw.rect(entity.block.region, entity.x, entity.y); + Draw.rect(rotator, entity.x, entity.y, entity.totalProgress * 2f); + if(top.found()) Draw.rect(top, entity.x, entity.y); } @Override public void load(Block block){ rotator = Core.atlas.find(block.name + "-rotator"); + top = Core.atlas.find(block.name + "-top"); } @Override public TextureRegion[] icons(Block block){ - return new TextureRegion[]{block.region, rotator}; + return top.found() ? new TextureRegion[]{block.region, rotator, top} : new TextureRegion[]{block.region, rotator}; } }