Refactor and clean up lots of code.
This commit is contained in:
parent
94c374fcf4
commit
a4d79c9826
9 changed files with 30 additions and 32 deletions
43
init/helicopter.ks
Normal file
43
init/helicopter.ks
Normal file
|
@ -0,0 +1,43 @@
|
|||
// assumptions about helicopter builds:
|
||||
// * AG10 toggles the rotor engine power. (with appropriate RPM set by default)
|
||||
// * AG9 is unmapped.
|
||||
// * Main throttle controls collective.
|
||||
|
||||
runoncepath("lib/stabilize_helicopter").
|
||||
|
||||
global done is false.
|
||||
on AG9 {
|
||||
set done to true.
|
||||
return true.
|
||||
}
|
||||
|
||||
clearguis().
|
||||
|
||||
// Main UI.
|
||||
local interface is gui(250, 300).
|
||||
set interface:X to 200.
|
||||
set interface:Y to 700.
|
||||
|
||||
// Main menu elements in here.
|
||||
local y is interface:AddVLayout().
|
||||
local x is y:AddHLayout().
|
||||
|
||||
set x:AddButton("HOVER"):onClick to {
|
||||
PointStabilizeH().
|
||||
}.
|
||||
|
||||
set x:AddButton("LAND"):onClick to {
|
||||
// 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.
|
||||
}
|
||||
PointStabilizeH(-5).
|
||||
}.
|
||||
|
||||
interface:show().
|
||||
|
||||
wait until false.
|
Loading…
Add table
Add a link
Reference in a new issue