Prevent fractional charge leftovers in capacitors (bdew/generators#43)

This commit is contained in:
bdew committed 2015-07-19 22:56:14 +03:00
1 parent 89b54300e3
commit f2cdba7800
1 file changed
+1
@@ -34,6 +34,7 @@ case class DataSlotPower(name: String, parent: DataSlotContainer) extends DataSl
val canExtract = Misc.clamp(v, 0F, stored)
if ((canExtract > 0) && !simulate) {
stored -= canExtract
if (stored < 1) stored = 0
parent.dataSlotChanged(this)
}
return canExtract