d9ffc50011
Generally this change proves that we probably don't need the MPCarrier model on the target system - because by using the fallback model to load the Nasal this will happen without needing the high detail models at all. To support this : - Added fallback models for all carriers (defined as AI scenarios) - Added logic to fallback models so that MP carriers load correctly - The model will still be the AI model. - MPCarriers.nas from MPCarrier/systems now in Aircraft/Generic
60 lines
2.2 KiB
XML
60 lines
2.2 KiB
XML
<?xml version="1.0"?>
|
|
<!--
|
|
Multiplayer carrier Sanantonio fallback model. ID# 810
|
|
|
|
This will connect the MP carrier to the AI carrier when the low detail model is loaded.
|
|
Later on if the high detail model is also loaded it will be still be good
|
|
because the logic is resilient enough not to trample over itself.
|
|
|
|
Copyright (C) 2021 : Richard Harrison rjh@zaretto.com
|
|
Copyright (C) 2007 - 2016 Anders Gidenstam (anders(at)gidenstam.org)
|
|
|
|
This file is released under the GPL license version 2 or later.
|
|
-->
|
|
<PropertyList>
|
|
|
|
<nasal>
|
|
<load>
|
|
<![CDATA[
|
|
##############################################################################
|
|
# This logic connects the carrier to the AI carrier
|
|
|
|
var rplayer = cmdarg();
|
|
print("MP Sanantonio(Fallback): LOAD " ~ rplayer.getPath());
|
|
|
|
# Load the main MPCarriers Nasal module if needed.
|
|
if (!contains(globals, "MPCarriers")) {
|
|
var base = "Aircraft/Generic/MPCarriers.nas";
|
|
io.load_nasal(resolvepath(base), "MPCarriers");
|
|
}
|
|
|
|
# Create manager class.
|
|
var manager = nil;
|
|
var accept_callsign = "/sim/mp-carriers/sanantonio-callsign";
|
|
|
|
var init = func {
|
|
# Initialize the callsign property if not done already.
|
|
props.globals.initNode(accept_callsign, "", "STRING");
|
|
|
|
manager = MPCarriers.Manager.new(rplayer,
|
|
"Sanantonio",
|
|
props.globals.getNode(accept_callsign));
|
|
print("MP Sanantonio(Fallback): " ~ rplayer.getPath() ~ " done.");
|
|
}
|
|
|
|
settimer(init, 3); # 3 second delay should be sufficient
|
|
print("MP Sanantonio(Fallback): " ~ rplayer.getPath() ~ " waiting.");
|
|
##############################################################################
|
|
]]>
|
|
</load>
|
|
<unload>
|
|
<![CDATA[
|
|
##############################################################################
|
|
print("MP Sanantonio(Fallback): unload", cmdarg().getPath());
|
|
if (manager != nil) manager.die();
|
|
##############################################################################
|
|
]]>
|
|
</unload>
|
|
</nasal>
|
|
|
|
</PropertyList>
|