Summary: if you do nothing and keep the pre-1.79 way of addition, you will not be able to save at the OXP station under any circumstances, and
things will just keep working as they were. Unless for mission purposes you really don't want the player to be able to save there, though, I'd recommend doing it the new way which allows saving at OXP stations to be added safely., when you get a bit of time to make the change.
Smivs wrote:This is more complicated than I thought!
I hope once you've got your head round it you'll see the opportunities for simplification of the current way of doing things in the long-term, but yes, it's a bit different to what was there before, and a little bit more code to do the initial set up.
At the moment, you're presumably adding the pizza + centre using
system.addShips
in
shipWillExitWitchspace
and/or other suitable event handlers. Oolite has no way to tell from this that you are adding objects that you intend to add the next time the system is visited / reloaded, and rates the chances of their reappearance as low. Therefore, you can't save at them.
What you could do instead is add both the pizza + centre to the populator information during the new
systemWillPopulate
event handler. This still uses
system.addShips
eventually, but it has three advantages:
1) There is exactly one event handler used to populate the system, rather than saying "
shipWillExitWitchspace
... oh, but then it won't appear if the player starts in the system, so
shipWillLaunchFromStation
as well ... but what happens if they launch twice, etc?". I've seen enough bugs end up in OXPs that way: pretty much every OXP of mine that added ships in
shipWillExitWitchspace
had to have a bugfix release for "except for in interstellar space" (and then most of them also separately "except in nova systems").
2) You can tell Oolite that the stations are likely to come back in the same place as they were before, by setting the "deterministic" flag in the populator options, and providing suitable non-random coordinates.
If you do this, load/save will then be possible at the visitor centre - but there's no chance of a second one being added, because the system population is always run exactly once per system regardless of how the player enters the system.
3) OXPs, especially mission OXPs, can manage potential conflicts more easily. A lot of the populator design was done while thinking of the conversation a while back about the subtle conflict between Xeptatl's Sword and Commies: if the new populator had somehow been around in the really old days, XS could have easily said "this system is currently being used for a mission, and Commies - and other OXPs - should not touch it" for the crucial bit - but with Commies able to add the high-tech factory freely at other times.
So, for an example of use:
Code: Select all
this.systemWillPopulate = function()
{
if (this.isASystemWithAPizza()) {
system.setPopulator("smivs_giantspacepizza",
{
// a position closer to the sun than the planet is to the sun, but not too close
location: "INNER_SYSTEM_OFFPLANE",
// fix the position to be the same one every time, rather than random
locationSeed: 621863,
// these will always appear the same so long as this OXP is installed
deterministic: true,
// and this is what adds them. It gets given a 'pos' parameter, which is the result of
// Oolite translating location "INNER_SYSTEM_OFFPLANE: 621863" into real coordinates
callback: function(pos) {
system.addShips("smivs-visitor-centre",1,pos,0); // add the visitor centre to the coordinates specified
system.addShips("smivs-giant-pizza",1,pos.add([15E3,0,0]),0); // add the pizza nearby
}
});
}
}
There are lots of alternative location codes that can be used - "INNER_SYSTEM_OFFPLANE" is a good one for things which should be reasonably quick to reach by torus but have no reason to be near the main spacelanes. There are lots of other options on the page which spara linked to above.
621863 I picked by hitting the numpad at random a few times. It won't be anywhere near 62186
2 except by sheer coincidence. The idea is to let people place lots of items through different OXPs in different places in the same region (e.g. planetary orbit) without needing to explicitly worry about which other OXPs are doing the same thing - and also not having everything be in exactly the same relative positions in every single system: 621863 will be in a different place relative to the sun, planet and witchpoint in Lave than in Leesti.
Please ask if there's any more I can clarify.