- drop cmdarg() usage in listener functions
- use var keyword
This commit is contained in:
parent
838dff7b5f
commit
0b453c6da3
1 changed files with 21 additions and 21 deletions
|
@ -17,26 +17,26 @@
|
|||
# You can define multiple max-flap-extension-speed entries for max extension
|
||||
# speeds for different flap settings.
|
||||
|
||||
checkFlaps = func {
|
||||
flapsetting = cmdarg().getValue();
|
||||
var checkFlaps = func(n) {
|
||||
var flapsetting = n.getValue();
|
||||
if (flapsetting == 0)
|
||||
return;
|
||||
|
||||
airspeed = getprop("velocities/airspeed-kt");
|
||||
ltext = "";
|
||||
var airspeed = getprop("velocities/airspeed-kt");
|
||||
var ltext = "";
|
||||
|
||||
limits = props.globals.getNode("limits");
|
||||
var limits = props.globals.getNode("limits");
|
||||
|
||||
if ((limits != nil) and (limits.getChildren("max-flap-extension-speed") != nil))
|
||||
{
|
||||
children = limits.getChildren("max-flap-extension-speed");
|
||||
var children = limits.getChildren("max-flap-extension-speed");
|
||||
foreach(c; children)
|
||||
{
|
||||
if ((c.getChild("flaps") != nil) and
|
||||
(c.getChild("speed") != nil) )
|
||||
{
|
||||
flaps = c.getChild("flaps").getValue();
|
||||
speed = c.getChild("speed").getValue();
|
||||
var flaps = c.getChild("flaps").getValue();
|
||||
var speed = c.getChild("speed").getValue();
|
||||
|
||||
if ((flaps != nil) and
|
||||
(speed != nil) and
|
||||
|
@ -56,12 +56,12 @@ checkFlaps = func {
|
|||
}
|
||||
|
||||
|
||||
checkGear = func {
|
||||
if (!cmdarg().getValue())
|
||||
var checkGear = func(n) {
|
||||
if (!n.getValue())
|
||||
return;
|
||||
|
||||
airspeed = getprop("velocities/airspeed-kt");
|
||||
max_gear = getprop("limits/max-gear-extension-speed");
|
||||
var airspeed = getprop("velocities/airspeed-kt");
|
||||
var max_gear = getprop("limits/max-gear-extension-speed");
|
||||
|
||||
if ((max_gear != nil) and (airspeed > max_gear))
|
||||
{
|
||||
|
@ -75,12 +75,12 @@ setlistener("controls/flight/flaps", checkFlaps);
|
|||
setlistener("controls/gear/gear-down", checkGear);
|
||||
|
||||
# =============================== Pilot G stuff (taken from hurricane.nas) =================================
|
||||
pilot_g = props.globals.getNode("fdm/jsbsim/accelerations/a-pilot-z-ft_sec2", 1);
|
||||
var pilot_g = props.globals.getNode("fdm/jsbsim/accelerations/a-pilot-z-ft_sec2", 1);
|
||||
pilot_g.setDoubleValue(0);
|
||||
|
||||
var g_damp = 0;
|
||||
|
||||
updatePilotG = func {
|
||||
var updatePilotG = func {
|
||||
var g = pilot_g.getValue() ;
|
||||
#if (g == nil) { g = 0; }
|
||||
g_damp = ( g * 0.2) + (g_damp * 0.8);
|
||||
|
@ -90,16 +90,16 @@ updatePilotG = func {
|
|||
|
||||
updatePilotG();
|
||||
|
||||
checkGandVNE = func {
|
||||
var checkGandVNE = func {
|
||||
if (getprop("/sim/freeze/replay-state"))
|
||||
return;
|
||||
|
||||
max_positive = getprop("limits/max-positive-g");
|
||||
max_negative = getprop("limits/max-negative-g");
|
||||
msg = "";
|
||||
var max_positive = getprop("limits/max-positive-g");
|
||||
var max_negative = getprop("limits/max-negative-g");
|
||||
var msg = "";
|
||||
|
||||
# Convert the ft/sec^2 into Gs - allowing for gravity.
|
||||
g = (- g_damp) / 32;
|
||||
var g = (- g_damp) / 32;
|
||||
|
||||
if ((max_positive != nil) and (g > max_positive))
|
||||
{
|
||||
|
@ -112,8 +112,8 @@ checkGandVNE = func {
|
|||
}
|
||||
|
||||
# Now check VNE
|
||||
airspeed = getprop("velocities/airspeed-kt");
|
||||
vne = getprop("limits/vne");
|
||||
var airspeed = getprop("velocities/airspeed-kt");
|
||||
var vne = getprop("limits/vne");
|
||||
|
||||
if ((airspeed != nil) and (vne != nil) and (airspeed > vne))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue