Melter & Pulverizer Fixed (#5098)

Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
VozDuh 2021-06-10 23:01:04 +03:00 committed by GitHub
parent 8d9d6385f9
commit a0acf1a040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 163 B

View File

@ -637,6 +637,7 @@ public class Blocks implements ContentList{
outputLiquid = new LiquidStack(Liquids.slag, 2f);
craftTime = 10f;
hasLiquids = hasPower = true;
drawer = new DrawLiquid();
consumes.power(1f);
consumes.item(Items.scrap, 1);

View File

@ -0,0 +1,34 @@
package mindustry.world.draw;
import arc.*;
import arc.graphics.g2d.*;
import mindustry.graphics.*;
import mindustry.world.*;
import mindustry.world.blocks.production.*;
import mindustry.world.blocks.production.GenericCrafter.*;
public class DrawLiquid extends DrawBlock{
public TextureRegion liquid, top;
public void draw(GenericCrafterBuild entity){
Draw.rect(entity.block.region, entity.x, entity.y);
if(entity.liquids.total() > 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};
}
}

View File

@ -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};
}
}