mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-30 06:37:50 +07:00
Bugfixes
This commit is contained in:
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user