Difference between revisions of "NPC Energy Units OXP"
(→Downloads) |
(Updating BB links) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 45: | Line 45: | ||
== Downloads == | == Downloads == | ||
− | The latest version is available on the Expansion Manager and here: [[Media: | + | The latest version is available on the Expansion Manager and here: [[Media:npcEnergyUnits-1.0.2.oxz|NPC Energy Units v1.0.2]] |
== Version History == | == Version History == | ||
+ | |||
+ | Version 1.0.2 (july/2022): | ||
+ | * Fixes damage handler exported to NPC Equipment Damage OXP (it's called for any equipment damaged ina NPC, not only energy units, as it formerly expected). | ||
+ | * Removes some redundant logging messages. | ||
+ | * Don not award energy units to NPX of low accuracy (less than 0), since they are too green/incompetent to afford them. | ||
+ | * Reduces the probablities for awarding Naval Energy Units (they should be rare), making sure high recharging rate ships (7 or greater) do not get them. | ||
+ | |||
+ | |||
+ | 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 58: | Line 71: | ||
{{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.2 |
− | |release = | + | |release = 2022-07-03 |
|license = CC-BY-SA 4.0 | |license = CC-BY-SA 4.0 | ||
|features = Enables the NPCs energy units | |features = Enables the NPCs energy units | ||
|category = Mechanics OXPs | |category = Mechanics OXPs | ||
|author = [[User:Dybal|Dybal]] | |author = [[User:Dybal|Dybal]] | ||
− | |feedback = [ | + | |feedback = [https://bb.oolite.space/viewtopic.php?f=4&t=18161 Oolite BB] |
}} | }} | ||
Latest revision as of 02:12, 29 February 2024
Contents
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.2
Version History
Version 1.0.2 (july/2022):
- Fixes damage handler exported to NPC Equipment Damage OXP (it's called for any equipment damaged ina NPC, not only energy units, as it formerly expected).
- Removes some redundant logging messages.
- Don not award energy units to NPX of low accuracy (less than 0), since they are too green/incompetent to afford them.
- Reduces the probablities for awarding Naval Energy Units (they should be rare), making sure high recharging rate ships (7 or greater) do not get them.
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
Version | Released | License | Features | Category | Author(s) | Feedback |
---|---|---|---|---|---|---|
1.0.2 | 2022-07-03 | CC-BY-SA 4.0 | Enables the NPCs energy units | Mechanics OXPs | Dybal | Oolite BB |