NPC Energy Units OXP
NPC Energy Units OXP aims to make the energy units in NPC ships operational, enhancing the NPCs energy recharge rate.
For those NPC ships created with the energy units, this OXP will enable them by itself, for those ships whose energy units were granted by OXPs after the ship was spawned, this OXP makes available a function for the awarding OXP to call to enable the awarded energy unit.
This OXP also awards energy units (civilian and naval) to NPCs, based on their accuracy (the higher accuracy have greater probability of getting them) and recharge rate (the higher recharge rates have lesse probability of getting the energy units).
Notes for OXP developers
This OXP makes available the following functions:
- A convenience function that returns the equipment Key for any energy unit installed on the ship, or null if the ship has none.
- Updates the ship's energy recharge rate to the factory value boosted by the energy unit installed, if it's not damaged.
- Returns true if the ship's energy recharge was modified and false otherwise.
- An event handler for damage to energy units, it MUST be called in the context ('this') of the ship's script, as in:
- It restores the ship to its factory energy recharge rate if the equipmentKey is an energy unit and its status in the ship isn't EQUIPMENT_OK: it can be called after an energy unit is removed from the ship to reset its energy recharge rate, but that means that if the ship has a naval energy unit and this function is called with the key for an extra energy unit, the ship's energy recharge rate WILL be reset, rendering the naval energy unit non-functional.
This OXP includes this function in NPC Equipment Damage OXP list of equipment damage handlers if that OXP is installed.