This is a test version for proof of concept. It does nothing at all of use at the moment. Unless you're an OXP developer who would like to use this functionality and wants to see how it might work, you probably shouldn't even download it. It doesn't do anything on its own, anyway.
Still reading after that warning? Here's the link: LibPlanetInfo 0.1
The basic problem is that if more than one OXP wants to add planet info description data for the same system, the result is an unpredictable mess. If they both use planetinfo.plist entries, then only one - and not even necessarily a consistent one - can win. If they use system.info, then the changes can remain long after the OXP is uninstalled, and there's still no easy way to deal with two OXPs acting at once.
So, here's a short library OXP to allow other OXPs to co-ordinate their efforts in an agreed fashion.
When you hit the F7 key, the library looks through its list of registered OXPs, and calls each of them in order to dynamically build up a system description in four categories. When you move away from the system data screen, it discards the information again to keep it out of the save file.
Information is currently available in four categories:
- General: the information currently in the base game, or flavour text added by OXPs like Famous Planets. If nothing changes it, this will be whatever planetinfo.plist would normally say.
- Economy: special economic information. Bloomberg Markets, New Cargoes, etc.
- Affiliation: "This is GalNavy Sector Command 3", "This is one of the Royal Houses of Santaari", etc.
- Mission: temporary information added by mission OXPs.
To make room for this information, your HUD will be temporarily disabled on the F7 screen.
0.1 comes with a demonstration script (Scripts/libplanetinfo-demo.js) to show off the functionality. If you have Famous Planets installed, then Arexe in Chart 1 is a good example. (All planetinfo.plist-only OXPs are automatically compatible with this OXP, though not of course with each other...)
Between the readme.txt and the demonstration script the API should be pretty obvious. There will be more documentation later.
Known issue: Your save file will eventually fill up with a load of blank planet entries. This is a bug/feature in the way Oolite manages local_planetinfo_overrides. Any other OXP that sets and then unsets system.info is affected in the same way; if you play long enough, Bloomberg Markets will also fill up your save file, though at perhaps a millionth of the rate that this OXP will. Total impact - probably about 100k of extra file size once you've thoroughly explored the eight, 95k of which is XML padding.
So, what do you think? Is this worth doing? Is the API sufficient? Are there any unexpected issues with doing it this way?