A32X: tray tables

This commit is contained in:
Jonathan Redpath 2017-10-03 10:25:38 +01:00
parent 12de1c2ed5
commit eefca424e1
4 changed files with 281 additions and 0 deletions

View file

@ -1183,6 +1183,7 @@
<file>Aircraft/IDG-A32X/Nasal/engines.nas</file> <file>Aircraft/IDG-A32X/Nasal/engines.nas</file>
<file>Aircraft/IDG-A32X/Nasal/ADIRS.nas</file> <file>Aircraft/IDG-A32X/Nasal/ADIRS.nas</file>
<file>Aircraft/IDG-A32X/Nasal/fire.nas</file> <file>Aircraft/IDG-A32X/Nasal/fire.nas</file>
<file>Aircraft/IDG-A32X/Nasal/trays.nas</file>
</systems> </systems>
<thrust> <thrust>
<file>Aircraft/IDG-A32X/Nasal/fadec-common.nas</file> <file>Aircraft/IDG-A32X/Nasal/fadec-common.nas</file>

View file

@ -5395,6 +5395,214 @@
</action> </action>
</animation> </animation>
<animation>
<type>translate</type>
<object-name>tray</object-name>
<object-name>cylinder01</object-name>
<property>/controls/tray/lefttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.5</ind><dep>0.160</dep></entry>
<entry><ind>1</ind><dep>0.160</dep></entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>tray.001</object-name>
<object-name>cylinder01.001</object-name>
<property>/controls/tray/righttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.5</ind><dep>0.160</dep></entry>
<entry><ind>1</ind><dep>0.160</dep></entry>
</interpolation>
<axis>
<x>1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>tray</object-name>
<object-name>cylinder01</object-name>
<property>/controls/tray/lefttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.5</ind><dep>0.045</dep></entry>
<entry><ind>1</ind><dep>0.045</dep></entry>
</interpolation>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>translate</type>
<object-name>tray.001</object-name>
<object-name>cylinder01.001</object-name>
<property>/controls/tray/righttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.5</ind><dep>0.045</dep></entry>
<entry><ind>1</ind><dep>0.045</dep></entry>
</interpolation>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>tray</object-name>
<property>/controls/tray/lefttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.45</ind><dep>0</dep></entry>
<entry><ind>0.5</ind><dep>5</dep></entry>
<entry><ind>1</ind><dep>5</dep></entry>
</interpolation>
<center>
<x-m>-0.52671</x-m>
<y-m>0</y-m>
<z-m>-0.1702</z-m>
</center>
<axis>
<x>0</x>
<y>1</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>cylinder01.002</object-name>
<property>/controls/tray/lefttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.45</ind><dep>0</dep></entry>
<entry><ind>0.5</ind><dep>5</dep></entry>
<entry><ind>1</ind><dep>185</dep></entry>
</interpolation>
<center>
<x-m>-0.52671</x-m>
<y-m>0</y-m>
<z-m>-0.1702</z-m>
</center>
<axis>
<x>0</x>
<y>1</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>tray.001</object-name>
<property>/controls/tray/righttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.45</ind><dep>0</dep></entry>
<entry><ind>0.5</ind><dep>5</dep></entry>
<entry><ind>1</ind><dep>5</dep></entry>
</interpolation>
<center>
<x-m>-0.52671</x-m>
<y-m>0</y-m>
<z-m>-0.1702</z-m>
</center>
<axis>
<x>0</x>
<y>1</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>rotate</type>
<object-name>cylinder01.001</object-name>
<property>/controls/tray/righttrayext</property>
<interpolation>
<entry><ind>0</ind><dep> 0</dep></entry>
<entry><ind>0.45</ind><dep>0</dep></entry>
<entry><ind>0.5</ind><dep>5</dep></entry>
<entry><ind>1</ind><dep>185</dep></entry>
</interpolation>
<center>
<x-m>-0.52671</x-m>
<y-m>0</y-m>
<z-m>-0.1702</z-m>
</center>
<axis>
<x>0</x>
<y>1</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>pick</type>
<object-name>tray</object-name>
<object-name>cylinder01.002</object-name>
<action>
<button>0</button>
<binding>
<command>property-cycle</command>
<property>/controls/tray/cmdL</property>
<value>0</value>
<value>0.5</value>
<value>1</value>
</binding>
</action>
<action>
<button>1</button>
<binding>
<command>property-cycle</command>
<property>/controls/tray/cmdL</property>
<value>1</value>
<value>0.5</value>
<value>0</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>tray.001</object-name>
<object-name>cylinder01.001</object-name>
<action>
<button>0</button>
<binding>
<command>property-cycle</command>
<property>/controls/tray/cmdR</property>
<value>0</value>
<value>0.5</value>
<value>1</value>
</binding>
</action>
<action>
<button>1</button>
<binding>
<command>property-cycle</command>
<property>/controls/tray/cmdR</property>
<value>1</value>
<value>0.5</value>
<value>0</value>
</binding>
</action>
</animation>
<effect> <effect>
<inherits-from>Aircraft/IDG-A32X/Models/Effects/floorlightmap</inherits-from> <inherits-from>Aircraft/IDG-A32X/Models/Effects/floorlightmap</inherits-from>
<object-name>object0000</object-name> <object-name>object0000</object-name>

View file

@ -203,6 +203,7 @@ setlistener("/sim/signals/fdm-initialized", func {
systems.fuel_init(); systems.fuel_init();
systems.fire_init(); systems.fire_init();
systems.eng_init(); systems.eng_init();
systems.tray_init();
fmgc.APinit(); fmgc.APinit();
librariesLoop.start(); librariesLoop.start();
fmgc.FMGCinit(); fmgc.FMGCinit();

71
Nasal/trays.nas Normal file
View file

@ -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);