diff --git a/A320-main.xml b/A320-main.xml index 3494da34..1507aa11 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -722,6 +722,7 @@ <file>Aircraft/A320Family/Nasal/gpws.nas</file> <file>Aircraft/A320Family/Nasal/efis.nas</file> <file>Aircraft/A320Family/Nasal/ECAM.nas</file> + <file>Aircraft/A320Family/Nasal/shake.nas</file> </libraries> <acconfig> <file>Aircraft/A320Family/AircraftConfig/acconfig.nas</file> diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index bbde178d..ba315382 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -4,6 +4,32 @@ <path>res/fd_complete.ac</path> + <animation> + <type>translate</type> + <property>/systems/shake/shaking</property> + <axis> + <x1-m> 0</x1-m> + <y1-m> 0</y1-m> + <z1-m> 0</z1-m> + <x2-m> 0.5</x2-m> + <y2-m>-0.5</y2-m> + <z2-m> 0.8</z2-m> + </axis> + </animation> + + <animation> + <type>translate</type> + <property>/systems/shake/shaking</property> + <axis> + <x1-m> 0</x1-m> + <y1-m> 0</y1-m> + <z1-m> 0</z1-m> + <x2-m> 0.5</x2-m> + <y2-m>-0.5</y2-m> + <z2-m> 0.8</z2-m> + </axis> + </animation> + <!-- Overhead Panel --> <model> diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index e0083742..8b336d81 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -2233,7 +2233,10 @@ <command>property-toggle</command> <property>controls/lighting/strobe</property> </binding> - + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2268,7 +2271,10 @@ <command>property-toggle</command> <property>controls/lighting/beacon</property> </binding> - + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2303,7 +2309,10 @@ <command>property-toggle</command> <property>controls/lighting/wing-lights</property> </binding> - + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2341,7 +2350,10 @@ <value>1</value> <value>2</value> </binding> - + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2378,6 +2390,10 @@ <command>property-toggle</command> <property>controls/lighting/landing-lights[2]</property> </binding> + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2413,7 +2429,10 @@ <command>property-toggle</command> <property>controls/lighting/landing-lights[1]</property> </binding> - + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2615,6 +2634,10 @@ <value>0.5</value> <value>1</value> </binding> + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/knb1", 1);</script> + </binding> </action> </animation> <animation> @@ -2653,6 +2676,10 @@ <value>0</value> <value>1</value> </binding> + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2689,6 +2716,10 @@ <command>property-toggle</command> <property>controls/switches/seatbelt-sign</property> </binding> + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> @@ -2723,6 +2754,10 @@ <command>property-toggle</command> <property>controls/switches/no-smoking-sign</property> </binding> + <binding> + <command>nasal</command> + <script>setprop("/sim/sounde/switch1", 1);</script> + </binding> </action> </animation> <animation> diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index 9a0b34e2..853ee14f 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -88,6 +88,15 @@ setlistener("/sim/sounde/knb1", func { }, 0.05); }); +setlistener("/sim/sounde/switch1", func { + if (!getprop("/sim/sounde/switch1")) { + return; + } + settimer(func { + props.globals.getNode("/sim/sounde/switch1").setBoolValue(0); + }, 0.05); +}); + setlistener("/controls/switches/seatbelt-sign", func { props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(1); settimer(func { @@ -154,7 +163,7 @@ setlistener("/sim/signals/fdm-initialized", func { systems.hyd_init(); systems.press_init(); fmgc.APinit(); - externalconnections.start(); + librariesLoop.start(); fmgc.FMGCinit(); mcdu1.MCDU_init(); mcdu2.MCDU_init(); @@ -165,6 +174,26 @@ setlistener("/sim/signals/fdm-initialized", func { libraries.variousReset(); }); +var librariesLoop = maketimer(0.1, func { + var groundpwr = getprop("/controls/switches/cart"); + var groundair = getprop("/controls/pneumatic/switches/groundair"); + var gs = getprop("/velocities/groundspeed-kt"); + var parkbrake = getprop("controls/gear/brake-parking"); + + if ((groundair or groundpwr) and ((gs > 2) or !parkbrake)) { + setprop("/controls/switches/cart", 0); + setprop("/controls/pneumatic/switches/groundair", 0); + } + + var V = getprop("/velocities/groundspeed-kt"); + + if (V > 15) { + setprop("/systems/shake/effect", 1); + } else { + setprop("/systems/shake/effect", 0); + } +}); + var variousReset = func { setprop("/modes/cpt-du-xfr", 0); setprop("/modes/fo-du-xfr", 0); @@ -182,17 +211,6 @@ var aglgears = func { aglgears(); -var externalconnections = maketimer(0.1, func { - var groundpwr = getprop("/controls/switches/cart"); - var groundair = getprop("/controls/pneumatic/switches/groundair"); - var gs = getprop("/velocities/groundspeed-kt"); - var parkbrake = getprop("controls/gear/brake-parking"); - if ((groundair or groundpwr) and ((gs > 2) or !parkbrake)) { - setprop("/controls/switches/cart", 0); - setprop("/controls/pneumatic/switches/groundair", 0); - } -}); - var mcpSPDKnbPull = func { setprop("/it-autoflight/input/spd-managed", 0); fmgc.ManagedSPD.stop(); diff --git a/Nasal/shake.nas b/Nasal/shake.nas new file mode 100644 index 00000000..1e008513 --- /dev/null +++ b/Nasal/shake.nas @@ -0,0 +1,37 @@ +# A3XX Shaking + +var shakeEffectA3XX = props.globals.initNode("/systems/shake/effect",0,"BOOL"); +var shakeA3XX = props.globals.initNode("/systems/shake/shaking",0,"DOUBLE"); +var rSpeed = 0; +var sf = 0; +var n_g_c = 0; +var n_g_l = 0; +var n_g_r = 0; + +var theShakeEffect = func{ + n_g_c = getprop("/gear/gear[0]/compression-norm") or 0; + n_g_l = getprop("/gear/gear[1]/compression-norm") or 0; + n_g_r = getprop("/gear/gear[2]/compression-norm") or 0; + rSpeed = getprop("/gear/gear[0]/rollspeed-ms") or 0; + sf = rSpeed / 94000; + + if (shakeEffectA3XX.getBoolValue() and (n_g_c > 0 or n_g_l > 0 or n_g_r > 0)) { + interpolate("/systems/shake/shaking", sf, 0.03); + settimer(func { + interpolate("/systems/shake/shaking", -sf * 2, 0.03); + }, 0.06); + settimer(func { + interpolate("/systems/shake/shaking", sf, 0.03); + }, 0.12); + settimer(theShakeEffect, 0.09); + } else { + setprop("/systems/shake/shaking", 0); + setprop("/systems/shake/effect",0); + } +} + +setlistener("/systems/shake/effect", func(state){ + if(state.getBoolValue()){ + theShakeEffect(); + } +}, 1, 0); diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index fd132c28..27de7ed1 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -394,7 +394,7 @@ <detenta> <mode>once</mode> <name>detendaa</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/systems/thrust/state1</property> @@ -409,7 +409,7 @@ <detentb> <mode>once</mode> <name>detendba</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/systems/thrust/state2</property> @@ -424,7 +424,7 @@ <detenta> <mode>once</mode> <name>detendab</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/systems/thrust/state1</property> @@ -439,7 +439,7 @@ <detentb> <mode>once</mode> <name>detendbb</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/systems/thrust/state2</property> @@ -454,7 +454,7 @@ <detenta> <mode>once</mode> <name>detendac</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/systems/thrust/state1</property> @@ -469,7 +469,7 @@ <detentb> <mode>once</mode> <name>detendbc</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/systems/thrust/state2</property> @@ -484,7 +484,7 @@ <detenta> <mode>once</mode> <name>detendad</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/systems/thrust/state1</property> @@ -499,7 +499,7 @@ <detentb> <mode>once</mode> <name>detendbd</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/systems/thrust/state2</property> @@ -514,7 +514,7 @@ <detenta> <mode>once</mode> <name>detendae</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/systems/thrust/state1</property> @@ -529,7 +529,7 @@ <detentb> <mode>once</mode> <name>detendbe</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/systems/thrust/state2</property> @@ -544,7 +544,7 @@ <detenta> <mode>once</mode> <name>detendaf</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/systems/thrust/state1</property> @@ -559,7 +559,7 @@ <detentb> <mode>once</mode> <name>detendbf</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/systems/thrust/state2</property> @@ -574,7 +574,7 @@ <detenta> <mode>once</mode> <name>detendag</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/controls/engines/engine[0]/reverser</property> @@ -589,7 +589,7 @@ <detentb> <mode>once</mode> <name>detendbg</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/controls/engines/engine[1]/reverser</property> @@ -604,7 +604,7 @@ <detenta> <mode>once</mode> <name>detendah</name> - <path>detenta.wav</path> + <path>Cockpit/detenta.wav</path> <condition> <equals> <property>/controls/engines/engine[0]/reverser</property> @@ -619,7 +619,7 @@ <detentb> <mode>once</mode> <name>detendbh</name> - <path>detentb.wav</path> + <path>Cockpit/detentb.wav</path> <condition> <equals> <property>/controls/engines/engine[1]/reverser</property> @@ -667,9 +667,9 @@ </ns> <switch> - <name>Overhead Button</name> + <name>Button</name> <mode>once</mode> - <path>Aircraft/A320Family/Sounds/oh-button.wav</path> + <path>Aircraft/A320Family/Sounds/Cockpit/button.wav</path> <condition> <property>/sim/sounde/btn1</property> </condition> @@ -679,9 +679,9 @@ </switch> <switch> - <name>Overhead Knob</name> + <name>Knob</name> <mode>once</mode> - <path>Aircraft/A320Family/Sounds/oh-knob.wav</path> + <path>Aircraft/A320Family/Sounds/Cockpit/knob.wav</path> <condition> <property>/sim/sounde/knb1</property> </condition> @@ -690,5 +690,17 @@ </volume> </switch> + <switch> + <name>Switch</name> + <mode>once</mode> + <path>Aircraft/A320Family/Sounds/Cockpit/switch.wav</path> + <condition> + <property>/sim/sounde/switch1</property> + </condition> + <volume> + <factor>0.60</factor> + </volume> + </switch> + </fx> </PropertyList> \ No newline at end of file diff --git a/Sounds/oh-button.wav b/Sounds/Cockpit/button.wav similarity index 100% rename from Sounds/oh-button.wav rename to Sounds/Cockpit/button.wav diff --git a/Sounds/detenta.wav b/Sounds/Cockpit/detenta.wav similarity index 100% rename from Sounds/detenta.wav rename to Sounds/Cockpit/detenta.wav diff --git a/Sounds/detentb.wav b/Sounds/Cockpit/detentb.wav similarity index 100% rename from Sounds/detentb.wav rename to Sounds/Cockpit/detentb.wav diff --git a/Sounds/detentc.wav b/Sounds/Cockpit/detentc.wav similarity index 100% rename from Sounds/detentc.wav rename to Sounds/Cockpit/detentc.wav diff --git a/Sounds/detentd.wav b/Sounds/Cockpit/detentd.wav similarity index 100% rename from Sounds/detentd.wav rename to Sounds/Cockpit/detentd.wav diff --git a/Sounds/oh-knob.wav b/Sounds/Cockpit/knob.wav similarity index 100% rename from Sounds/oh-knob.wav rename to Sounds/Cockpit/knob.wav diff --git a/Sounds/Cockpit/switch.wav b/Sounds/Cockpit/switch.wav new file mode 100644 index 00000000..605e5006 Binary files /dev/null and b/Sounds/Cockpit/switch.wav differ