2021-07-25 22:16:59 +00:00
|
|
|
// assumptions about helicopter builds:
|
|
|
|
// * AG10 toggles the rotor engine power. (with appropriate RPM set by default)
|
|
|
|
// * AG9 is unmapped.
|
|
|
|
// * Main throttle controls collective.
|
|
|
|
|
2021-08-19 02:32:07 +00:00
|
|
|
RunOncePath("lib/stabilize_helicopter").
|
|
|
|
RunOncePath("lib/ui").
|
2021-08-08 04:15:28 +00:00
|
|
|
|
|
|
|
clearguis().
|
2021-07-25 21:24:34 +00:00
|
|
|
|
|
|
|
global done is false.
|
2021-08-01 21:53:09 +00:00
|
|
|
on AG9 {
|
|
|
|
set done to true.
|
|
|
|
return true.
|
|
|
|
}
|
|
|
|
|
2021-08-08 04:15:28 +00:00
|
|
|
// Top-level elements.
|
|
|
|
local iface is gui(250, 300).
|
|
|
|
set iface:X to 200.
|
|
|
|
set iface:Y to 700.
|
|
|
|
local top is iface:AddVLayout().
|
|
|
|
local rows is List(MakeRow(top)).
|
2021-07-23 20:04:26 +00:00
|
|
|
|
2021-08-08 04:15:28 +00:00
|
|
|
set rows[0]:AddButton("HOVER"):onClick to {
|
2021-08-04 09:34:10 +00:00
|
|
|
Hover().
|
2021-07-25 21:24:34 +00:00
|
|
|
}.
|
|
|
|
|
2021-08-08 04:15:28 +00:00
|
|
|
set rows[0]:AddButton("LAND"):onClick to {
|
2021-07-25 22:16:59 +00:00
|
|
|
// todo: consider a more elaborate landing script that adjusts
|
|
|
|
// velocity as a function of altitude.
|
|
|
|
when SHIP:STATUS = "LANDED" then {
|
|
|
|
set done to true.
|
|
|
|
set SHIP:CONTROL:PILOTMAINTHROTTLE to 0.5.
|
|
|
|
toggle AG10.
|
|
|
|
BRAKES on.
|
|
|
|
}
|
2021-08-04 09:34:10 +00:00
|
|
|
Hover(-5).
|
2021-07-23 20:04:26 +00:00
|
|
|
}.
|
|
|
|
|
2021-08-08 04:15:28 +00:00
|
|
|
iface:show().
|
2021-07-23 20:04:26 +00:00
|
|
|
|
|
|
|
wait until false.
|