This commit is contained in:
Anuken
2019-11-16 16:54:51 -05:00
parent a90f2545d9
commit 430c4fa1d0
2 changed files with 12 additions and 2 deletions

View File

@@ -363,6 +363,16 @@ public class Block extends BlockStorage{
return sum;
}
public float percentSolid(int x, int y){
Tile tile = world.tile(x, y);
if(tile == null) return 0;
float sum = 0;
for(Tile other : tile.getLinkedTilesAs(this, tempTiles)){
sum += !other.floor.isLiquid ? 1f : 0f;
}
return sum / size / size;
}
@Override
public String localizedName(){
return localizedName;

View File

@@ -42,7 +42,7 @@ public class SolidPump extends Pump{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
if(attribute != null){
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", (sumAttribute(attribute, x, y) + 1f) * 100, 1), x, y, valid);
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", (sumAttribute(attribute, x, y) + 1f) * 100 * percentSolid(x, y), 1), x, y, valid);
}
}
@@ -51,7 +51,7 @@ public class SolidPump extends Pump{
super.setBars();
bars.add("efficiency", entity -> new Bar(() ->
Core.bundle.formatFloat("bar.efficiency",
((((SolidPumpEntity)entity).boost + 1f) * ((SolidPumpEntity)entity).warmup) * 100, 1),
((((SolidPumpEntity)entity).boost + 1f) * ((SolidPumpEntity)entity).warmup) * 100 * percentSolid(entity.tile.x, entity.tile.y), 1),
() -> Pal.ammo,
() -> ((SolidPumpEntity)entity).warmup));
}