fix health calculation in background sectors (#4011)
This commit is contained in:
@@ -260,8 +260,8 @@ public class SectorDamage{
|
|||||||
|
|
||||||
if(tile.build != null && tile.team() == state.rules.defaultTeam && counted.add(tile.pos())){
|
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.
|
//health is divided by block size, because multiblocks are counted multiple times.
|
||||||
sumHealth += tile.build.health / tile.block().size;
|
sumHealth += tile.build.health / (tile.block().size * tile.block().size);
|
||||||
totalPathBuild += 1f / 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)){
|
if(wx >= 0 && wy >= 0 && wx < world.width() && wy < world.height() && Mathf.within(dx, dy, radius)){
|
||||||
Tile other = world.rawTile(wx, wy);
|
Tile other = world.rawTile(wx, wy);
|
||||||
if(!(other.block() instanceof CoreBlock)){
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user