From: James T. <zak...@ma...> - 2014-12-10 14:44:41
|
On 10 Dec 2014, at 10:59, Anton Gomez Alvedro <gal...@gm...> wrote: > I have two Nasal modules that try to behave properly on reinit, but I am actually unsure that I am implementing the right behavior. > > (see http://forum.flightgear.org/viewtopic.php?f=30&t=24699&start=15#p226529 > and http://forum.flightgear.org/viewtopic.php?f=66&t=21855&start=90#p226527) > > Could someone please summarize what does /sim/signals/reinit represent (is it only teleporting, a request to start from scratch for every system, other), and how should Nasal scripts behave on such events? > > I also read a while ago that the plan was to drop the Nasal context entirely on reinit, so I wonder if Nasal scripts should take these signals into account or not. A ‘reset’ now restarts Nasal (and every other subsystem) entirely - this is what happens when changing aircraft or or choosing ‘reset’ from the File menu. (And some other actions can also trigger it). The old ‘reset’, which does *not* restart Nasal, is now stripped down to the bare minimum of systems needed for repositioning (tele-porting). Since many aircraft Nasal scripts rely on /sim/signals/reinit to do work on being teleported, that behaviour was also retained. In an ideal world, there would be a better API to inform aircraft and Nasal modules about a teleport, but for the meantime, the property you mentioned is the one. Eg, really we should have an API to distinguish on-ground vs in-air starts, and adjust the initial state of properties accordingly. BTW, for the new reset process, the subsystem, including Nasal, is actually destroyed and re-created. This is intentionally to make it almost certain the behaviour after a reset is the same as after the first launch of the sim. Kind regards, James |