Fix quantum batteries eating overflown power

if someone edited save files
This commit is contained in:
DBotThePony 2022-09-04 16:30:25 +07:00
parent 0eb24460e4
commit abd52a64b1
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -107,7 +107,11 @@ class QuantumBatteryItem : Item {
return howMuch return howMuch
} }
val newEnergy = (delegate.value + howMuch.coerceAtMost(throughput!!)).coerceAtMost(capacity!!) if (delegate.value >= capacity!!) {
return ImpreciseFraction.ZERO
}
val newEnergy = (delegate.value + howMuch.coerceAtMost(throughput!!)).coerceAtMost(capacity)
val diff = newEnergy - delegate.value val diff = newEnergy - delegate.value
if (!simulate) { if (!simulate) {