Confused Stations...

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Post 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...
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

So I could do this instead?:
if(!sun || system.isInterstellarSpace || !this.firstLaunch)
...or would I need !system.sun ?
User avatar
Cmd. Cheyd
---- E L I T E ----
---- E L I T E ----
Posts: 934
Joined: Tue Dec 16, 2008 2:52 pm
Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...

Post 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.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

Still wouldn't !system.sun basically be true for both system.isInterstellarSpace and system.sun.hasGoneNova ?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post 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).
Last edited by Thargoid on Sun Nov 21, 2010 7:11 pm, edited 1 time in total.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post 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.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post 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?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post 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.
Post Reply