From ec418dbef2defe32847180535e14aa3527bea52a Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Wed, 12 Jul 2017 20:21:17 -0400 Subject: [PATCH] A3XX: Fix engine autostart --- Nasal/engines.nas | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Nasal/engines.nas b/Nasal/engines.nas index ab76aa97..e08e226c 100644 --- a/Nasal/engines.nas +++ b/Nasal/engines.nas @@ -51,7 +51,6 @@ var eng_init = func { setlistener("/controls/engines/engine[0]/cutoff-switch", func { if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) { if (getprop("/controls/engines/engine[0]/man-start") == 0) { - setprop("/systems/pneumatic/eng1-starter", 1); start_one_check(); } else if (getprop("/controls/engines/engine[0]/man-start") == 1) { eng_one_man_startt.start(); @@ -95,7 +94,10 @@ var start_one_mancheck = func { } var start_one_check = func { - settimer(start_one_check_b, 0.5); + if (getprop("/controls/engines/engine-start-switch") == 2 and getprop("/controls/engines/engine[0]/cutoff-switch") == 0) { + setprop("/systems/pneumatic/eng1-starter", 1); + settimer(start_one_check_b, 0.5); + } } var start_one_check_b = func { @@ -107,7 +109,6 @@ var start_one_check_b = func { setlistener("/controls/engines/engine[1]/cutoff-switch", func { if (getprop("/controls/engines/engine[1]/cutoff-switch") == 0) { if (getprop("/controls/engines/engine[1]/man-start") == 0) { - setprop("/systems/pneumatic/eng2-starter", 1); start_two_check(); } else if (getprop("/controls/engines/engine[1]/man-start") == 1) { eng_two_man_startt.start(); @@ -150,7 +151,10 @@ var start_two_mancheck = func { } var start_two_check = func { - settimer(start_two_check_b, 0.5); + if (getprop("/controls/engines/engine-start-switch") == 2 and getprop("/controls/engines/engine[1]/cutoff-switch") == 0) { + setprop("/systems/pneumatic/eng2-starter", 1); + settimer(start_two_check_b, 0.5); + } } var start_two_check_b = func { @@ -336,12 +340,14 @@ setlistener("/controls/engines/engine-start-switch", func { if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) { setprop("/controls/engines/engine[0]/starter", 0); setprop("/controls/engines/engine[0]/cutoff", 1); + setprop("/systems/pneumatic/eng1-starter", 0); setprop("/engines/engine[0]/state", 0); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); } if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) { setprop("/controls/engines/engine[1]/starter", 0); setprop("/controls/engines/engine[1]/cutoff", 1); + setprop("/systems/pneumatic/eng2-starter", 0); setprop("/engines/engine[1]/state", 0); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); } @@ -353,12 +359,14 @@ setlistener("/systems/pneumatic/start-psi", func { if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) { setprop("/controls/engines/engine[0]/starter", 0); setprop("/controls/engines/engine[0]/cutoff", 1); + setprop("/systems/pneumatic/eng1-starter", 0); setprop("/engines/engine[0]/state", 0); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); } if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) { setprop("/controls/engines/engine[1]/starter", 0); setprop("/controls/engines/engine[1]/cutoff", 1); + setprop("/systems/pneumatic/eng2-starter", 0); setprop("/engines/engine[1]/state", 0); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); }