fix health calculation in background sectors (#4011)

This commit is contained in:
rMuchan
2020-12-17 23:09:28 +08:00
committed by GitHub
parent b8efed9eaf
commit 9a777f3ce5

View File

@@ -260,8 +260,8 @@ public class SectorDamage{
if(tile.build != null && tile.team() == state.rules.defaultTeam && counted.add(tile.pos())){
//health is divided by block size, because multiblocks are counted multiple times.
sumHealth += tile.build.health / tile.block().size;
totalPathBuild += 1f / tile.block().size;
sumHealth += tile.build.health / (tile.block().size * tile.block().size);
totalPathBuild += 1f / (tile.block().size * tile.block().size);
}
}
}
@@ -409,7 +409,7 @@ public class SectorDamage{
if(wx >= 0 && wy >= 0 && wx < world.width() && wy < world.height() && Mathf.within(dx, dy, radius)){
Tile other = world.rawTile(wx, wy);
if(!(other.block() instanceof CoreBlock)){
s += other.team() == state.rules.defaultTeam ? other.build.health / other.block().size : 0f;
s += other.team() == state.rules.defaultTeam ? other.build.health / (other.block().size * other.block().size) : 0f;
}
}
}