mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-15 02:07:53 +07:00
Melter & Pulverizer Fixed (#5098)
Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
BIN
core/assets-raw/sprites/blocks/production/melter-liquid.png
Normal file
BIN
core/assets-raw/sprites/blocks/production/melter-liquid.png
Normal file
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 |
BIN
core/assets-raw/sprites/blocks/production/pulverizer-top.png
Normal file
BIN
core/assets-raw/sprites/blocks/production/pulverizer-top.png
Normal file
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 |
@ -637,6 +637,7 @@ public class Blocks implements ContentList{
|
|||||||
outputLiquid = new LiquidStack(Liquids.slag, 2f);
|
outputLiquid = new LiquidStack(Liquids.slag, 2f);
|
||||||
craftTime = 10f;
|
craftTime = 10f;
|
||||||
hasLiquids = hasPower = true;
|
hasLiquids = hasPower = true;
|
||||||
|
drawer = new DrawLiquid();
|
||||||
|
|
||||||
consumes.power(1f);
|
consumes.power(1f);
|
||||||
consumes.item(Items.scrap, 1);
|
consumes.item(Items.scrap, 1);
|
||||||
|
34
core/src/mindustry/world/draw/DrawLiquid.java
Normal file
34
core/src/mindustry/world/draw/DrawLiquid.java
Normal 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};
|
||||||
|
}
|
||||||
|
}
|
@ -6,21 +6,23 @@ import mindustry.world.*;
|
|||||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||||
|
|
||||||
public class DrawRotator extends DrawBlock{
|
public class DrawRotator extends DrawBlock{
|
||||||
public TextureRegion rotator;
|
public TextureRegion rotator, top;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GenericCrafterBuild build){
|
public void draw(GenericCrafterBuild entity){
|
||||||
Draw.rect(build.block.region, build.x, build.y);
|
Draw.rect(entity.block.region, entity.x, entity.y);
|
||||||
Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f);
|
Draw.rect(rotator, entity.x, entity.y, entity.totalProgress * 2f);
|
||||||
|
if(top.found()) Draw.rect(top, entity.x, entity.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(Block block){
|
public void load(Block block){
|
||||||
rotator = Core.atlas.find(block.name + "-rotator");
|
rotator = Core.atlas.find(block.name + "-rotator");
|
||||||
|
top = Core.atlas.find(block.name + "-top");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureRegion[] icons(Block block){
|
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};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user