Page 2 of 2

Posted: Sun Nov 21, 2010 4:17 pm
by Mauiby de Fug
I have to say, I quite like the idea of the Wasps appearing in witchspace! But the Sothis station really shouldn't be there...

Posted: Sun Nov 21, 2010 6:53 pm
by Switeck
So I could do this instead?:
if(!sun || system.isInterstellarSpace || !this.firstLaunch)
...or would I need !system.sun ?

Posted: Sun Nov 21, 2010 7:02 pm
by Cmd. Cheyd
I use the following in my script that requires similar logic:

Code: Select all

if (this.systemDone || system.isInterstellarSpace || system.sun.hasGoneNova) return;
The this.systemDone is a Boolean I set when I have determined I've done everything in the system I need to, so I don't repeat doing it on subsequent launches within the same system.

Posted: Sun Nov 21, 2010 7:06 pm
by Switeck
Still wouldn't !system.sun basically be true for both system.isInterstellarSpace and system.sun.hasGoneNova ?

Posted: Sun Nov 21, 2010 7:06 pm
by Thargoid

Code: Select all

if(system.isInterstellarSpace || system.sun.isGoingNova || system.sun.hasGoneNova ||  !this.firstLaunch)
Presuming that the action when the above is true is to just return or something like that (ie not do something).

Interstellar space is the only time when the "system" won't have a sun, so implicitly you have a check that there is a sun. The other two confirm that the sun isn't in a Nova state (either in the process of doing so or has finished doing so). The last one of course is the first launch check.

On the first launch though, what I find simpler is to have a snippet using the this.shipWillLaunchFromStation function which as its final action deletes itself (with the stations added via this.shipWillExitWitchspace for every other situation).

This works well, as if it's a save-game you know you will be launching from a main station (as that's the only place you can save) and once you have launched once, then the system is all set up and ready (and that code section is never needed again as for all other systems you will enter them from witchspace).

Posted: Sun Nov 21, 2010 7:08 pm
by Thargoid
Switeck wrote:
Still wouldn't !system.sun basically be true for both system.isInterstellarSpace and system.sun.hasGoneNova ?
JS will still see the sun as there, but as a nova sun. If system.sun doesn't exist then system.sun.hasGoneNova doesn't make sense, as it's a property of it (and will generate a JS error).

If !system.sun is true, then there's nothing for the script to be testing for being nova or not iyswim.

Posted: Sun Nov 21, 2010 7:24 pm
by Switeck
Thargoid wrote:
This works well, as if it's a save-game you know you will be launching from a main station (as that's the only place you can save)
Might that interfere with save anywhere OXP, which saves the game at OXP stations?

Posted: Sun Nov 21, 2010 8:12 pm
by Thargoid
Switeck wrote:
Thargoid wrote:
This works well, as if it's a save-game you know you will be launching from a main station (as that's the only place you can save)
Might that interfere with save anywhere OXP, which saves the game at OXP stations?
No, SA just moves you to the main station to save (you still can't save anywhere other than the main station in Oolite, SA just cheats it in the same way that PF cheats for planetary landings).

So when you do that you'll generate your system in exactly the same way.