From ac7b9643fa70e90355d9e362fc393e66845c5b1a Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 26 Jul 2020 13:43:14 +0100 Subject: [PATCH] Refactor more legacy --- Nasal/Libraries/property-tree-setup.nas | 5 +++++ Nasal/Systems/FADEC/engines-common.nas | 30 ++++++++++++------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index b451be5d..4f6b2a8a 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -149,6 +149,11 @@ var Position = { var Sim = { aero: props.globals.getNode("/sim/aero"), + Input: { + Selected: { + engine: [props.globals.getNode("/sim/input/selected/engine[0]", 1),props.globals.getNode("/sim/input/selected/engine[1]", 1)], + } + }, Multiplay: { online: props.globals.getNode("/sim/multiplay/online"), }, diff --git a/Nasal/Systems/FADEC/engines-common.nas b/Nasal/Systems/FADEC/engines-common.nas index 48d00a47..b3234b00 100644 --- a/Nasal/Systems/FADEC/engines-common.nas +++ b/Nasal/Systems/FADEC/engines-common.nas @@ -13,38 +13,38 @@ var eng_common_init = func { # nada } -# Various Other Stuff +# Engine thrust commands var doIdleThrust = func { # Idle does not respect selected engines, because it is used to respond # to "Retard" and both engines must be idle for spoilers to deploy - setprop("/controls/engines/engine[0]/throttle", 0.0); - setprop("/controls/engines/engine[1]/throttle", 0.0); + pts.Controls.Engines.Engine.throttle[0].setValue(0.0); + pts.Controls.Engines.Engine.throttle[1].setValue(0.0); } var doCLThrust = func { - if (getprop("/sim/input/selected/engine[0]") == 1) { - setprop("/controls/engines/engine[0]/throttle", 0.63); + if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { + pts.Controls.Engines.Engine.throttle[0].setValue(0.63); } - if (getprop("/sim/input/selected/engine[1]") == 1) { - setprop("/controls/engines/engine[1]/throttle", 0.63); + if (pts.Sim.Input.Selected.engine[1].getBoolValue()) { + pts.Controls.Engines.Engine.throttle[1].setValue(0.63); } } var doMCTThrust = func { - if (getprop("/sim/input/selected/engine[0]") == 1) { - setprop("/controls/engines/engine[0]/throttle", 0.8); + if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { + pts.Controls.Engines.Engine.throttle[0].setValue(0.80); } - if (getprop("/sim/input/selected/engine[1]") == 1) { - setprop("/controls/engines/engine[1]/throttle", 0.8); + if (pts.Sim.Input.Selected.engine[1].getBoolValue()) { + pts.Controls.Engines.Engine.throttle[1].setValue(0.80); } } var doTOGAThrust = func { - if (getprop("/sim/input/selected/engine[0]") == 1) { - setprop("/controls/engines/engine[0]/throttle", 1.0); + if (pts.Sim.Input.Selected.engine[0].getBoolValue()) { + pts.Controls.Engines.Engine.throttle[0].setValue(1.00); } - if (getprop("/sim/input/selected/engine[1]") == 1) { - setprop("/controls/engines/engine[1]/throttle", 1.0); + if (pts.Sim.Input.Selected.engine[1].getBoolValue()) { + pts.Controls.Engines.Engine.throttle[1].setValue(1.00); } }