diff --git a/A320-main.xml b/A320-main.xml index 67c4edd6..be929f7a 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1183,6 +1183,7 @@ Aircraft/IDG-A32X/Nasal/engines.nas Aircraft/IDG-A32X/Nasal/ADIRS.nas Aircraft/IDG-A32X/Nasal/fire.nas + Aircraft/IDG-A32X/Nasal/trays.nas Aircraft/IDG-A32X/Nasal/fadec-common.nas diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index cd908cac..76d30b08 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -5395,6 +5395,214 @@ + + translate + tray + cylinder01 + /controls/tray/lefttrayext + + 0 0 + 0.50.160 + 10.160 + + + 1 + 0 + 0 + + + + + translate + tray.001 + cylinder01.001 + /controls/tray/righttrayext + + 0 0 + 0.50.160 + 10.160 + + + 1 + 0 + 0 + + + + + translate + tray + cylinder01 + /controls/tray/lefttrayext + + 0 0 + 0.50.045 + 10.045 + + + 0 + 0 + 1 + + + + + translate + tray.001 + cylinder01.001 + /controls/tray/righttrayext + + 0 0 + 0.50.045 + 10.045 + + + 0 + 0 + 1 + + + + + rotate + tray + /controls/tray/lefttrayext + + 0 0 + 0.450 + 0.55 + 15 + +
+ -0.52671 + 0 + -0.1702 +
+ + 0 + 1 + 0 + +
+ + + rotate + cylinder01.002 + /controls/tray/lefttrayext + + 0 0 + 0.450 + 0.55 + 1185 + +
+ -0.52671 + 0 + -0.1702 +
+ + 0 + 1 + 0 + +
+ + + rotate + tray.001 + /controls/tray/righttrayext + + 0 0 + 0.450 + 0.55 + 15 + +
+ -0.52671 + 0 + -0.1702 +
+ + 0 + 1 + 0 + +
+ + + rotate + cylinder01.001 + /controls/tray/righttrayext + + 0 0 + 0.450 + 0.55 + 1185 + +
+ -0.52671 + 0 + -0.1702 +
+ + 0 + 1 + 0 + +
+ + + pick + tray + cylinder01.002 + + + + property-cycle + /controls/tray/cmdL + 0 + 0.5 + 1 + + + + + + property-cycle + /controls/tray/cmdL + 1 + 0.5 + 0 + + + + + + pick + tray.001 + cylinder01.001 + + + + property-cycle + /controls/tray/cmdR + 0 + 0.5 + 1 + + + + + + property-cycle + /controls/tray/cmdR + 1 + 0.5 + 0 + + + + Aircraft/IDG-A32X/Models/Effects/floorlightmap object0000 diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index 81ce1690..9fd8cdac 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -203,6 +203,7 @@ setlistener("/sim/signals/fdm-initialized", func { systems.fuel_init(); systems.fire_init(); systems.eng_init(); + systems.tray_init(); fmgc.APinit(); librariesLoop.start(); fmgc.FMGCinit(); diff --git a/Nasal/trays.nas b/Nasal/trays.nas new file mode 100644 index 00000000..e3d8f3b4 --- /dev/null +++ b/Nasal/trays.nas @@ -0,0 +1,71 @@ +# A3XX Tray Tables +# Jonathan Redpath (legoboyvdlp) + +######################################### +# Copyright (c) it0uchpods Design Group # +######################################### + +############# +# Init Vars # +############# +setlistener("/sim/signals/fdm-initialized", func { + var cmdL = getprop("/controls/tray/cmdL"); + var cmdR = getprop("/controls/tray/cmdR"); + var trayLext = getprop("/controls/tray/lefttrayext"); + var trayRext = getprop("/controls/tray/righttrayext"); +}); + +var tray_init = func { + setprop("/controls/tray/cmdL", 0); # 0 = in 0.5 = half 1 = full + setprop("/controls/tray/cmdR", 0); # 0 = in 0.5 = half 1 = full + setprop("/controls/tray/lefttrayext", 0); # controls the lateral extension + setprop("/controls/tray/righttrayext", 0); + tray_timer.start(); +} + +############## +# Main Loops # +############## +var master_tray = func { + cmdL = getprop("/controls/tray/cmdL"); + cmdR = getprop("/controls/tray/cmdR"); + trayLext = getprop("/controls/tray/lefttrayext"); + trayRext = getprop("/controls/tray/righttrayext"); + + if (cmdL == 0 and trayLext == 1) { + interpolate("/controls/tray/lefttrayext", 0, 2); + } elsif (cmdL == 0 and trayLext == 0.5) { + interpolate("/controls/tray/lefttrayext", 0, 1); + } elsif (cmdL == 0.5 and trayLext == 1) { + interpolate("/controls/tray/lefttrayext", 0.5, 1); + } elsif (cmdL == 0.5 and trayLext == 0) { + interpolate("/controls/tray/lefttrayext", 0.5, 1); + } elsif (cmdL == 1 and trayLext == 0) { + interpolate("/controls/tray/lefttrayext", 1, 2); + } elsif (cmdL == 1 and trayLext == 0.5) { + interpolate("/controls/tray/lefttrayext", 1, 1); + } + + if (cmdR == 0 and trayRext == 1) { + interpolate("/controls/tray/righttrayext", 0, 2); + } elsif (cmdR == 0 and trayRext == 0.5) { + interpolate("/controls/tray/righttrayext", 0, 1); + } elsif (cmdR == 0.5 and trayRext == 1) { + interpolate("/controls/tray/righttrayext", 0.5, 1); + } elsif (cmdR == 0.5 and trayRext == 0) { + interpolate("/controls/tray/righttrayext", 0.5, 1); + } elsif (cmdR == 1 and trayRext == 0) { + interpolate("/controls/tray/righttrayext", 1, 2); + } elsif (cmdR == 1 and trayRext == 0.5) { + interpolate("/controls/tray/righttrayext", 1, 1); + } +} + +################### +# Update Function # +################### +var update_tray = func { + master_tray(); +} + +var tray_timer = maketimer(0.1, update_tray); \ No newline at end of file