Difference between revisions of "NPC Energy Units OXP"

From Elite Wiki
(Quick Facts)
(Downloads)
 
(5 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
== Notes for OXP developers ==
 
== Notes for OXP developers ==
 +
  
 
This OXP makes available the following functions:
 
This OXP makes available the following functions:
Line 44: Line 45:
 
== Downloads ==
 
== Downloads ==
  
The latest version is available on the Expansion Manager and here: [[Media:NpcEnergyUnits-1.0.oxz|NPC Energy Units v1.0]]
+
The latest version is available on the Expansion Manager and here: [[Media:NPCEnergyUnits-1.0.1.oxz|NPC Energy Units v1.0.1]]
  
 
== Version History ==
 
== Version History ==
 +
 +
Version 1.0.1 (december/2020):
 +
 +
* Adds _alreadyGotOne array (with ships that have high energy recharge rate to emulate an energy unit) for backwards compatibility with Ngalo's version (and used by Military Shields OXP).
 +
* Changes parameters for granting NEU and EEU to reduce probability of granting to ships with recharge rate above 6.
 +
  
 
Version 1.0 (november/2020):
 
Version 1.0 (november/2020):
Line 57: Line 64:
 
{{IconOXP|ooVersion="1.82"|oxpCPU="Low"|oxpMEM="Low"|oxpGPU="Low"|oxpIsAPI=true|oxpIsDocumented=true}}
 
{{IconOXP|ooVersion="1.82"|oxpCPU="Low"|oxpMEM="Low"|oxpGPU="Low"|oxpIsAPI=true|oxpIsDocumented=true}}
 
{{Infobox OXPb| title NPC Energy Units
 
{{Infobox OXPb| title NPC Energy Units
|version = 1.0
+
|version = 1.0.1
 
|release = 2020-12-02
 
|release = 2020-12-02
 
|license = CC-BY-SA 4.0
 
|license = CC-BY-SA 4.0
Line 67: Line 74:
  
 
== Gameplay and Balance indicator ==
 
== Gameplay and Balance indicator ==
[[File:Tag-colour-violet.png]]
+
[[File:Tag-colour-red.png]]
  
 
{{Mechanics-OXP}}
 
{{Mechanics-OXP}}

Latest revision as of 15:11, 9 December 2020

Description

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:

  • worldScripts.NPC_Energy_Units.$getShipEnergyUnit(ship)
A convenience function that returns the equipment Key for any energy unit installed on the ship, or null if the ship has none.


  • worldScripts.NPC_Energy_Units.$setupEnergyUnits(ship)
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.


  • worldScripts.NPC_Energy_Units.$energyUnitDamaged(equipmentKey)
An event handler for damage to energy units, it MUST be called in the context ('this') of the ship's script, as in:
   worldScripts.NPC_Energy_Units.$energyUnitDamaged.call(ship.script, equipmentKey)
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.

License

This OXP is licensed under the CC-BY-SA 4.0.

Aknowledgements

This OXP is based on Ngalo's original NPC Energy Unit.

I would rather have updated the original OXP, but although it had a CC BY-NC-SA, it didn't specify the version, so I opted to write a new one to replace it just to be in safe licensing grounds.

Downloads

The latest version is available on the Expansion Manager and here: NPC Energy Units v1.0.1

Version History

Version 1.0.1 (december/2020):

  • Adds _alreadyGotOne array (with ships that have high energy recharge rate to emulate an energy unit) for backwards compatibility with Ngalo's version (and used by Military Shields OXP).
  • Changes parameters for granting NEU and EEU to reduce probability of granting to ships with recharge rate above 6.


Version 1.0 (november/2020):

  • Initial version

Quick Facts

Levelindicator5.png
5-{{{2}}}

Minimum Oolite versionCPU usage lowMemory usage lowGPU usage lowisAPIisDocumented

Version Released License Features Category Author(s) Feedback
1.0.1 2020-12-02 CC-BY-SA 4.0 Enables the NPCs energy units Mechanics OXPs Dybal Oolite BB

Gameplay and Balance indicator

Tag-colour-red.png