Power balance tweak

This commit is contained in:
Anuken
2020-03-27 18:23:02 -04:00
parent b284d6892a
commit 767719d410
2 changed files with 4 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
package mindustry.world.blocks.power;
import arc.*;
import arc.struct.*;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.world.*;
import mindustry.world.consumers.*;
@@ -199,6 +199,8 @@ public class PowerGraph{
lastPowerNeeded = powerNeeded;
lastPowerProduced = powerProduced;
powerBalance.addValue((lastPowerProduced - lastPowerNeeded) / Time.delta());
if(!(consumers.size == 0 && producers.size == 0 && batteries.size == 0)){
if(!Mathf.equal(powerNeeded, powerProduced)){
@@ -214,8 +216,6 @@ public class PowerGraph{
distributePower(powerNeeded, powerProduced);
}
powerBalance.addValue((lastPowerProduced - lastPowerNeeded) / Time.delta());
//overproducing: 10 / 20 = 0.5
//underproducing: 20 / 10 = 2 -> clamp -> 1.0
//nothing being produced: 20 / 0 -> 1.0