From 445115e53667b03e90921d2b648eab772cf20afd Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Thu, 9 Nov 2017 12:02:35 +0200 Subject: [PATCH] Start converting Vinson to individual carrier control scheme --- .../Nimitz/vinson-parks-and-objects.xml | 2 +- Models/Geometry/Nimitz/vinson.xml | 319 +++++++++++++++++- gui/dialogs/vinson.xml | 319 ++++++++++++++++++ 3 files changed, 621 insertions(+), 19 deletions(-) create mode 100644 gui/dialogs/vinson.xml diff --git a/Models/Geometry/Nimitz/vinson-parks-and-objects.xml b/Models/Geometry/Nimitz/vinson-parks-and-objects.xml index f1edfddb8..839e1293f 100644 --- a/Models/Geometry/Nimitz/vinson-parks-and-objects.xml +++ b/Models/Geometry/Nimitz/vinson-parks-and-objects.xml @@ -24,7 +24,7 @@ select Deck-Park - sim/current-view/deck-park + /controls/vinson/deck-park diff --git a/Models/Geometry/Nimitz/vinson.xml b/Models/Geometry/Nimitz/vinson.xml index a80d620db..b268e3700 100644 --- a/Models/Geometry/Nimitz/vinson.xml +++ b/Models/Geometry/Nimitz/vinson.xml @@ -15,11 +15,56 @@ apart from most of the very excellent textures, remain. --> var fg_root = getprop("/sim/fg-root"); var self = cmdarg(); + var pathc = self.getPath(); var control_node = self.getNode("controls/turn-to-base-course", 1); var pos_node = self.getNode("sim/antenna-pos-norm", 1); pos_node.setDoubleValue(0); var turn_old = 1; + # timescales + + var elevator_transit_time = 30.0; + var jbd_transit_time = 5.0; + + # register the dialog + + setprop(self.getPath()~"/dlg-name", "Vinson"); + + # init animation and detail properties + + setprop("/controls/vinson/deck-park",0); + setprop("/controls/vinson/crew",0); + setprop("/controls/vinson/lights", 0); + + ################ + # elevators + + setprop("/controls/vinson/elevator[0]/state",1); + setprop("/controls/vinson/elevator[1]/state",0); + + var elevator1 = aircraft.door.new(pathc~"/surface-positions/elevator[0]", elevator_transit_time, 1); + var elevator2 = aircraft.door.new(pathc~"/surface-positions/elevator[1]", elevator_transit_time, 0); + + + var elevator_array = [elevator1, elevator2]; + + + ################ + # jet blast deflectors + + setprop("/controls/vinson/jbd[0]/state", 0); + setprop("/controls/vinson/jbd[1]/state", 0); + setprop("/controls/vinson/jbd[2]/state", 0); + setprop("/controls/vinson/jbd[3]/state", 0); + + var jbd1 = aircraft.door.new(pathc~"/surface-positions/jbd[0]", jbd_transit_time, 0); + var jbd2 = aircraft.door.new(pathc~"/surface-positions/jbd[1]", jbd_transit_time, 0); + var jbd3 = aircraft.door.new(pathc~"/surface-positions/jbd[2]", jbd_transit_time, 0); + var jbd4 = aircraft.door.new(pathc~"/surface-positions/jbd[3]", jbd_transit_time, 0); + + var jbd_array = [jbd1, jbd2, jbd3, jbd4]; + + ######## # properties used to handle rendering, lighting and to control the Pack-Park # Due to a change in MPcarrier system ? @@ -66,6 +111,63 @@ apart from most of the very excellent textures, remain. --> var rpm1_Node = self.getNode("engines/engine[1]/rpm", 1); rpm1_Node.setDoubleValue(0.17); + # elevator control + + var elevator_operate = func (i){ + + var tgt = getprop("/controls/vinson/elevator["~i~"]/state"); + if (tgt == 1) + { + print ("Elevator ", i+1, " up."); + elevator_array[i].open(); + + } + else + { + print ("Elevator ", i+1, " down."); + elevator_array[i].close(); + } + } + + # JBD control + + var jbd_operate = func (i) { + + var tgt = getprop("/controls/vinson/jbd["~i~"]/state"); + if (tgt == 1) + { + print ("JBD ", i+1, " up."); + jbd_array[i].open(); + } + else + { + print ("JBD ", i+1, " down."); + jbd_array[i].close(); + } + + + } + + # lighting control + + var toggle_lights = func { + + var state = getprop(pathc~"/controls/lighting/deck-lights"); + + if (state == 0) + { + setprop(pathc~"/controls/lighting/deck-lights", 1); + setprop(pathc~"/controls/lighting/flood-lights-red-norm", 0.7); + } + else + { + setprop(pathc~"/controls/lighting/deck-lights", 0); + setprop(pathc~"/controls/lighting/flood-lights-red-norm", 0.0); + } + + } + + ######## # the main loop var vinson_update_timer = maketimer(0.027, @@ -134,6 +236,22 @@ apart from most of the very excellent textures, remain. --> an_spn_46_timer.restart(anspn.GetUpdateRate()); }); an_spn_46_timer.restart(6); + + + # listeners + + var l_elev1 = setlistener("/controls/vinson/elevator/state", func {elevator_operate(0);},0,0); + var l_elev2 = setlistener("/controls/vinson/elevator[1]/state", func {elevator_operate(1);},0,0); + + var l_jbd1 = setlistener("/controls/vinson/jbd[0]/state", func {jbd_operate(0);},0,0); + var l_jbd2 = setlistener("/controls/vinson/jbd[1]/state", func {jbd_operate(1);},0,0); + var l_jbd3 = setlistener("/controls/vinson/jbd[2]/state", func {jbd_operate(2);},0,0); + var l_jbd4 = setlistener("/controls/vinson/jbd[3]/state", func {jbd_operate(3);},0,0); + + var l_lights = setlistener("/controls/vinson/lights", func {toggle_lights();},0,0); + + + ]]> @@ -141,12 +259,28 @@ apart from most of the very excellent textures, remain. --> - @@ -483,7 +617,7 @@ apart from most of the very excellent textures, remain. --> translate Elevator-2 - surface-positions/elevators-pos-norm + surface-positions/elevator[0]/position-norm 10.62 1 @@ -493,7 +627,7 @@ apart from most of the very excellent textures, remain. --> Elevator-1 tractor-15 - surface-positions/elevators-pos-norm + surface-positions/elevator[1]/position-norm 10.62 1 @@ -526,7 +660,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-1 - surface-positions/jbd-pos-norm + surface-positions/jbd[0]/position-norm 0.00000 0.0833-12.2 @@ -555,7 +689,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-1-strut-a JBD-1-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[0]/position-norm 0.00000 0.08335 @@ -583,7 +717,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-1-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[0]/position-norm 0.00000 0.0833-23.4 @@ -612,7 +746,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-2 - surface-positions/jbd-pos-norm + surface-positions/jbd[1]/position-norm 0.00000 0.0833-12.2 @@ -641,7 +775,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-2-strut-a JBD-2-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[1]/position-norm 0.00000 0.08335 @@ -669,7 +803,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-2-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[1]/position-norm 0.00000 0.0833-23.4 @@ -695,12 +829,12 @@ apart from most of the very excellent textures, remain. --> - rotate JBD-3 - surface-positions/jbd-pos-norm + surface-positions/jbd[2]/position-norm 0.00000 0.0833-12.2 @@ -725,7 +859,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-3-strut-a JBD-3-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[2]/position-norm 0.00000 0.08335 @@ -749,7 +883,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-3-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[2]/position-norm 0.00000 0.0833-23.4 @@ -769,13 +903,13 @@ apart from most of the very excellent textures, remain. --> 108.9795-25.960319.8103 108.9795-14.936619.8103 - --> + rotate JBD-4 - surface-positions/jbd-pos-norm + surface-positions/jbd[3]/position-norm 0.00000 0.0833-12.2 @@ -804,7 +938,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-4-strut-a JBD-4-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[3]/position-norm 0.00000 0.08335 @@ -832,7 +966,7 @@ apart from most of the very excellent textures, remain. --> rotate JBD-4-strut-b - surface-positions/jbd-pos-norm + surface-positions/jbd[3]/position-norm 0.00000 0.0833-23.4 @@ -2508,4 +2642,153 @@ apart from most of the very excellent textures, remain. --> carrier-wire + + + + pick + Elevator-2 + + + false + + property-toggle + /controls/vinson/elevator/state + + + + + set-tooltip + elev1 + + + + + + + pick + Elevator-1 + + + false + + property-toggle + /controls/vinson/elevator[1]/state + + + + + set-tooltip + elev2 + + + + + + + + + pick + JBD-1 + + + + false + + property-toggle + /controls/vinson/jbd[0]/state + + + + + set-tooltip + jbd1 + + + + + + + pick + JBD-2 + + + + false + + property-toggle + /controls/vinson/jbd[1]/state + + + + + set-tooltip + jbd2 + + + + + + + pick + JBD-3 + + + + false + + property-toggle + /controls/vinson/jbd[2]/state + + + + + set-tooltip + jbd3 + + + + + + + pick + JBD-4 + + + + false + + property-toggle + /controls/vinson/jbd[3]/state + + + + + set-tooltip + jbd4 + + + + + + + pick + Flightdeck + + + false + + property-toggle + /controls/vinson/lights + + + + + set-tooltip + lights + + + + + + diff --git a/gui/dialogs/vinson.xml b/gui/dialogs/vinson.xml new file mode 100644 index 000000000..ab3b398bd --- /dev/null +++ b/gui/dialogs/vinson.xml @@ -0,0 +1,319 @@ + + + + Vinson + false + vbox + + + + + + hbox + + + 1 + + + + + + + + 1 + + + + + + + + + table + + + + 0 + 0 + + + + 1 + 0 + left + + /ai/models/carrier/controls/turn-to-launch-hdg + true + + dialog-apply + + + nasal + + + + + + 2 + 0 + left + + /ai/models/carrier/controls/turn-to-recovery-hdg + true + + dialog-apply + + + nasal + + + + + + 3 + 0 + left + + /ai/models/carrier/controls/turn-to-base-course + true + + dialog-apply + + + nasal + + + + + + + + + table + + + + 0 + 0 + + + + left + 1 + 0 + + /controls/vinson/elevator[0]/state + + dialog-apply + + + + + left + 1 + 1 + + /controls/vinson/elevator[1]/state + + dialog-apply + + + + + left + 3 + 0 + + /controls/vinson/jbd[0]/state + + dialog-apply + + + + + left + 3 + 1 + + /controls/vinson/jbd[1]/state + + dialog-apply + + + + + left + 3 + 2 + + /controls/vinson/jbd[2]/state + + dialog-apply + + + + + left + 3 + 3 + + /controls/vinson/jbd[3]/state + + dialog-apply + + + + + + + + + + + table + + + + 0 + 0 + + + + left + 1 + 0 + + /controls/vinson/deck-park + + dialog-apply + + + + + + + left + 1 + 1 + + /controls/vinson/lights + + dialog-apply + + + + + + + + + 1 + + + + + + + + + + + + + + hbox + 6 + + true + + + + + + + + + + + + true + + +