Page 2 of 2

Re: mission control

Posted: Wed Mar 04, 2015 3:07 pm
by Cody
spara wrote:
Does it just keep on running, possibly spawning new things?
In interstellar space? I might have the wrong end of the stick, but it does carry on spawning 'things'.

Re: mission control

Posted: Wed Mar 04, 2015 6:19 pm
by cim
spara wrote:
Ok. Old skool methods then. How about repopulator in witchspace? I assume that it can't be overridden either. Does it just keep on running, possibly spawning new things?
Again, if you know the location in advance, you can override it in planetinfo. If not, you do have the option of overriding general interstellar space in planetinfo, and then manually calling the default function for anywhere you don't want to override - of course, that's incompatible with any other OXP wanting to do the same.

I'll keep thinking about providing JS overrides of interstellar space in time for 1.82. It should be possible.

Re: mission control

Posted: Wed Mar 04, 2015 6:45 pm
by spara
cim wrote:
spara wrote:
Ok. Old skool methods then. How about repopulator in witchspace? I assume that it can't be overridden either. Does it just keep on running, possibly spawning new things?
Again, if you know the location in advance, you can override it in planetinfo. If not, you do have the option of overriding general interstellar space in planetinfo, and then manually calling the default function for anywhere you don't want to override - of course, that's incompatible with any other OXP wanting to do the same.

I'll keep thinking about providing JS overrides of interstellar space in time for 1.82. It should be possible.
Thank you for patiently answering my questions :) . I seem to have misunderstood you earlier as I though you meant overriding the populator in runtime. I get it now :D . However, it seems a bit harsh to take over the populator in planetinfo, so JS override would be nice. At least with scriptedMisjump. If taking over the populator would be tied to scriptedMisjump, it could act as a flag for OXPs that something big is going to happen in witchspace and maybe act accordingly.

Re: mission control

Posted: Wed Mar 04, 2015 7:22 pm
by cim
spara wrote:
If taking over the populator would be tied to scriptedMisjump, it could act as a flag for OXPs that something big is going to happen in witchspace and maybe act accordingly.
Changing the populator is an automatic flag to OXPs - they all get out of the way, unless they've specifically arranged to also have something for your new populator function name. And if I can get it scriptable, you can do it in shipWillEnterWitchspace just fine. (There's some race condition potential with scriptedMisjump in that function, as multiple OXPs can turn it on and off independently of each other in arbitrary sequence ... but if you're running stuff through the populator functions if you end up in the wrong place it should be possible to failsafe)

Re: mission control

Posted: Wed Mar 04, 2015 7:38 pm
by spara
Testing rerouting interstellarspace populator functions and repopulator does not seem to get overridden. Maybe I'm just tired, but I don't see any error here.

planetinfo.plist:

Code: Select all

{
"interstellar space" = {
		"populator" = "xsInterstellarSpaceWillPopulate";
		"repopulator" = "xsInterstellarSpaceWillRepopulate";
	};
}
and an odd worldscript has these:

Code: Select all

this.xsInterstellarSpaceWillPopulate = function() {
	log("test", "populator");
}

this.xsInterstellarSpaceWillRepopulate = function() {
	log("test", "repopulator");
}
When misjumping, this.xsInterstellarSpaceWillPopulate fires, but this.xsInterstellarSpaceWillPopulate does not and instead thargoids start spawning.

Re: mission control

Posted: Wed Mar 04, 2015 7:44 pm
by cim
That looks like it should work. When there, what's the values of

Code: Select all

system.info.populator
system.info.repopulator
in the debug console?

Re: mission control

Posted: Wed Mar 04, 2015 8:52 pm
by spara
cim wrote:
That looks like it should work. When there, what's the values of

Code: Select all

system.info.populator
system.info.repopulator
in the debug console?
These don't give anything. Not in normal space or in interstellar space. Are these properties readable from system.info object as for example system.info.description works just fine?

Re: mission control

Posted: Wed Mar 04, 2015 10:56 pm
by cim
"Nothing" would imply "unset, use hard-coded default", in this case.

All planetinfo properties should be accessible through system.info.<property> (and with a few necessary exceptions, writable in regular space)

Re: mission control

Posted: Thu Mar 05, 2015 7:25 am
by spara
It looks like there is something wrong somewhere. I tested with this in planetinfo.plist:

Code: Select all

{
	"interstellar space" = {
		"populator" = "xsInterstellarSpaceWillPopulate";
		"repopulator" = "xsInterstellarSpaceWillRepopulate";
	};
	"0 7" = {
		"populator" = "xsInterstellarSpaceWillPopulate";
		"repopulator" = "xsInterstellarSpaceWillRepopulate";
	};
}
Lave gives this:

Code: Select all

> system.info.populator
xsInterstellarSpaceWillPopulate
> system.info.repopulator
xsInterstellarSpaceWillRepopulate
Interstellar space gives this:

Code: Select all

> system.info.repopulator
> system.info.populator
However interstellar space remained empty and my logging functions show that the custom populators are used.

The weird thing is that when I strip planetinfo.plist to this

Code: Select all

{
	"interstellar space" = {
		"populator" = "xsInterstellarSpaceWillPopulate";
		"repopulator" = "xsInterstellarSpaceWillRepopulate";
	};
}
After jumping to interstellar space logging functions stay dead and thargoids make sure that I'm shortly too.

Re: mission control

Posted: Thu Mar 05, 2015 7:40 am
by cim
Okay - I'll set aside some time this weekend to look at this. I've also got an idea now for how to allow interstellar setting via JS.

Re: mission control

Posted: Sat Mar 07, 2015 1:18 pm
by cim
spara wrote:
The weird thing is that when I strip planetinfo.plist to this

Code: Select all

{
	"interstellar space" = {
		"populator" = "xsInterstellarSpaceWillPopulate";
		"repopulator" = "xsInterstellarSpaceWillRepopulate";
	};
}
After jumping to interstellar space logging functions stay dead and thargoids make sure that I'm shortly too.
There was a bug where if a property was only used in interstellar space, it would not be processed. That's fixed now, though there's more to do.

Re: mission control

Posted: Sun Mar 08, 2015 3:22 pm
by spara
Thanks cim, you're amazingly fast in delivering requested changes :D . The new setInterstellarProperty appears to be working nicely and offers a lot of flexibility for OXPs wanting to "own" the interstellar space for a while.

For those interested, claiming the populator and repopulator for interstellar space before going in is now this easy:

Code: Select all

SystemInfo.setInterstellarProperty(0, 7, 55, 2, "populator", "customInterstellarSpaceWillPopulate");
SystemInfo.setInterstellarProperty(0, 7, 55, 2, "repopulator", "customInterstellarSpaceWillRepopulate");
And of course you need to have customInterstellarSpaceWillPopulate and customInterstellarSpaceWillRepopulate somewhere and make them actually do something.

When finished, jump out and revert the populator/repopulator back to basics:

Code: Select all

SystemInfo.setInterstellarProperty(0, 7, 55, 2, "populator", null);
SystemInfo.setInterstellarProperty(0, 7, 55, 2, "repopulator", null);
A couple of minor notes. There's some debug message left in that should be removed at some point

Code: Select all

16:57:20.580 [i.debug]: interstellar: 0 7 55
and the order of parameters in wiki did not match the order in game (according to the game layer should come after tosystem). I fixed wiki to match game.

The next obvious question is: How to query interstellar properties? Especially populator. :mrgreen: