After removing energy upgrades, machines retains all energy stored, even if the amount is above the new maxEnergy limit.
JaSpr opened this issue ยท 6 comments
This is causing issues with other plug-ins that display a bar graph of stored energy -vs- max energy:
A story in pictures: http://imgur.com/a/VTd7t
Each time an efficiency upgrade is removed from the machine, the code appears to properly adjust the "total available" (max) energy that the machine can hold, but doesn't update the total actual energy that the item is holding.
The energy bar can thus extend all the way across the screen.
After cloning the code and testing, I've found that the actual issue is that adding energy upgrades temporarily increases a machine's energy capacity (maxEnergy). So if you install upgrades, the capacity goes up, and then you can continue to charge the item to get it up to its new capacity.
Once you remove the upgrade, the machine might have stored energy above the new capacity.
A discussion should be had as to whether this should be considered "as designed" (perhaps we don't want the user to lose the energy they already spent charging the machine up), and, if so, whether we want to report it as the higher value, or report it as the maxEnergy capacity until it goes back below that threshold organically (i.e. we could retain the total stored energy, but report it as Math.min(storedEnergy, maxEnergy)
).
If I would design it, I would make it that removing an energy upgrade also decreases the stored energy to the max level. It's like removing a battery, the energy won't stay.
@thommy101 If your battery analogy is true, that would mean that the extra energy is being stored on the upgrades themselves, which means that when they get inserted into a new machine it should instantly get that extra energy, no charging needed. If that's not how upgrades work, then the energy should stay in the machine.
As a note, TOP was updated to prevent the power bar graph from ever extending beyond the bounds of the graph itself. That being said, this issue doesn't affect TOP anymore (for which it was originally created), but perhaps a discussion should still be had.