| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <PropertyList> |
| 4 | <path>RP-3.ac</path> |
| 5 | |
| 6 | <nasal> |
| 7 | <load> |
| 8 | var path = cmdarg(); |
| 9 | var name_node = path.getNode("name",1); |
| 10 | print("LOAD " ~ name_node.getValue() ~ " " ~ path.getPath()); |
| 11 | |
| 12 | var loopid = 0; |
| 13 | var force_path_node = path.getNode("force/path",1); |
| 14 | var elapsed_time_node = path.getNode("sim/time/elapsed-sec",1); |
| 15 | var pch_node = path.getNode("orientation/pitch-deg", 1); |
| 16 | var hdg_node = path.getNode("orientation/hdg-deg", 1); |
| 17 | var force_stab_node = path.getNode("controls/force-stabilized", 1); |
| 18 | var aero_stab_node = path.getNode("controls/aero-stabilized", 1); |
| 19 | var smoke_node = path.getNode("controls/smoke", 1); |
| 20 | var slaved_node = path.getNode("controls/slave-to-ac", 1); |
| 21 | var invisible_node = path.getNode("controls/invisible", 1); |
| 22 | var load_node = props.globals.getNode("sim/stores/load-RP-3-60",1); |
| 23 | |
| 24 | elapsed_time_node.setBoolValue(0); |
| 25 | pch_node.setDoubleValue(0); |
| 26 | hdg_node.setDoubleValue(0); |
| 27 | |
| 28 | |
| 29 | var station = substr(name_node.getValue(), 11); |
| 30 | var control_node = props.globals.getNode("controls/armament/station[" ~ station ~ "]/release-all",1); |
| 31 | var control_all_node = props.globals.getNode("/controls/armament/release-all",1); |
| 32 | var parent_pch_node = props.globals.getNode("/orientation/pitch-deg", 1); |
| 33 | var parent_hdg_node = props.globals.getNode("/orientation/hdg-deg", 1); |
| 34 | |
| 35 | control_node.setBoolValue(0); |
| 36 | control_all_node.setBoolValue(0); |
| 37 | |
| 38 | #pch_node.setDoubleValue(parent_pch_node.getValue()); |
| 39 | #hdg_node.setDoubleValue(parent_hdg_node.getValue()); |
| 40 | |
| 41 | var force_path = force_path_node.getValue(); |
| 42 | |
| 43 | var force_lb_node = props.globals.getNode(force_path,1).getChild("force-lb",0,1); |
| 44 | var force_azimuth_deg_node = props.globals.getNode(force_path,1).getChild("force-azimuth-deg",0,1); |
| 45 | var force_elevation_deg_node =props.globals.getNode(force_path,1).getChild("force-elevation-deg",0,1); |
| 46 | |
| 47 | force_lb_node.setDoubleValue(0); |
| 48 | force_elevation_deg_node.setDoubleValue(pch_node.getValue()); |
| 49 | force_azimuth_deg_node.setDoubleValue(hdg_node.getValue()); |
| 50 | |
| 51 | smoke_node.setBoolValue(0); |
| 52 | force_stab_node.setBoolValue(0); |
| 53 | aero_stab_node.setBoolValue(0); |
| 54 | |
| 55 | var loop = func(id) { |
| 56 | id == loopid or return; |
| 57 | |
| 58 | force_elevation_deg_node.setDoubleValue(pch_node.getValue()); |
| 59 | force_azimuth_deg_node.setDoubleValue(hdg_node.getValue()); |
| 60 | |
| 61 | # print ("all ", control_all_node.getValue()," "," pair ", control_node.getValue()); |
| 62 | |
| 63 | if(load_node.getValue() == 0){ |
| 64 | #print("unload RP3-60"); |
| 65 | invisible_node.setBoolValue(1); |
| 66 | smoke_node.setBoolValue(0); |
| 67 | settimer(func { loop(id) },0); |
| 68 | return; |
| 69 | }elsif (control_all_node.getValue() == 1 or control_node.getValue() == 1){ |
| 70 | #print("RP3-60 unslaved"); |
| 71 | slaved_node.setBoolValue(0); |
| 72 | |
| 73 | if(elapsed_time_node.getValue() > 0 and elapsed_time_node.getValue() < 0.333){ |
| 74 | force_stab_node.setBoolValue(1); |
| 75 | aero_stab_node.setBoolValue(0); |
| 76 | force_lb_node.setDoubleValue(1500); |
| 77 | smoke_node.setBoolValue(1); |
| 78 | } elsif (elapsed_time_node.getValue() >= 0.333 and elapsed_time_node.getValue() < 3.0){ |
| 79 | #print("RP3-60 boost"); |
| 80 | force_stab_node.setBoolValue(0); |
| 81 | aero_stab_node.setBoolValue(1); |
| 82 | force_lb_node.setDoubleValue(1500); |
| 83 | smoke_node.setBoolValue(1); |
| 84 | } else { |
| 85 | #print("RP3-60 coast or never launched"); |
| 86 | force_stab_node.setBoolValue(0); |
| 87 | aero_stab_node.setBoolValue(1); |
| 88 | force_lb_node.setDoubleValue(0); |
| 89 | smoke_node.setBoolValue(0); |
| 90 | } |
| 91 | |
| 92 | } else { |
| 93 | #print("RP3-60 slaved"); |
| 94 | slaved_node.setBoolValue(1); |
| 95 | invisible_node.setBoolValue(0); |
| 96 | aero_stab_node.setBoolValue(0); |
| 97 | force_stab_node.setBoolValue(0); |
| 98 | smoke_node.setBoolValue(0); |
| 99 | elapsed_time_node.setBoolValue(0); |
| 100 | force_lb_node.setDoubleValue(0); |
| 101 | } |
| 102 | |
| 103 | #print("pitch ", force_elevation_deg_node.getValue(), " hdg ", force_azimuth_deg_node.getValue(), |
| 104 | #" force ", force_lb_node.getValue()); |
| 105 | |
| 106 | settimer(func { loop(id) },0); |
| 107 | } |
| 108 | |
| 109 | loop(loopid); |
| 110 | |
| 111 | </load> |
| 112 | <unload> |
| 113 | print("UNLOAD AI 3Inch RP 60lbs", path.getPath()); |
| 114 | loopid += 1; |
| 115 | </unload> |
| 116 | </nasal> |
| 117 | |
| 118 | <animation> |
| 119 | <enable-hot type="bool">false</enable-hot> |
| 120 | </animation> |
| 121 | |
| 122 | <model> |
| 123 | <path>Models/Geometry/RP-3/exhaust-smoke.xml</path> |
| 124 | <name>Smoke</name> |
| 125 | <offsets> |
| 126 | <x-m>1</x-m> |
| 127 | <y-m>0</y-m> |
| 128 | <z-m>0</z-m> |
| 129 | </offsets> |
| 130 | </model> |
| 131 | |
| 132 | <animation> |
| 133 | <type>select</type>> |
| 134 | <object-name>Smoke</object-name> |
| 135 | <condition> |
| 136 | <equals> |
| 137 | <property>controls/smoke</property> |
| 138 | <value>1</value> |
| 139 | </equals> |
| 140 | </condition> |
| 141 | </animation> |
| 142 | |
| 143 | <animation> |
| 144 | <type>select</type>> |
| 145 | <object-name>Rail Assmbly</object-name> |
| 146 | </animation> |
| 147 | |
| 148 | <animation> |
| 149 | <type>select</type>> |
| 150 | <object-name>Shot-25lbs</object-name> |
| 151 | </animation> |
| 152 | |
| 153 | </PropertyList> |