oolite-equipment-control.js
Posted: Wed Aug 12, 2020 9:01 pm
When I worked on oolite-equipment-control.js for this, some of the code there seemed familiar... there're at least two OXP I'm maintaining that copy/pasted code from there for use on NPCs (N-Shields and NavalGridNext).
It wouldn't be difficult to change oolite-equipment-control.js so those equipmentAdded and equipmentRemoved event handlers could be called bound to ship scripts and call the equipmentEnable and equipmentDisable functions to update the properties of a NPC ship. With that I could change those OXPs to use the common code in oolite-equipment-control.js and not have it duplicated (and risk them becoming out-of-sync in the fullness of time... ).
And it would be possible to attach those event handlers to the ship scripts and have the ship's properties kept updated as other scripts award/remove those core game equipments to the ship - as it's now it can get messy with more than one OXP awarding things...
As far as I know, max.[Aft|Forward]Shield and [aft|forward].ShieldRechargeRate (updated when inserting/removing EQ_SHIELD_BOOSTER and EQ_NAVAL_SHIELD_BOOSTER) for NPC ships are ignored by the core game and updating them have no consequences without OXPs to handle the NPC shields (like N-Shields)
But I think the core game uses energyRechargeRate for NPCs, so updating it when the NPC is awarded EQ_ENERGY_UNIT or EQ_NAVAL_ENERGY_UNIT would make a difference...
What do you think, people? Is it worthwhile to do?
It wouldn't be difficult to change oolite-equipment-control.js so those equipmentAdded and equipmentRemoved event handlers could be called bound to ship scripts and call the equipmentEnable and equipmentDisable functions to update the properties of a NPC ship. With that I could change those OXPs to use the common code in oolite-equipment-control.js and not have it duplicated (and risk them becoming out-of-sync in the fullness of time... ).
And it would be possible to attach those event handlers to the ship scripts and have the ship's properties kept updated as other scripts award/remove those core game equipments to the ship - as it's now it can get messy with more than one OXP awarding things...
As far as I know, max.[Aft|Forward]Shield and [aft|forward].ShieldRechargeRate (updated when inserting/removing EQ_SHIELD_BOOSTER and EQ_NAVAL_SHIELD_BOOSTER) for NPC ships are ignored by the core game and updating them have no consequences without OXPs to handle the NPC shields (like N-Shields)
But I think the core game uses energyRechargeRate for NPCs, so updating it when the NPC is awarded EQ_ENERGY_UNIT or EQ_NAVAL_ENERGY_UNIT would make a difference...
What do you think, people? Is it worthwhile to do?