mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-15 18:27:36 +07:00
Power graph capacity display
This commit is contained in:
@ -487,6 +487,7 @@ bar.drilltierreq = Better Drill Required
|
||||
bar.drillspeed = Drill Speed: {0}/s
|
||||
bar.efficiency = Efficiency: {0}%
|
||||
bar.powerbalance = Power: {0}/s
|
||||
bar.powerstored = Stored: {0}/{1}
|
||||
bar.poweramount = Power: {0}
|
||||
bar.poweroutput = Power Output: {0}
|
||||
bar.items = Items: {0}
|
||||
|
@ -100,6 +100,16 @@ public class PowerGraph{
|
||||
return totalCapacity;
|
||||
}
|
||||
|
||||
public float getTotalBatteryCapacity(){
|
||||
float totalCapacity = 0f;
|
||||
for(Tile battery : batteries){
|
||||
if(battery.block().consumes.hasPower()){
|
||||
totalCapacity += battery.block().consumes.getPower().capacity;
|
||||
}
|
||||
}
|
||||
return totalCapacity;
|
||||
}
|
||||
|
||||
public float useBatteries(float needed){
|
||||
float stored = getBatteryStored();
|
||||
if(Mathf.isEqual(stored, 0f)) return 0f;
|
||||
|
@ -95,6 +95,12 @@ public class PowerNode extends PowerBlock{
|
||||
((entity.power.graph.getPowerBalance() >= 0 ? "+" : "") + Strings.fixed(entity.power.graph.getPowerBalance() * 60, 1))),
|
||||
() -> Pal.powerBar,
|
||||
() -> Mathf.clamp(entity.power.graph.getPowerProduced() / entity.power.graph.getPowerNeeded())));
|
||||
|
||||
bars.add("batteries", entity -> new Bar(() ->
|
||||
Core.bundle.format("bar.powerstored",
|
||||
(ui.formatAmount((int)entity.power.graph.getBatteryStored())), ui.formatAmount((int)entity.power.graph.getTotalBatteryCapacity())),
|
||||
() -> Pal.powerBar,
|
||||
() -> Mathf.clamp(entity.power.graph.getBatteryStored() / entity.power.graph.getTotalBatteryCapacity())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user