diff --git a/core/src/io/anuke/mindustry/world/Build.java b/core/src/io/anuke/mindustry/world/Build.java index cb7785e980..9d77ee82f5 100644 --- a/core/src/io/anuke/mindustry/world/Build.java +++ b/core/src/io/anuke/mindustry/world/Build.java @@ -31,7 +31,7 @@ public class Build{ if(tile == null) return; if(tile.entity != null){ - prevPercent = tile.entity.health(); + prevPercent = tile.entity.healthf(); } tile = tile.target(); diff --git a/core/src/io/anuke/mindustry/world/blocks/BlockPart.java b/core/src/io/anuke/mindustry/world/blocks/BlockPart.java index 8328d05c6f..512b39df20 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BlockPart.java +++ b/core/src/io/anuke/mindustry/world/blocks/BlockPart.java @@ -18,6 +18,11 @@ public class BlockPart extends Block{ hasPower = hasItems = hasLiquids = true; } + @Override + public void drawTeam(Tile tile){ + + } + @Override public boolean synthetic(){ return true; diff --git a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java index 2eaba1415a..f81fb7859e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java @@ -56,8 +56,12 @@ public class BuildBlock extends Block{ @Remote(called = Loc.server) public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){ if(tile == null) return; + float healthf = tile.entity == null ? 1f : tile.entity.healthf(); tile.setRotation(rotation); world.setBlock(tile, block, team); + if(tile.entity != null){ + tile.entity.health = block.health * healthf; + } Effects.effect(Fx.placeBlock, tile.drawx(), tile.drawy(), block.size); Core.app.post(() -> tile.block().placed(tile)); @@ -186,7 +190,7 @@ public class BuildBlock extends Block{ public void construct(Unit builder, TileEntity core, float amount){ if(block == null){ - damage(99999); + kill(); return; } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java index 3b14abe2d3..949a549c89 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java @@ -143,11 +143,6 @@ public class PowerGraph{ } public void update(){ - if(Core.graphics.getFrameId() == lastFrameUpdated || (consumers.size == 0 && producers.size == 0 && batteries.size == 0)){ - powerBalance.addValue(0f); - return; - } - lastFrameUpdated = Core.graphics.getFrameId(); float powerNeeded = getPowerNeeded(); @@ -155,6 +150,10 @@ public class PowerGraph{ powerBalance.addValue((powerProduced - powerNeeded) / Time.delta()); + if(Core.graphics.getFrameId() == lastFrameUpdated || (consumers.size == 0 && producers.size == 0 && batteries.size == 0)){ + return; + } + if(!Mathf.isEqual(powerNeeded, powerProduced)){ if(powerNeeded > powerProduced){ powerProduced += useBatteries(powerNeeded - powerProduced);