Re-factor libraries.nas, fix bug in fbw
This commit is contained in:
parent
cc6e842a07
commit
b09ab21a37
5 changed files with 310 additions and 269 deletions
|
@ -88,6 +88,9 @@
|
|||
<output-property>/systems/pitot[2]/icing</output-property>
|
||||
</iceable>
|
||||
</icing>
|
||||
<lights>
|
||||
<nose-lights type="double">0</nose-lights>
|
||||
</lights>
|
||||
</model>
|
||||
|
||||
<previews>
|
||||
|
@ -824,6 +827,9 @@
|
|||
<no-smoking-sign type="bool">1</no-smoking-sign>
|
||||
<seatbelt-sign type="bool">0</seatbelt-sign>
|
||||
<taxi-light-switch type="float">0</taxi-light-switch>
|
||||
<turnoff-light-switch type="bool">0</turnoff-light-switch>
|
||||
<leftturnoff type="bool">0</leftturnoff>
|
||||
<rightturnoff type="bool">0</rightturnoff>
|
||||
</lighting>
|
||||
<navigation>
|
||||
<adirscp>
|
||||
|
@ -920,6 +926,7 @@
|
|||
</controls>
|
||||
|
||||
<engines>
|
||||
<ready type="bool">0</ready>
|
||||
<engine n="0">
|
||||
<egt-actual type="double">0</egt-actual>
|
||||
<epr-actual type="double">1</epr-actual>
|
||||
|
@ -4162,6 +4169,7 @@
|
|||
<file>Aircraft/A320-family/Nasal/Libraries/buttons.nas</file>
|
||||
<file>Aircraft/A320-family/Nasal/Libraries/shake.nas</file>
|
||||
<file>Aircraft/A320-family/Nasal/Libraries/zoom-views.nas</file>
|
||||
<file>Aircraft/A320-family/Nasal/Libraries/custom-views.nas</file>
|
||||
</libraries>
|
||||
<acconfig>
|
||||
<file>Aircraft/A320-family/AircraftConfig/acconfig.nas</file>
|
||||
|
|
|
@ -125,7 +125,6 @@ var FBW = {
|
|||
};
|
||||
|
||||
var update_loop = func {
|
||||
|
||||
elac1 = FBW.Computers.elac1.getBoolValue();
|
||||
elac2 = FBW.Computers.elac2.getBoolValue();
|
||||
sec1 = FBW.Computers.sec1.getBoolValue();
|
||||
|
@ -178,7 +177,7 @@ var update_loop = func {
|
|||
law = FBW.activeLaw.getValue();
|
||||
|
||||
# Mech Backup can always return to direct, if it can.
|
||||
if (law == 3 and ac_ess >= 110 and (green >= 1500 or blue >= 1500 or yellow >= 1500)) {
|
||||
if (law == 3 and systems.ELEC.Bus.acEss.getValue() >= 110 and (green >= 1500 or blue >= 1500 or yellow >= 1500)) {
|
||||
FBW.degradeLaw.setValue(2);
|
||||
}
|
||||
|
||||
|
|
150
Nasal/Libraries/custom-views.nas
Normal file
150
Nasal/Libraries/custom-views.nas
Normal file
|
@ -0,0 +1,150 @@
|
|||
# Custom view positions
|
||||
# Copyright (c) 2020 Josh Davidson (Octal450)
|
||||
|
||||
#########
|
||||
# Views #
|
||||
#########
|
||||
var resetView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 360;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", -14.6, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var autopilotView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 341.7;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", -16.4, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var overheadView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 348;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 105.8, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", 65.25, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0,0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.12, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var pedestalView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 315;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", -46.3, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var lightsView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 329;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", 17.533, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ print("------------------------------------------------");
|
|||
print("Copyright (c) 2016-2020 Josh Davidson (Octal450)");
|
||||
print("------------------------------------------------");
|
||||
|
||||
setprop("/sim/replay/was-active", 0);
|
||||
|
||||
setprop("/sim/menubar/default/menu[0]/item[0]/enabled", 0);
|
||||
setprop("/sim/menubar/default/menu[2]/item[0]/enabled", 0);
|
||||
|
@ -17,18 +16,6 @@ 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);
|
||||
|
||||
# Dimmers
|
||||
setprop("/controls/lighting/ndl-norm", 1);
|
||||
setprop("/controls/lighting/ndr-norm", 1);
|
||||
setprop("/controls/lighting/upper-norm", 1);
|
||||
|
||||
# Lights
|
||||
setprop("/sim/model/lights/nose-lights", 0);
|
||||
setprop("/sim/model/lights/turnoffsw", 0);
|
||||
setprop("/controls/lighting/turnoff-light-switch", 0);
|
||||
setprop("/controls/lighting/leftturnoff", 0);
|
||||
setprop("/controls/lighting/rightturnoff", 0);
|
||||
|
||||
# Oil Qty
|
||||
var qty1 = math.round((rand() * 5 ) + 20, 0.1);
|
||||
var qty2 = math.round((rand() * 5 ) + 20, 0.1);
|
||||
|
@ -38,14 +25,14 @@ setprop("/engines/engine[1]/oil-qt-actual", qty2);
|
|||
##########
|
||||
# Lights #
|
||||
##########
|
||||
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");
|
||||
|
||||
var beacon_switch = props.globals.getNode("controls/switches/beacon", 1);
|
||||
var beacon_ctl = props.globals.getNode("controls/lighting/beacon", 1);
|
||||
var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls/lighting/beacon");
|
||||
var strobe_switch = props.globals.getNode("controls/switches/strobe", 1);
|
||||
var strobe_light = props.globals.getNode("controls/lighting/strobe", 1);
|
||||
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");
|
||||
var logo_lights = getprop("/sim/model/lights/logo-lights");
|
||||
var nav_lights = props.globals.getNode("sim/model/lights/nav-lights");
|
||||
var wing_switch = props.globals.getNode("controls/switches/wing-lights", 1);
|
||||
|
@ -65,14 +52,18 @@ var landL = props.globals.getNode("controls/lighting/landing-lights[1]", 1);
|
|||
var landR = props.globals.getNode("controls/lighting/landing-lights[2]", 1);
|
||||
var landlSw = props.globals.getNode("controls/switches/landing-lights-l", 1);
|
||||
var landrSw = props.globals.getNode("controls/switches/landing-lights-r", 1);
|
||||
var stateL = 0;
|
||||
var stateR = 0;
|
||||
|
||||
###################
|
||||
# Tire Smoke/Rain #
|
||||
###################
|
||||
###########
|
||||
# Effects #
|
||||
###########
|
||||
|
||||
var tiresmoke_system = aircraft.tyresmoke_system.new(0, 1, 2);
|
||||
aircraft.rain.init();
|
||||
|
||||
aircraft.livery.init(getprop("/sim/model/livery-dir"));
|
||||
|
||||
##########
|
||||
# Sounds #
|
||||
##########
|
||||
|
@ -207,19 +198,9 @@ var triggerDoor = func(door, doorName, doorDesc) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
#######################
|
||||
# Effects #
|
||||
#######################
|
||||
aircraft.tyresmoke_system.new(0, 1, 2);
|
||||
|
||||
aircraft.rain.init();
|
||||
|
||||
aircraft.livery.init(getprop("/sim/model/livery-dir"));
|
||||
|
||||
#######################
|
||||
# Various Other Stuff #
|
||||
#######################
|
||||
###########
|
||||
# Systems #
|
||||
###########
|
||||
var systemsInit = func {
|
||||
fbw.FBW.init();
|
||||
effects.light_manager.init();
|
||||
|
@ -263,6 +244,14 @@ setlistener("/sim/signals/fdm-initialized", func {
|
|||
fmgc.WaypointDatabase.read();
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
var systemsLoop = maketimer(0.1, func {
|
||||
systems.ELEC.loop();
|
||||
systems.PNEU.loop();
|
||||
|
@ -278,59 +267,88 @@ var systemsLoop = maketimer(0.1, func {
|
|||
systems.APUController.loop();
|
||||
systems.HFLoop();
|
||||
|
||||
if ((getprop("/controls/pneumatics/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/enable") == 0))) {
|
||||
setprop("/controls/electrical/ground-cart", 0);
|
||||
setprop("/controls/pneumatics/switches/groundair", 0);
|
||||
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);
|
||||
}
|
||||
|
||||
if (getprop("/velocities/groundspeed-kt") > 15) {
|
||||
setprop("/systems/shake/effect", 1);
|
||||
if (groundspeed > 15) {
|
||||
shakeEffectA3XX.setBoolValue(1);
|
||||
} else {
|
||||
setprop("/systems/shake/effect", 0);
|
||||
shakeEffectA3XX.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override") == 1 or (getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override") == 1 and getprop("/controls/flight/flaps-pos") >= 4)) {
|
||||
setprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override", 1);
|
||||
stateL = pts.Engines.Engine.state[0].getValue();
|
||||
stateR = pts.Engines.Engine.state[1].getValue();
|
||||
|
||||
if (stateL == 3 and stateR == 3) {
|
||||
engRdy.setBoolValue(1);
|
||||
} else {
|
||||
setprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override", 0);
|
||||
engRdy.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (getprop("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit") == 1) {
|
||||
setprop("/instrumentation/mk-viii/speaker/volume", 0);
|
||||
} else {
|
||||
setprop("/instrumentation/mk-viii/speaker/volume", 2);
|
||||
}
|
||||
|
||||
if (getprop("/engines/engine[0]/state") == 3 and getprop("/engines/engine[1]/state") == 3) {
|
||||
setprop("/engines/ready", 1);
|
||||
} else {
|
||||
setprop("/engines/ready", 0);
|
||||
}
|
||||
|
||||
if ((getprop("/engines/engine[0]/state") == 2 or getprop("/engines/engine[0]/state") == 3) and getprop("/fdm/jsbsim/propulsion/tank[5]/contents-lbs") < 1) {
|
||||
if ((stateL == 2 or stateL == 3) and collectorTankL.getValue() < 1) {
|
||||
systems.cutoff_one();
|
||||
}
|
||||
if ((getprop("/engines/engine[1]/state") == 2 or getprop("/engines/engine[1]/state") == 3) and getprop("/fdm/jsbsim/propulsion/tank[6]/contents-lbs") < 1) {
|
||||
if ((stateR == 2 or stateR == 3) and collectorTankR.getValue() < 1) {
|
||||
systems.cutoff_two();
|
||||
}
|
||||
|
||||
if (getprop("/sim/replay/replay-state") == 1) {
|
||||
setprop("/sim/replay/was-active", 1);
|
||||
} else if (getprop("/sim/replay/replay-state") == 0 and getprop("/sim/replay/was-active") == 1) {
|
||||
setprop("/sim/replay/was-active", 0);
|
||||
acconfig.colddark();
|
||||
gui.popupTip("Replay Ended: Setting Cold and Dark state...");
|
||||
}
|
||||
});
|
||||
|
||||
# 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 {
|
||||
acconfig.colddark();
|
||||
gui.popupTip("Replay Ended: Setting Cold and Dark state...");
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
# Steep ILS
|
||||
setlistener("/options/steep-ils", func {
|
||||
if (getprop("/options/steep-ils") == 1) {
|
||||
setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 1);
|
||||
} else {
|
||||
setprop("/instrumentation/mk-viii/inputs/discretes/steep-approach", 0);
|
||||
}
|
||||
});
|
||||
}, 0, 0);
|
||||
|
||||
# hackCanvas
|
||||
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;}
|
||||
|
@ -354,8 +372,12 @@ canvas.Element.setVisible = func(vis) {
|
|||
me.setBool("visible", vis);
|
||||
};
|
||||
|
||||
############
|
||||
# Controls #
|
||||
############
|
||||
|
||||
controls.stepSpoilers = func(step) {
|
||||
setprop("/controls/flight/speedbrake-arm", 0);
|
||||
pts.Controls.Flight.speedbrakeArm.setValue(0);
|
||||
if (step == 1) {
|
||||
deploySpeedbrake();
|
||||
} else if (step == -1) {
|
||||
|
@ -391,10 +413,13 @@ var retractSpeedbrake = func {
|
|||
}
|
||||
}
|
||||
|
||||
var delta = 0;
|
||||
var output = 0;
|
||||
var slewProp = func(prop, delta) {
|
||||
delta *= getprop("/sim/time/delta-realtime-sec");
|
||||
setprop(prop, getprop(prop) + delta);
|
||||
return getprop(prop);
|
||||
delta *= pts.Sim.Time.deltaRealtimeSec.getValue();
|
||||
output = props.globals.getNode(prop).getValue() + delta;
|
||||
props.globals.getNode(prop).setValue(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
controls.flapsDown = func(step) {
|
||||
|
@ -422,20 +447,23 @@ controls.flapsDown = func(step) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
controls.elevatorTrim = func(speed) {
|
||||
if (getprop("/systems/hydraulic/green-psi") >= 1500) {
|
||||
slewprop("/controls/flight/elevator-trim", speed * 0.0185); # Rate in JSB normalized (0.25 / 13.5)
|
||||
} else {
|
||||
slewprop("/controls/flight/elevator-trim", speed * 0.0092); # Rate in JSB normalized (0.125 / 13.5)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
setlistener("/controls/flight/elevator-trim", func {
|
||||
if (getprop("/controls/flight/elevator-trim") > 0.296296) {
|
||||
setprop("/controls/flight/elevator-trim", 0.296296);
|
||||
}
|
||||
});
|
||||
if (pts.Controls.Flight.elevatorTrim.getValue() > 0.296296) {
|
||||
pts.Controls.Flight.elevatorTrim.setValue(0.296296);
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
##########
|
||||
# Lights #
|
||||
##########
|
||||
|
||||
var lightsLoop = maketimer(0.2, func {
|
||||
gear = getprop("/gear/gear[0]/position-norm");
|
||||
|
@ -593,72 +621,68 @@ var lightsLoop = maketimer(0.2, func {
|
|||
}
|
||||
});
|
||||
|
||||
var lTray = func {
|
||||
var lTrayCMD = getprop("/controls/tray/lefttrayext");
|
||||
if (lTrayCMD < 0.5) {
|
||||
interpolate("/controls/tray/lefttrayext", 0.5, 0.5);
|
||||
} else if (lTrayCMD == 0.5) {
|
||||
interpolate("/controls/tray/lefttrayext", 1.0, 0.5);
|
||||
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);
|
||||
} else {
|
||||
interpolate("/controls/tray/lefttrayext", 0.0, 1.0);
|
||||
interpolate(prop, 0.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
var rTray = func {
|
||||
var rTrayCMD = getprop("/controls/tray/righttrayext");
|
||||
if (rTrayCMD < 0.5) {
|
||||
interpolate("/controls/tray/righttrayext", 0.5, 0.5);
|
||||
} else if (rTrayCMD == 0.5) {
|
||||
interpolate("/controls/tray/righttrayext", 1.0, 0.5);
|
||||
var pilotComfortOnePos = func(prop) {
|
||||
var item = getprop(prop);
|
||||
if (item < 1.0) {
|
||||
interpolate(prop, 1.0, 1.0);
|
||||
} else {
|
||||
interpolate("/controls/tray/righttrayext", 0.0, 1.0);
|
||||
interpolate(prop, 0.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
var lTray = func {
|
||||
pilotComfortTwoPos("/controls/tray/lefttrayext");
|
||||
}
|
||||
var rTray = func {
|
||||
pilotComfortTwoPos("/controls/tray/righttrayext");
|
||||
}
|
||||
|
||||
var l1Pedal = func {
|
||||
var lPedalCMD = getprop("/controls/footrest-cpt[0]");
|
||||
if (lPedalCMD < 1.0) {
|
||||
interpolate("/controls/footrest-cpt[0]", 1.0, 0.5);
|
||||
} else {
|
||||
interpolate("/controls/footrest-cpt[0]", 0.0, 0.5);
|
||||
}
|
||||
pilotComfortOnePos("/controls/footrest-cpt[0]");
|
||||
}
|
||||
|
||||
var l2Pedal = func {
|
||||
var l2PedalCMD = getprop("/controls/footrest-cpt[1]");
|
||||
if (l2PedalCMD < 1.0) {
|
||||
interpolate("/controls/footrest-cpt[1]", 1.0, 0.5);
|
||||
} else {
|
||||
interpolate("/controls/footrest-cpt[1]", 0.0, 0.5);
|
||||
}
|
||||
pilotComfortOnePos("/controls/footrest-cpt[1]");
|
||||
}
|
||||
|
||||
var r1Pedal = func {
|
||||
var rPedalCMD = getprop("/controls/footrest-fo[0]");
|
||||
if (rPedalCMD < 1.0) {
|
||||
interpolate("/controls/footrest-fo[0]", 1.0, 0.5);
|
||||
} else {
|
||||
interpolate("/controls/footrest-fo[0]", 0.0, 0.5);
|
||||
}
|
||||
pilotComfortOnePos("/controls/footrest-fo[0]");
|
||||
}
|
||||
|
||||
var r2Pedal = func {
|
||||
var r2PedalCMD = getprop("/controls/footrest-fo[1]");
|
||||
if (r2PedalCMD < 1.0) {
|
||||
interpolate("/controls/footrest-fo[1]", 1.0, 0.5);
|
||||
} else {
|
||||
interpolate("/controls/footrest-fo[1]", 0.0, 0.5);
|
||||
}
|
||||
pilotComfortOnePos("/controls/footrest-fo[1]");
|
||||
}
|
||||
|
||||
if (getprop("/controls/flight/auto-coordination") == 1) {
|
||||
setprop("/controls/flight/auto-coordination", 0);
|
||||
#####################
|
||||
# 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);
|
||||
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);
|
||||
}
|
||||
|
||||
setprop("/controls/flight/aileron-drives-tiller", 0);
|
||||
});
|
||||
|
||||
##############
|
||||
# Legacy FCU #
|
||||
##############
|
||||
var APPanel = {
|
||||
APDisc: func() {
|
||||
fcu.FCUController.APDisc();
|
||||
|
@ -668,149 +692,4 @@ var APPanel = {
|
|||
},
|
||||
};
|
||||
|
||||
var resetView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 360;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", -14.6, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var autopilotView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 341.7;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", -16.4, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var overheadView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 348;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 105.8, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", 65.25, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0,0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.12, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var pedestalView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 315;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", -46.3, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var lightsView = func() {
|
||||
if (getprop("/sim/current-view/view-number") == 0) {
|
||||
if (getprop("/sim/rendering/headshake/enabled")) {
|
||||
var _shakeFlag = 1;
|
||||
setprop("/sim/rendering/headshake/enabled", 0);
|
||||
} else {
|
||||
var _shakeFlag = 0;
|
||||
}
|
||||
|
||||
var hd = getprop("/sim/current-view/heading-offset-deg");
|
||||
var hd_t = 329;
|
||||
if (hd < 180) {
|
||||
hd_t = hd_t - 360;
|
||||
}
|
||||
|
||||
interpolate("sim/current-view/field-of-view", 63, 0.66);
|
||||
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
|
||||
interpolate("sim/current-view/pitch-offset-deg", 17.533, 0.66);
|
||||
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
|
||||
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
|
||||
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
|
||||
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
|
||||
|
||||
if (_shakeFlag) {
|
||||
setprop("/sim/rendering/headshake/enabled", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setprop("/systems/acconfig/libraries-loaded", 1);
|
||||
|
|
|
@ -26,9 +26,13 @@ var Controls = {
|
|||
},
|
||||
Flight: {
|
||||
aileron: props.globals.getNode("/controls/flight/aileron"),
|
||||
aileronDrivesTiller: props.globals.getNode("/controls/flight/aileron-drives-tiller"),
|
||||
autoCoordination: props.globals.getNode("/controls/flight/auto-coordination"),
|
||||
elevatorTrim: props.globals.getNode("/controls/flight/elevator-trim"),
|
||||
flaps: props.globals.getNode("/controls/flight/flaps"),
|
||||
flapsTemp: 0,
|
||||
flapsPos: props.globals.getNode("/controls/flight/flaps-pos"),
|
||||
speedbrakeArm: props.globals.getNode("/controls/flight/speedbrake-arm"),
|
||||
},
|
||||
Gear: {
|
||||
gearDown: props.globals.getNode("/controls/gear/gear-down"),
|
||||
|
@ -143,6 +147,7 @@ var Sim = {
|
|||
replayActive: props.globals.getNode("/sim/replay/replay-state"),
|
||||
},
|
||||
Time: {
|
||||
deltaRealtimeSec: props.globals.getNode("/sim/time/delta-realtime-sec"),
|
||||
elapsedSec: props.globals.getNode("/sim/time/elapsed-sec"),
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue