It's a bug (well done spotting that, by the way). The problem is here in Resources/Scripts/oolite-equipment-control.js,
this.$equipmentDisable["EQ_SHIELD_BOOSTER"] = this.$equipmentDisable["EQ_NAVAL_SHIELD_BOOSTER"]
function:
Code: Select all
player.ship.maxForwardShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
player.ship.maxAftShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
When the boosters are damaged, the script will set the maximum shield levels to what they would have been without the boosters, but it forgets to check what the actual value of the shields is at the moment of disabling the equipment. So, for a split second, the ship finds itself having forward and/or aft shields higher than what the current post-damage maximum is. This leads to negative energy drain (i.e. energy gain) in the core code, which results in the energy banks instantly filling up. To fix:
Code: Select all
player.ship.maxForwardShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
if (player.ship.forwardShield > player.ship.maxForwardShield) player.ship.forwardShield = player.ship.maxForwardShield;
player.ship.maxAftShield -= parseFloat(info.scriptInfo.oolite_shield_increase);
if (player.ship.aftShield > player.ship.maxAftShield) player.ship.aftShield = player.ship.maxAftShield;
The heart of the problem is in the core itself, which allows for negative enrergy drains to occur. However, since the behaviour is easily fixable in the script and there could be OXPs that rely on negative energy drain behaviour in the future, for now I think I'll leave the core alone and just ensure that the maximum shield values are not exceeded via the boosters script.