About shared JS context for vehicles , yes I now checked that variables are indeed shared by the SAME type of vehicle..great !!
A check for planes shows that plane JS context does not share variables among planes, not even of the same type. Will live with it.
So I modified the missiles to get the reference to the plugin interface just in the init_chassis for "vehicle type missiles" to avoid repeated calls to get it.
For "JSBSIM-aricraft-type missiles" while there is just initialize_reload apparently there is also no need to do the check as it seems plane JS context does not share variables with anything and so there is no risk of repeated calls.
... Works fine and i can still create as many instances as I want from the jet's or the tank's scripts.
regarding the question wether the created objects can use simultaneously also the outerra normal interfaces the answer is yes. In my missile code I already request the world and explosions interface.
finally also I can spawn different jets which all can launch missiles using the same plugin, so not only a script can create objects which reference the plugin but different scripts of any kind (same vehicle or different vehicle or plane or boat) all can reference the plugin and create objects that reference the plugin...no limitation at all in no direction !
So finally everything is fine and we have lots of working new possibilities to share info among vehicles/planes etc.. !! Its now time to exploit all these possibilities !
function init_chassis(){
$plugin = this.$query_interface('xt::js::global_variables.get');
}
function initialize(reload){
if (! $plugin) {
$plugin = this.$query_interface('xt::js::global_variables.get');
}
}