Cargo Space Correction OXP
Fixes Cargo Space problems arising from other OXPs
Overview
OXP's that play around with the cargoSpaceCapacity property of the player ship often end up fighting with the core vanilla game for control of the property! And depending on the order of events, it could result in cargo being lost.
This OXP recalculates the correct cargo space, after all the goods containers, pods and refits are installed, and then restores any cargo you might have lost during the standard loading process. This should make the various cargo space modifications work successfully, regardless of the order of events.
Warning
This will only work if it is already loaded into your original game before you save it - and then again when you reload your old Jameson into a new game. So if you have a problem and have just discovered this OXP it will be too late!
But it will prevent more problems in the future!
The Dark Side
Q: How does this OXP handle different load sequences? A: By bypassing the sequence entirely. It waits until all the startUp and startUpComplete events have fired (which is usually where the cargo space is changed) and then recalculates the correct space based on installed equipment, and updates the value again. And then it forces all the cargo back to the values stored when it was last saved. Q: I believe such a bugfix should go into the core game. A: Not sure. Based on what was observed, there appears to be a small variation in the way cargo space is applied if you load a game after restarting the entire game, and if you're reloading from an existing game (or at least, that's what I read into the comments). I'd need to do some tests to see if I can observe anything that can be patched. (From Hiran/Phkb 2024)
License
- Author: Phkb
- CC-BY-SA 4.0
- Oolite version 1.82 or newer
Download
- Box.com (2024)
Links
- BB Post - but search the wiki for CargoSpaceCorrection / Cargo Space Correction
- Oolite JavaScript Reference: Ship#cargoSpaceCapacity