Bugfixes
This commit is contained in:
@@ -31,7 +31,7 @@ public class Build{
|
|||||||
if(tile == null) return;
|
if(tile == null) return;
|
||||||
|
|
||||||
if(tile.entity != null){
|
if(tile.entity != null){
|
||||||
prevPercent = tile.entity.health();
|
prevPercent = tile.entity.healthf();
|
||||||
}
|
}
|
||||||
|
|
||||||
tile = tile.target();
|
tile = tile.target();
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ public class BlockPart extends Block{
|
|||||||
hasPower = hasItems = hasLiquids = true;
|
hasPower = hasItems = hasLiquids = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawTeam(Tile tile){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean synthetic(){
|
public boolean synthetic(){
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -56,8 +56,12 @@ public class BuildBlock extends Block{
|
|||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){
|
public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){
|
||||||
if(tile == null) return;
|
if(tile == null) return;
|
||||||
|
float healthf = tile.entity == null ? 1f : tile.entity.healthf();
|
||||||
tile.setRotation(rotation);
|
tile.setRotation(rotation);
|
||||||
world.setBlock(tile, block, team);
|
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);
|
Effects.effect(Fx.placeBlock, tile.drawx(), tile.drawy(), block.size);
|
||||||
Core.app.post(() -> tile.block().placed(tile));
|
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){
|
public void construct(Unit builder, TileEntity core, float amount){
|
||||||
if(block == null){
|
if(block == null){
|
||||||
damage(99999);
|
kill();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,11 +143,6 @@ public class PowerGraph{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update(){
|
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();
|
lastFrameUpdated = Core.graphics.getFrameId();
|
||||||
|
|
||||||
float powerNeeded = getPowerNeeded();
|
float powerNeeded = getPowerNeeded();
|
||||||
@@ -155,6 +150,10 @@ public class PowerGraph{
|
|||||||
|
|
||||||
powerBalance.addValue((powerProduced - powerNeeded) / Time.delta());
|
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(!Mathf.isEqual(powerNeeded, powerProduced)){
|
||||||
if(powerNeeded > powerProduced){
|
if(powerNeeded > powerProduced){
|
||||||
powerProduced += useBatteries(powerNeeded - powerProduced);
|
powerProduced += useBatteries(powerNeeded - powerProduced);
|
||||||
|
|||||||
Reference in New Issue
Block a user