Beam node balance
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 658 B |
@@ -36,6 +36,14 @@ public class BeamNode extends PowerBlock{
|
|||||||
envEnabled |= Env.space;
|
envEnabled |= Env.space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBars(){
|
||||||
|
super.setBars();
|
||||||
|
|
||||||
|
bars.add("power", PowerNode.makePowerBalance());
|
||||||
|
bars.add("batteries", PowerNode.makeBatteryBalance());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
super.init();
|
super.init();
|
||||||
|
|||||||
@@ -100,19 +100,8 @@ public class PowerNode extends PowerBlock{
|
|||||||
@Override
|
@Override
|
||||||
public void setBars(){
|
public void setBars(){
|
||||||
super.setBars();
|
super.setBars();
|
||||||
bars.add("power", entity -> new Bar(() ->
|
bars.add("power", makePowerBalance());
|
||||||
Core.bundle.format("bar.powerbalance",
|
bars.add("batteries", makeBatteryBalance());
|
||||||
((entity.power.graph.getPowerBalance() >= 0 ? "+" : "") + UI.formatAmount((long)(entity.power.graph.getPowerBalance() * 60)))),
|
|
||||||
() -> Pal.powerBar,
|
|
||||||
() -> Mathf.clamp(entity.power.graph.getLastPowerProduced() / entity.power.graph.getLastPowerNeeded())
|
|
||||||
));
|
|
||||||
|
|
||||||
bars.add("batteries", entity -> new Bar(() ->
|
|
||||||
Core.bundle.format("bar.powerstored",
|
|
||||||
(UI.formatAmount((long)entity.power.graph.getLastPowerStored())), UI.formatAmount((long)entity.power.graph.getLastCapacity())),
|
|
||||||
() -> Pal.powerBar,
|
|
||||||
() -> Mathf.clamp(entity.power.graph.getLastPowerStored() / entity.power.graph.getLastCapacity())
|
|
||||||
));
|
|
||||||
|
|
||||||
bars.add("connections", entity -> new Bar(() ->
|
bars.add("connections", entity -> new Bar(() ->
|
||||||
Core.bundle.format("bar.powerlines", entity.power.links.size, maxNodes),
|
Core.bundle.format("bar.powerlines", entity.power.links.size, maxNodes),
|
||||||
@@ -121,6 +110,24 @@ public class PowerNode extends PowerBlock{
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Func<Building, Bar> makePowerBalance(){
|
||||||
|
return entity -> new Bar(() ->
|
||||||
|
Core.bundle.format("bar.powerbalance",
|
||||||
|
((entity.power.graph.getPowerBalance() >= 0 ? "+" : "") + UI.formatAmount((long)(entity.power.graph.getPowerBalance() * 60)))),
|
||||||
|
() -> Pal.powerBar,
|
||||||
|
() -> Mathf.clamp(entity.power.graph.getLastPowerProduced() / entity.power.graph.getLastPowerNeeded())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Func<Building, Bar> makeBatteryBalance(){
|
||||||
|
return entity -> new Bar(() ->
|
||||||
|
Core.bundle.format("bar.powerstored",
|
||||||
|
(UI.formatAmount((long)entity.power.graph.getLastPowerStored())), UI.formatAmount((long)entity.power.graph.getLastCapacity())),
|
||||||
|
() -> Pal.powerBar,
|
||||||
|
() -> Mathf.clamp(entity.power.graph.getLastPowerStored() / entity.power.graph.getLastCapacity())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
|
|||||||
Reference in New Issue
Block a user