1
0
Fork 0
A320-family/Nasal/MCDU/PROGTO.nas
Matthew Maring b078cc164e Rename :)
2020-04-30 15:26:36 -04:00

24 lines
841 B
Text

# Copyright (c) 2020 Matthew Maring (mattmaring)
var altSet = props.globals.getNode("it-autoflight/input/alt", 1);
var progTOInput = func(key, i) {
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("FMGC/internal/cruise-fl-prog", getprop("FMGC/internal/cruise-fl"));
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else if (int(scratchpad) != nil) {
var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100 and getprop("FMGC/internal/cruise-lvl-set")) {
setprop("FMGC/internal/cruise-fl-prog", scratchpad);
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
}
}