mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed power balance display being influenced by delta
This commit is contained in:
parent
18fcc6e596
commit
f33e924cdf
@ -7,6 +7,7 @@ import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.collection.Queue;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.math.WindowedMean;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.Consume;
|
||||
import io.anuke.mindustry.world.consumers.ConsumePower;
|
||||
@ -131,7 +132,6 @@ public class PowerGraph{
|
||||
//if(!otherConsumersAreValid(consumer, consumePower)){
|
||||
// consumer.entity.power.satisfaction = 0.0f; // Only supply power if the consumer would get valid that way
|
||||
//}else{
|
||||
|
||||
//currently satisfies power even if it's not required yet
|
||||
if(consumePower.isBuffered){
|
||||
// Add an equal percentage of power to all buffers, based on the global power coverage in this graph
|
||||
@ -140,7 +140,7 @@ public class PowerGraph{
|
||||
}else{
|
||||
consumer.entity.power.satisfaction = coverage;
|
||||
}
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class PowerGraph{
|
||||
}
|
||||
}
|
||||
|
||||
powerBalance.addValue(powerProduced - powerNeeded);
|
||||
powerBalance.addValue((powerProduced - powerNeeded) / Time.delta());
|
||||
|
||||
distributePower(powerNeeded, powerProduced);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class PowerNode extends PowerBlock{
|
||||
Core.bundle.format("blocks.powerbalance",
|
||||
entity.power.graph == null ? "+0" : ((entity.power.graph.getPowerBalance() >= 0 ? "+" : "") + Strings.toFixed(entity.power.graph.getPowerBalance()*60, 1))),
|
||||
() -> Pal.powerBar,
|
||||
() -> entity.power.graph == null ? 0 :Mathf.clamp(entity.power.graph.getPowerProduced() / entity.power.graph.getPowerNeeded())));
|
||||
() -> entity.power.graph == null ? 0 : Mathf.clamp(entity.power.graph.getPowerProduced() / entity.power.graph.getPowerNeeded())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,7 +53,7 @@ public class Consumers{
|
||||
* @param powerCapacity The maximum capacity in power units.
|
||||
*/
|
||||
public ConsumePower powerBuffered(float powerCapacity){
|
||||
return powerBuffered(powerCapacity, 1f);
|
||||
return powerBuffered(powerCapacity, 60f * 3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user