Fixed power balance display being influenced by delta

This commit is contained in:
Anuken 2019-02-14 19:17:08 -05:00
parent 18fcc6e596
commit f33e924cdf
3 changed files with 5 additions and 5 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}
/**