1
0
Fork 0
A320-family/Nasal/MCDU/PERFCLB.nas

54 lines
1.6 KiB
Text
Raw Normal View History

2020-04-30 19:26:36 +00:00
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
2019-10-14 16:48:35 +00:00
2020-04-30 19:26:36 +00:00
# Copyright (c) 2020 Matthew Maring (mattmaring)
2019-10-14 16:48:35 +00:00
var perfCLBInput = func(key, i) {
2020-05-23 00:40:01 +00:00
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L2") {
2019-10-14 16:48:35 +00:00
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
2020-05-23 11:16:20 +00:00
mcdu_scratchpad.scratchpads[i].empty();
2019-10-14 16:48:35 +00:00
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) {
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
2020-05-23 11:16:20 +00:00
mcdu_scratchpad.scratchpads[i].empty();
2019-10-14 16:48:35 +00:00
} else {
2020-05-23 11:16:20 +00:00
mcdu_message(i, "NOT ALLOWED");
2019-10-14 16:48:35 +00:00
}
} else {
2020-05-23 11:16:20 +00:00
mcdu_message(i, "NOT ALLOWED");
2019-10-14 16:48:35 +00:00
}
}
} else if (key == "L5") {
if (getprop("/FMGC/status/phase") == 2) {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO");
} else {
2020-05-23 11:16:20 +00:00
mcdu_message(i, "NOT ALLOWED");
}
2019-10-14 16:48:35 +00:00
} else if (key == "L6") {
if (getprop("/FMGC/status/phase") == 2) {
if (getprop("/FMGC/internal/activate-once") == 1) {
if (getprop("/FMGC/internal/activate-twice") == 0) {
setprop("/FMGC/internal/activate-twice", 1);
setprop("/FMGC/status/phase", 5);
setprop("/FMGC/internal/decel", 1);
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
} else {
2020-05-23 11:16:20 +00:00
mcdu_message(i, "NOT ALLOWED");
}
} else {
setprop("/FMGC/internal/activate-once", 1);
}
} else {
setprop("MCDU[" ~ i ~ "]/page", "PERFTO");
}
2019-10-14 16:48:35 +00:00
} else if (key == "R6") {
setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ");
2019-10-14 16:48:35 +00:00
}
}