mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-01 10:24:25 +07:00
Beam node balance
This commit is contained in:
parent
abf13874fa
commit
87a8453871
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("power", PowerNode.makePowerBalance());
|
||||
bars.add("batteries", PowerNode.makeBatteryBalance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
|
@ -100,19 +100,8 @@ public class PowerNode extends PowerBlock{
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("power", 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())
|
||||
));
|
||||
|
||||
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("power", makePowerBalance());
|
||||
bars.add("batteries", makeBatteryBalance());
|
||||
|
||||
bars.add("connections", entity -> new Bar(() ->
|
||||
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
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
Loading…
Reference in New Issue
Block a user