Set constraints on FPLNt push
This commit is contained in:
parent
9a56678e94
commit
df0fa88871
1 changed files with 64 additions and 28 deletions
|
@ -156,6 +156,7 @@ var fplnItem = {
|
||||||
setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
|
setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
|
||||||
},
|
},
|
||||||
pushButtonRight: func() {
|
pushButtonRight: func() {
|
||||||
|
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 0) {
|
||||||
if (canvas_mcdu.myVertRev[me.computer] != nil) {
|
if (canvas_mcdu.myVertRev[me.computer] != nil) {
|
||||||
canvas_mcdu.myVertRev[me.computer].del();
|
canvas_mcdu.myVertRev[me.computer].del();
|
||||||
}
|
}
|
||||||
|
@ -164,7 +165,7 @@ var fplnItem = {
|
||||||
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||||
if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) {
|
if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) {
|
||||||
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
|
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
|
||||||
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
|
} if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
|
||||||
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
|
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
|
||||||
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
|
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
|
||||||
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
|
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
|
||||||
|
@ -183,6 +184,45 @@ var fplnItem = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV");
|
setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV");
|
||||||
|
} elsif (me.index != 0) { # todo - only apply to climb, descent, or missed waypoints
|
||||||
|
var scratchpadStore = mcdu_scratchpad.scratchpads[me.computer].scratchpad;
|
||||||
|
|
||||||
|
if (scratchpadStore == "CLR") {
|
||||||
|
me.wp.setSpeed("delete");
|
||||||
|
me.wp.setAltitude("delete");
|
||||||
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
|
} elsif (find("/", scratchpadStore) != -1) {
|
||||||
|
var scratchpadSplit = split("/", scratchpadStore);
|
||||||
|
|
||||||
|
if (size(scratchpadSplit[0]) == 0) {
|
||||||
|
if (num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) {
|
||||||
|
me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at");
|
||||||
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
|
} else {
|
||||||
|
mcdu_message(me.computer, "FORMAT ERROR");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and
|
||||||
|
num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) {
|
||||||
|
me.wp.setSpeed(scratchpadSplit[0], "at");
|
||||||
|
me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at");
|
||||||
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
|
} elsif (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and size(scratchpadSplit[1]) == 0) {
|
||||||
|
me.wp.setSpeed(scratchpadSplit[0], "at");
|
||||||
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
|
} else {
|
||||||
|
mcdu_message(me.computer, "FORMAT ERROR");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elsif (num(scratchpadStore) != nil and size(scratchpadStore) == 3 and scratchpadStore >= 100 and scratchpadStore <= 350) {
|
||||||
|
me.wp.setSpeed(scratchpadStore, "at");
|
||||||
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
|
} else {
|
||||||
|
mcdu_message(me.computer, "FORMAT ERROR");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mcdu_message(me.computer, "NOT ALLOWED");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -446,11 +486,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (size(me.outputList) >= index) {
|
if (size(me.outputList) >= index) {
|
||||||
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) > 0) {
|
|
||||||
mcdu_message(me.computer, "NOT ALLOWED");
|
|
||||||
} else {
|
|
||||||
me.outputList[index - 1].pushButtonRight();
|
me.outputList[index - 1].pushButtonRight();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mcdu_message(me.computer, "NOT ALLOWED");
|
mcdu_message(me.computer, "NOT ALLOWED");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue