Debian Codegraph @

AI/Maritime/MP-Carriers/mp-truman-0.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <!--
3 Multiplayer carrier Truman fallback model. ID# 804
4
5 This will connect the MP carrier to the AI carrier when the low detail model is loaded.
6 Later on if the high detail model is also loaded it will be still be good
7 because the logic is resilient enough not to trample over itself.
8
9 Copyright (C) 2021 : Richard Harrison [email protected]
10 Copyright (C) 2007 - 2016 Anders Gidenstam (anders(at)gidenstam.org)
11
12 This file is released under the GPL license version 2 or later.
13 -->
14 <PropertyList>
15
16 <nasal>
17 <load>
18 <![CDATA[
19 ##############################################################################
20 # This logic connects the carrier to the AI carrier
21
22 var rplayer = cmdarg();
23 print("MP Truman(Fallback): LOAD " ~ rplayer.getPath());
24
25 # Load the main MPCarriers Nasal module if needed.
26 if (!contains(globals, "MPCarriers")) {
27 var base = "Aircraft/Generic/MPCarriers.nas";
28 io.load_nasal(resolvepath(base), "MPCarriers");
29 }
30
31 # Create manager class.
32 var manager = nil;
33 var accept_callsign = "/sim/mp-carriers/truman-callsign";
34
35 var init = func {
36 # Initialize the callsign property if not done already.
37 props.globals.initNode(accept_callsign, "", "STRING");
38
39 manager = MPCarriers.Manager.new(rplayer,
40 "Truman",
41 props.globals.getNode(accept_callsign));
42 print("MP Truman(Fallback): " ~ rplayer.getPath() ~ " done.");
43 }
44
45 settimer(init, 3); # 3 second delay should be sufficient
46 print("MP Truman(Fallback): " ~ rplayer.getPath() ~ " waiting.");
47 ##############################################################################
48 ]]>
49 </load>
50 <unload>
51 <![CDATA[
52 ##############################################################################
53 print("MP Truman(Fallback): unload", cmdarg().getPath());
54 if (manager != nil) manager.die();
55 ##############################################################################
56 ]]>
57 </unload>
58 </nasal>
59
60 </PropertyList>