2019-10-14 16:48:35 +00:00
# A320 Main Libraries
# Joshua Davidson (Octal450)
2020-04-18 05:36:46 +00:00
# Copyright (c) 2020 Josh Davidson (Octal450)
2019-10-14 16:48:35 +00:00
2020-04-27 13:58:38 +00:00
print("------------------------------------------------");
print("Copyright (c) 2016-2020 Josh Davidson (Octal450)");
print("------------------------------------------------");
2019-10-14 16:48:35 +00:00
2020-05-12 02:40:59 +00:00
setprop("/sim/menubar/default/menu[0]/item[0]/enabled", 0);
setprop("/sim/menubar/default/menu[2]/item[0]/enabled", 0);
setprop("/sim/menubar/default/menu[2]/item[2]/enabled", 0);
setprop("/sim/menubar/default/menu[3]/enabled", 0);
setprop("/sim/menubar/default/menu[5]/item[9]/enabled", 0);
setprop("/sim/menubar/default/menu[5]/item[10]/enabled", 0);
setprop("/sim/menubar/default/menu[5]/item[11]/enabled", 0);
2019-10-14 16:48:35 +00:00
# Oil Qty
var qty1 = math.round((rand() * 5 ) + 20, 0.1);
var qty2 = math.round((rand() * 5 ) + 20, 0.1);
2020-05-12 02:40:59 +00:00
setprop("/engines/engine[0]/oil-qt-actual", qty1);
setprop("/engines/engine[1]/oil-qt-actual", qty2);
2019-10-14 16:48:35 +00:00
##########
# Lights #
##########
2020-07-11 23:35:03 +00:00
var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls/lighting/beacon");
var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1], "/controls/lighting/strobe");
var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.1, 1], "/controls/lighting/strobe");
2019-10-14 16:48:35 +00:00
2020-07-11 23:35:03 +00:00
var stateL = 0;
var stateR = 0;
2019-10-14 16:48:35 +00:00
2020-07-11 23:35:03 +00:00
###########
# Effects #
###########
2019-10-14 16:48:35 +00:00
var tiresmoke_system = aircraft.tyresmoke_system.new(0, 1, 2);
aircraft.rain.init();
2020-07-11 23:35:03 +00:00
aircraft.livery.init(getprop("/sim/model/livery-dir"));
2019-10-14 16:48:35 +00:00
##########
# Sounds #
##########
setlistener("/sim/sounde/btn1", func {
2020-05-12 02:40:59 +00:00
if (!getprop("/sim/sounde/btn1")) {
2019-10-14 16:48:35 +00:00
return;
}
settimer(func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/btn1").setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 0.05);
});
setlistener("/sim/sounde/oh-btn", func {
2020-05-12 02:40:59 +00:00
if (!getprop("/sim/sounde/oh-btn")) {
2019-10-14 16:48:35 +00:00
return;
}
settimer(func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/oh-btn").setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 0.05);
});
setlistener("/sim/sounde/btn3", func {
2020-05-12 02:40:59 +00:00
if (!getprop("/sim/sounde/btn3")) {
2019-10-14 16:48:35 +00:00
return;
}
settimer(func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/btn3").setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 0.05);
});
setlistener("/sim/sounde/knb1", func {
2020-05-12 02:40:59 +00:00
if (!getprop("/sim/sounde/knb1")) {
2019-10-14 16:48:35 +00:00
return;
}
settimer(func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/knb1").setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 0.05);
});
setlistener("/sim/sounde/switch1", func {
2020-05-12 02:40:59 +00:00
if (!getprop("/sim/sounde/switch1")) {
2019-10-14 16:48:35 +00:00
return;
}
settimer(func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/switch1").setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 0.05);
});
setlistener("/controls/lighting/seatbelt-sign", func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/seatbelt-sign").setBoolValue(1);
2019-10-14 16:48:35 +00:00
settimer(func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/seatbelt-sign").setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 2);
}, 0, 0);
setlistener("/controls/lighting/no-smoking-sign", func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/no-smoking-sign").setBoolValue(1);
2019-10-14 16:48:35 +00:00
settimer(func {
2020-02-07 16:10:54 +00:00
props.globals.getNode("sim/sounde/no-smoking-sign").setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 1);
}, 0, 0);
2020-05-11 17:01:44 +00:00
var flaps_click = props.globals.getNode("/sim/sounde/flaps-click");
2020-05-12 08:53:37 +00:00
2020-05-12 02:40:59 +00:00
setlistener("/controls/flight/flaps-input", func {
2020-05-11 17:01:44 +00:00
flaps_click.setBoolValue(1);
2019-10-14 16:48:35 +00:00
}, 0, 0);
setlistener("/sim/sounde/flaps-click", func {
2020-05-11 17:01:44 +00:00
if (!flaps_click.getValue()) {
return;
}
settimer(func {
flaps_click.setBoolValue(0);
}, 0.4);
});
var spdbrk_click = props.globals.getNode("/sim/sounde/spdbrk-click");
2020-05-12 08:53:37 +00:00
2020-05-11 17:01:44 +00:00
setlistener("/controls/flight/speedbrake", func {
spdbrk_click.setBoolValue(1);
}, 0, 0);
setlistener("/sim/sounde/spdbrk-click", func {
if (!spdbrk_click.getValue()) {
2019-10-14 16:48:35 +00:00
return;
}
settimer(func {
2020-05-11 17:01:44 +00:00
spdbrk_click.setBoolValue(0);
2019-10-14 16:48:35 +00:00
}, 0.4);
});
2020-05-11 17:01:44 +00:00
2020-08-13 09:58:13 +00:00
var relayBatt1 = func {
setprop("/sim/sounde/relay-batt-1",1);
settimer(func {setprop("/sim/sounde/relay-batt-1",0);},0.35);
}
var relayBatt2 = func {
setprop("/sim/sounde/relay-batt-2",1);
settimer(func {setprop("/sim/sounde/relay-batt-2",0);},0.35);
}
var relayApu = func {
setprop("/sim/sounde/relay-apu",1);
settimer(func {setprop("/sim/sounde/relay-apu",0);},0.35);
}
var relayExt = func {
setprop("/sim/sounde/relay-ext",1);
settimer(func {setprop("/sim/sounde/relay-ext",0);},0.35);
}
setlistener("/systems/electrical/sources/bat-1/contact", relayBatt1, nil, 0);
setlistener("/systems/electrical/sources/bat-2/contact", relayBatt2, nil, 0);
setlistener("/systems/electrical/relay/apu-glc/contact-pos", relayApu, nil, 0);
setlistener("/systems/electrical/relay/ext-epc/contact-pos", relayExt, nil, 0);
2019-10-14 16:48:35 +00:00
#########
# Doors #
#########
# Front doors
var doorl1 = aircraft.door.new("/sim/model/door-positions/doorl1", 4);
var doorr1 = aircraft.door.new("/sim/model/door-positions/doorr1", 4);
# Middle doors (A321 only)
var doorl2 = aircraft.door.new("/sim/model/door-positions/doorl2", 4);
var doorr2 = aircraft.door.new("/sim/model/door-positions/doorr2", 4);
var doorl3 = aircraft.door.new("/sim/model/door-positions/doorl3", 4);
var doorr3 = aircraft.door.new("/sim/model/door-positions/doorr3", 4);
# Rear doors
var doorl4 = aircraft.door.new("/sim/model/door-positions/doorl4", 4);
var doorr4 = aircraft.door.new("/sim/model/door-positions/doorr4", 4);
# Cargo holds
var cargobulk = aircraft.door.new("/sim/model/door-positions/cargobulk", 3);
var cargoaft = aircraft.door.new("/sim/model/door-positions/cargoaft", 10);
var cargofwd = aircraft.door.new("/sim/model/door-positions/cargofwd", 10);
# Seat armrests in the flight deck (unused)
var armrests = aircraft.door.new("/sim/model/door-positions/armrests", 2);
# door opener/closer
var triggerDoor = func(door, doorName, doorDesc) {
2020-05-12 02:40:59 +00:00
if (getprop("/sim/model/door-positions/" ~ doorName ~ "/position-norm") > 0) {
2019-10-14 16:48:35 +00:00
gui.popupTip("Closing " ~ doorDesc ~ " door");
door.toggle();
} else {
2020-05-12 02:40:59 +00:00
if (getprop("/velocities/groundspeed-kt") > 5) {
2019-10-14 16:48:35 +00:00
gui.popupTip("You cannot open the doors while the aircraft is moving!");
} else {
gui.popupTip("Opening " ~ doorDesc ~ " door");
door.toggle();
}
}
};
2020-07-11 23:35:03 +00:00
###########
# Systems #
###########
2019-10-14 16:48:35 +00:00
var systemsInit = func {
2019-11-30 13:39:53 +00:00
fbw.FBW.init();
2020-05-05 18:12:14 +00:00
effects.light_manager.init();
2019-10-14 16:48:35 +00:00
systems.ELEC.init();
systems.PNEU.init();
systems.HYD.init();
systems.FUEL.init();
systems.ADIRS.init();
systems.eng_init();
2020-04-14 17:07:01 +00:00
systems.APUController.init();
2020-07-25 23:13:54 +00:00
systems.Autobrake.init();
2020-05-16 20:04:03 +00:00
systems.fire_init();
2020-01-07 20:48:27 +00:00
fmgc.flightPlanController.reset();
2020-06-10 02:42:30 +00:00
fmgc.windController.reset();
2019-10-14 16:48:35 +00:00
fadec.FADEC.init();
fmgc.ITAF.init();
fmgc.FMGCinit();
mcdu.MCDU_init(0);
mcdu.MCDU_init(1);
2020-05-25 17:56:13 +00:00
mcdu_scratchpad.mcduMsgtimer1.start();
mcdu_scratchpad.mcduMsgtimer2.start();
2019-10-14 16:48:35 +00:00
systemsLoop.start();
2020-05-05 18:12:14 +00:00
effects.icingInit();
2019-10-14 16:48:35 +00:00
lightsLoop.start();
2020-05-16 20:04:03 +00:00
ecam.ECAM.init();
2019-10-14 16:48:35 +00:00
libraries.variousReset();
rmp.init();
acp.init();
ecam.ECAM_controller.init();
atc.init();
2019-10-27 20:54:00 +00:00
fcu.FCUController.init();
2019-11-06 19:09:42 +00:00
dmc.DMController.init();
2020-05-21 20:02:28 +00:00
fmgc.flightPlanController.init();
2020-06-10 02:42:30 +00:00
fmgc.windController.init();
2020-07-23 14:29:44 +00:00
atsu.CompanyCall.init();
2019-10-14 16:48:35 +00:00
}
setlistener("/sim/signals/fdm-initialized", func {
systemsInit();
2020-07-10 00:09:19 +00:00
fmgc.postInit();
2020-01-07 20:48:27 +00:00
fmgc.flightPlanTimer.start();
2020-05-18 23:09:09 +00:00
fmgc.WaypointDatabase.read();
2019-10-14 16:48:35 +00:00
});
2020-07-11 23:35:03 +00:00
var collectorTankL = props.globals.getNode("/fdm/jsbsim/propulsion/tank[5]/contents-lbs");
var collectorTankR = props.globals.getNode("/fdm/jsbsim/propulsion/tank[6]/contents-lbs");
var groundAir = props.globals.getNode("/controls/pneumatics/switches/groundair");
var groundCart = props.globals.getNode("/controls/electrical/ground-cart");
var chocks = props.globals.getNode("/services/chocks/enable");
var engRdy = props.globals.getNode("/engines/ready");
var groundspeed = 0;
2019-10-14 16:48:35 +00:00
var systemsLoop = maketimer(0.1, func {
systems.ELEC.loop();
systems.PNEU.loop();
systems.HYD.loop();
systems.FUEL.loop();
2020-05-01 08:41:39 +00:00
systems.ADIRS.loop();
2020-05-16 20:04:03 +00:00
ecam.ECAM.loop();
2019-10-14 16:48:35 +00:00
libraries.BUTTONS.update();
fadec.FADEC.loop();
rmp.rmpUpdate();
2019-10-27 20:54:00 +00:00
fcu.FCUController.loop();
2019-11-06 19:09:42 +00:00
dmc.DMController.loop();
2020-04-18 18:57:59 +00:00
systems.APUController.loop();
2020-04-21 15:35:11 +00:00
systems.HFLoop();
2020-07-30 18:36:00 +00:00
atsu.ATSU.loop();
2019-10-14 16:48:35 +00:00
2020-07-11 23:35:03 +00:00
groundspeed = pts.Velocities.groundspeed.getValue();
if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) {
groundAir.setBoolValue(0);
groundCart.setBoolValue(0);
2019-10-14 16:48:35 +00:00
}
2020-07-11 23:35:03 +00:00
if (groundspeed > 15) {
shakeEffectA3XX.setBoolValue(1);
2019-10-14 16:48:35 +00:00
} else {
2020-07-11 23:35:03 +00:00
shakeEffectA3XX.setBoolValue(0);
2019-10-14 16:48:35 +00:00
}
2020-07-11 23:35:03 +00:00
stateL = pts.Engines.Engine.state[0].getValue();
stateR = pts.Engines.Engine.state[1].getValue();
2019-10-14 16:48:35 +00:00
2020-07-11 23:35:03 +00:00
if (stateL == 3 and stateR == 3) {
engRdy.setBoolValue(1);
2019-10-14 16:48:35 +00:00
} else {
2020-07-11 23:35:03 +00:00
engRdy.setBoolValue(0);
2019-10-14 16:48:35 +00:00
}
2020-07-11 23:35:03 +00:00
if ((stateL == 2 or stateL == 3) and collectorTankL.getValue() < 1) {
2019-10-14 16:48:35 +00:00
systems.cutoff_one();
}
2020-07-11 23:35:03 +00:00
if ((stateR == 2 or stateR == 3) and collectorTankR.getValue() < 1) {
2019-10-14 16:48:35 +00:00
systems.cutoff_two();
}
2020-07-11 23:35:03 +00:00
});
# GPWS
var GPWS = {
inhibitNode: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit"),
volume: props.globals.getNode("/instrumentation/mk-viii/speaker/volume"),
flapAllOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override"),
flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override"),
flapOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override"),
};
setlistener("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit", func() {
if (GPWS.inhibitNode.getBoolValue()) {
GPWS.volume.setValue(2);
} else {
GPWS.volume.setValue(0);
}
}, 0, 0);
var updateGPWSFlap = func() {
if (GPWS.flapAllOverride.getBoolValue() or (GPWS.flap3Override.getBoolValue() and pts.Controls.Flight.flapsPos.getValue() >= 4)) {
GPWS.flapOverride.setBoolValue(1);
} else {
GPWS.flapOverride.setBoolValue(0);
}
}
setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override", func() {
updateGPWSFlap();
}, 0, 0);
setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override", func() {
updateGPWSFlap();
}, 0, 0);
# Replay
var replayState = props.globals.getNode("/sim/replay/replay-state");
setlistener("/sim/replay/replay-state", func() {
if (replayState.getBoolValue()) {
} else {
2019-10-14 16:48:35 +00:00
acconfig.colddark();
gui.popupTip("Replay Ended: Setting Cold and Dark state...");
}
2020-07-11 23:35:03 +00:00
}, 0, 0);
2019-10-14 16:48:35 +00:00
2020-07-11 23:35:03 +00:00
# Steep ILS
2019-10-14 16:48:35 +00:00
setlistener("/options/steep-ils", func {
2020-05-12 02:40:59 +00:00
if (getprop("/options/steep-ils") == 1) {
setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 1);
2019-10-14 16:48:35 +00:00
} else {
2020-05-12 02:40:59 +00:00
setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 0);
2019-10-14 16:48:35 +00:00
}
2020-07-11 23:35:03 +00:00
}, 0, 0);
2019-10-14 16:48:35 +00:00
2020-07-11 23:35:03 +00:00
# hackCanvas
2019-10-14 16:48:35 +00:00
canvas.Text._lastText = canvas.Text["_lastText"];
canvas.Text.setText = func(text) {
if (text == me._lastText and text != nil and size(text) == size(me._lastText)) {return me;}
me._lastText = text;
me.set("text", typeof(text) == 'scalar' ? text : "");
};
canvas.Element._lastVisible = nil;
canvas.Element.show = func {
if (1 == me._lastVisible) {return me;}
me._lastVisible = 1;
me.setBool("visible", 1);
};
canvas.Element.hide = func {
if (0 == me._lastVisible) {return me;}
me._lastVisible = 0;
me.setBool("visible", 0);
};
canvas.Element.setVisible = func(vis) {
if (vis == me._lastVisible) {return me;}
me._lastVisible = vis;
me.setBool("visible", vis);
};
2019-11-01 10:59:18 +00:00
2020-07-11 23:35:03 +00:00
############
# Controls #
############
2019-10-14 16:48:35 +00:00
controls.stepSpoilers = func(step) {
2020-07-11 23:35:03 +00:00
pts.Controls.Flight.speedbrakeArm.setValue(0);
2019-10-14 16:48:35 +00:00
if (step == 1) {
deploySpeedbrake();
} else if (step == -1) {
retractSpeedbrake();
}
}
var deploySpeedbrake = func {
2020-07-12 13:24:16 +00:00
if (pts.Gear.Wow[1].getBoolValue() or pts.Gear.Wow[2].getBoolValue()) {
if (pts.Controls.Flight.speedbrake.getValue() < 1.0) {
pts.Controls.Flight.speedbrake.setValue(1.0);
2019-10-14 16:48:35 +00:00
}
} else {
2020-07-12 13:24:16 +00:00
if (pts.Controls.Flight.speedbrake.getValue() < 0.5) {
pts.Controls.Flight.speedbrake.setValue(0.5);
} else if (pts.Controls.Flight.speedbrake.getValue() < 1.0) {
pts.Controls.Flight.speedbrake.setValue(1.0);
2019-10-14 16:48:35 +00:00
}
}
}
var retractSpeedbrake = func {
2020-07-12 13:24:16 +00:00
if (pts.Gear.Wow[1].getBoolValue() or pts.Gear.Wow[2].getBoolValue()) {
if (pts.Controls.Flight.speedbrake.getValue() > 0.0) {
pts.Controls.Flight.speedbrake.setValue(0.0);
2019-10-14 16:48:35 +00:00
}
} else {
2020-07-12 13:24:16 +00:00
if (pts.Controls.Flight.speedbrake.getValue() > 0.5) {
pts.Controls.Flight.speedbrake.setValue(0.5);
} else if (pts.Controls.Flight.speedbrake.getValue() > 0.0) {
pts.Controls.Flight.speedbrake.setValue(0.0);
2019-10-14 16:48:35 +00:00
}
}
}
2020-07-11 23:35:03 +00:00
var delta = 0;
var output = 0;
2019-10-14 16:48:35 +00:00
var slewProp = func(prop, delta) {
2020-07-11 23:35:03 +00:00
delta *= pts.Sim.Time.deltaRealtimeSec.getValue();
output = props.globals.getNode(prop).getValue() + delta;
props.globals.getNode(prop).setValue(output);
return output;
2019-10-14 16:48:35 +00:00
}
2020-05-12 02:40:59 +00:00
controls.flapsDown = func(step) {
pts.Controls.Flight.flapsTemp = pts.Controls.Flight.flaps.getValue();
if (step == 1) {
if (pts.Controls.Flight.flapsTemp < 0.2) {
pts.Controls.Flight.flaps.setValue(0.2);
} else if (pts.Controls.Flight.flapsTemp < 0.4) {
pts.Controls.Flight.flaps.setValue(0.4);
} else if (pts.Controls.Flight.flapsTemp < 0.6) {
pts.Controls.Flight.flaps.setValue(0.6);
} else if (pts.Controls.Flight.flapsTemp < 0.8) {
pts.Controls.Flight.flaps.setValue(0.8);
}
} else if (step == -1) {
if (pts.Controls.Flight.flapsTemp > 0.6) {
pts.Controls.Flight.flaps.setValue(0.6);
} else if (pts.Controls.Flight.flapsTemp > 0.4) {
pts.Controls.Flight.flaps.setValue(0.4);
} else if (pts.Controls.Flight.flapsTemp > 0.2) {
pts.Controls.Flight.flaps.setValue(0.2);
} else if (pts.Controls.Flight.flapsTemp > 0) {
pts.Controls.Flight.flaps.setValue(0);
}
}
}
2020-07-11 23:35:03 +00:00
controls.elevatorTrim = func(d) {
if (systems.HYD.Psi.green.getValue() >= 1500) {
slewProp("/controls/flight/elevator-trim", d * 0.0185); # Rate in JSB normalized (0.125 / 13.5)
} else {
slewProp("/controls/flight/elevator-trim", d * 0.0092) # Rate in JSB normalized (0.125 / 13.5)
2019-10-14 16:48:35 +00:00
}
}
setlistener("/controls/flight/elevator-trim", func {
2020-07-11 23:35:03 +00:00
if (pts.Controls.Flight.elevatorTrim.getValue() > 0.296296) {
pts.Controls.Flight.elevatorTrim.setValue(0.296296);
}
}, 0, 0);
##########
# Lights #
##########
2019-10-14 16:48:35 +00:00
var lightsLoop = maketimer(0.2, func {
# signs
2020-05-12 02:40:59 +00:00
if (getprop("/systems/pressurization/cabinalt-norm") > 11300) {
setprop("/controls/lighting/seatbelt-sign", 1);
setprop("/controls/lighting/no-smoking-sign", 1);
2019-10-14 16:48:35 +00:00
} else {
2020-05-12 02:40:59 +00:00
if (getprop("/controls/switches/seatbelt-sign") == 1) {
if (getprop("/controls/lighting/seatbelt-sign") == 0) {
setprop("/controls/lighting/seatbelt-sign", 1);
2019-10-14 16:48:35 +00:00
}
2020-05-12 02:40:59 +00:00
} elsif (getprop("/controls/switches/seatbelt-sign") == 0) {
if (getprop("/controls/lighting/seatbelt-sign") == 1) {
setprop("/controls/lighting/seatbelt-sign", 0);
2019-10-14 16:48:35 +00:00
}
}
2020-05-12 02:40:59 +00:00
if (getprop("/controls/switches/no-smoking-sign") == 1) {
if (getprop("/controls/lighting/no-smoking-sign") == 0) {
setprop("/controls/lighting/no-smoking-sign", 1);
2019-10-14 16:48:35 +00:00
}
2020-05-12 02:40:59 +00:00
} elsif (getprop("/controls/switches/no-smoking-sign") == 0.5 and getprop("/gear/gear[0]/position-norm") != 0) { # todo: should be when uplocks not engaged
if (getprop("/controls/lighting/no-smoking-sign") == 0) {
setprop("/controls/lighting/no-smoking-sign", 1);
2019-10-14 16:48:35 +00:00
}
} else {
2020-05-12 02:40:59 +00:00
setprop("/controls/lighting/no-smoking-sign", 0); # sign stays on in cabin but sound still occurs
2019-10-14 16:48:35 +00:00
}
}
});
2020-07-11 23:35:03 +00:00
var pilotComfortTwoPos = func(prop) {
var item = getprop(prop);
if (item < 0.5) {
interpolate(prop, 0.5, 0.5);
} elsif (item == 0.5) {
interpolate(prop, 1.0, 0.5);
2019-10-14 16:48:35 +00:00
} else {
2020-07-11 23:35:03 +00:00
interpolate(prop, 0.0, 1.0);
2019-10-14 16:48:35 +00:00
}
}
2020-07-11 23:35:03 +00:00
var pilotComfortOnePos = func(prop) {
var item = getprop(prop);
if (item < 1.0) {
interpolate(prop, 1.0, 1.0);
2019-10-14 16:48:35 +00:00
} else {
2020-07-11 23:35:03 +00:00
interpolate(prop, 0.0, 1.0);
2019-10-14 16:48:35 +00:00
}
}
2020-07-11 23:35:03 +00:00
var lTray = func {
pilotComfortTwoPos("/controls/tray/lefttrayext");
}
var rTray = func {
pilotComfortTwoPos("/controls/tray/righttrayext");
2019-10-14 16:48:35 +00:00
}
2020-07-11 23:35:03 +00:00
var l1Pedal = func {
pilotComfortOnePos("/controls/footrest-cpt[0]");
}
2019-10-14 16:48:35 +00:00
var l2Pedal = func {
2020-07-11 23:35:03 +00:00
pilotComfortOnePos("/controls/footrest-cpt[1]");
2019-10-14 16:48:35 +00:00
}
var r1Pedal = func {
2020-07-11 23:35:03 +00:00
pilotComfortOnePos("/controls/footrest-fo[0]");
2019-10-14 16:48:35 +00:00
}
var r2Pedal = func {
2020-05-12 02:40:59 +00:00
var r2PedalCMD = getprop("/controls/footrest-fo[1]");
2020-07-11 23:35:03 +00:00
pilotComfortOnePos("/controls/footrest-fo[1]");
2019-10-14 16:48:35 +00:00
}
2020-07-11 23:35:03 +00:00
#####################
# Auto-coordination #
#####################
if (pts.Controls.Flight.autoCoordination.getBoolValue()) {
pts.Controls.Flight.autoCoordination.setBoolValue(0);
pts.Controls.Flight.aileronDrivesTiller.setBoolValue(1);
} else {
pts.Controls.Flight.aileronDrivesTiller.setBoolValue(0);
}
setlistener("/controls/flight/auto-coordination", func {
pts.Controls.Flight.autoCoordination.setBoolValue(0);
2019-11-09 16:29:57 +00:00
print("System: Auto Coordination has been turned off as it is not compatible with the fly-by-wire of this aircraft.");
screen.log.write("Auto Coordination has been disabled as it is not compatible with the fly-by-wire of this aircraft", 1, 0, 0);
2020-07-25 18:14:56 +00:00
}, 0, 0);
2019-10-14 16:48:35 +00:00
2020-07-11 23:35:03 +00:00
##############
# Legacy FCU #
##############
2019-10-27 20:54:00 +00:00
var APPanel = {
APDisc: func() {
fcu.FCUController.APDisc();
},
ATDisc: func() {
fcu.FCUController.ATDisc();
},
};
2020-05-12 02:40:59 +00:00
setprop("/systems/acconfig/libraries-loaded", 1);