Fixed #1077
This commit is contained in:
@@ -363,6 +363,16 @@ public class Block extends BlockStorage{
|
|||||||
return sum;
|
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
|
@Override
|
||||||
public String localizedName(){
|
public String localizedName(){
|
||||||
return localizedName;
|
return localizedName;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class SolidPump extends Pump{
|
|||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
if(attribute != null){
|
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();
|
super.setBars();
|
||||||
bars.add("efficiency", entity -> new Bar(() ->
|
bars.add("efficiency", entity -> new Bar(() ->
|
||||||
Core.bundle.formatFloat("bar.efficiency",
|
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,
|
() -> Pal.ammo,
|
||||||
() -> ((SolidPumpEntity)entity).warmup));
|
() -> ((SolidPumpEntity)entity).warmup));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user