This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Nasal/fctl.nas

114 lines
3.9 KiB
Text
Raw Normal View History

# Custom Flap/Slat System by Joshua Davidson (it0uchpods)
# In air, flaps 1 is slats only. On ground, it is slats and flaps.
setprop("/controls/flight/flap-lever", 0);
setprop("/controls/flight/flap-pos", 0);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", " ");
controls.flapsDown = func(step) {
if (step == 1) {
if (getprop("/controls/flight/flap-lever") == 0) {
if (getprop("/velocities/airspeed-kt") <= 100) {
setprop("/controls/flight/flaps", 0.290);
setprop("/controls/flight/slats", 0.666);
setprop("/controls/flight/flap-lever", 1);
setprop("/controls/flight/flap-pos", 2);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "1+F");
flaptimer.start();
return;
} else {
setprop("/controls/flight/flaps", 0.000);
setprop("/controls/flight/slats", 0.666);
setprop("/controls/flight/flap-lever", 1);
setprop("/controls/flight/flap-pos", 1);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "1");
flaptimer.stop();
return;
}
} else if (getprop("/controls/flight/flap-lever") == 1) {
setprop("/controls/flight/flaps", 0.596);
setprop("/controls/flight/slats", 0.814);
setprop("/controls/flight/flap-lever", 2);
setprop("/controls/flight/flap-pos", 3);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "2");
flaptimer.stop();
return;
} else if (getprop("/controls/flight/flap-lever") == 2) {
setprop("/controls/flight/flaps", 0.645);
setprop("/controls/flight/slats", 0.814);
setprop("/controls/flight/flap-lever", 3);
setprop("/controls/flight/flap-pos", 4);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "3");
flaptimer.stop();
return;
} else if (getprop("/controls/flight/flap-lever") == 3) {
setprop("/controls/flight/flaps", 1.000);
setprop("/controls/flight/slats", 1.000);
setprop("/controls/flight/flap-lever", 4);
setprop("/controls/flight/flap-pos", 5);
setprop("/controls/flight/flap-txt", "FULL");
flaptimer.stop();
return;
}
} else if (step == -1) {
if (getprop("/controls/flight/flap-lever") == 4) {
setprop("/controls/flight/flaps", 0.645);
setprop("/controls/flight/slats", 0.814);
setprop("/controls/flight/flap-lever", 3);
setprop("/controls/flight/flap-pos", 4);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "3");
flaptimer.stop();
return;
} else if (getprop("/controls/flight/flap-lever") == 3) {
setprop("/controls/flight/flaps", 0.596);
setprop("/controls/flight/slats", 0.814);
setprop("/controls/flight/flap-lever", 2);
setprop("/controls/flight/flap-pos", 3);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "2");
flaptimer.stop();
return;
} else if (getprop("/controls/flight/flap-lever") == 2) {
if (getprop("/velocities/airspeed-kt") <= 100) {
setprop("/controls/flight/flaps", 0.290);
setprop("/controls/flight/slats", 0.666);
setprop("/controls/flight/flap-lever", 1);
setprop("/controls/flight/flap-pos", 2);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "1+F");
flaptimer.start();
return;
} else {
setprop("/controls/flight/flaps", 0.000);
setprop("/controls/flight/slats", 0.666);
setprop("/controls/flight/flap-lever", 1);
setprop("/controls/flight/flap-pos", 1);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", "1");
flaptimer.stop();
return;
}
} else if (getprop("/controls/flight/flap-lever") == 1) {
setprop("/controls/flight/flaps", 0.000);
setprop("/controls/flight/slats", 0.000);
setprop("/controls/flight/flap-lever", 0);
setprop("/controls/flight/flap-pos", 0);
2016-11-11 22:12:53 +00:00
setprop("/controls/flight/flap-txt", " ");
flaptimer.stop();
return;
}
} else {
return 0;
}
}
var flap_autoretract = func {
if (getprop("/controls/flight/flap-pos") == 2 and getprop("/velocities/airspeed-kt") >= 208) {
setprop("/controls/flight/flaps", 0.000);
setprop("/controls/flight/slats", 0.666);
setprop("/controls/flight/flap-lever", 1);
setprop("/controls/flight/flap-pos", 1);
setprop("/controls/flight/flap-txt", "1");
flaptimer.stop();
}
}
var flaptimer = maketimer(0.5, flap_autoretract);