From 27ad3c11d7294ecbb9e28d914a63c1fdd223e3c0 Mon Sep 17 00:00:00 2001 From: annabunches Date: Tue, 24 Aug 2021 22:35:49 -0400 Subject: [PATCH] Tune and improve aircraft code. --- prog/aircraft.ks | 41 +++++++++++++++++++---------------------- prog/rocket.ks | 2 +- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/prog/aircraft.ks b/prog/aircraft.ks index a47f659..8775cfd 100644 --- a/prog/aircraft.ks +++ b/prog/aircraft.ks @@ -11,9 +11,12 @@ on AG9 { return true. } +global takeoffAngle is 15. +global landingAngle is 30. + function landingMode { print "Setting flaps to landing mode.". - SetFlapAngle(20). + SetFlapAngle(landingAngle). when SHIP:VELOCITY:SURFACE:MAG < 0.1 then { takeoffMode(). } @@ -21,7 +24,7 @@ function landingMode { function takeoffMode { print "Setting flaps to takeoff mode.". - SetFlapAngle(10). + SetFlapAngle(takeoffAngle). on GEAR { if GEAR = true { return true. @@ -45,26 +48,20 @@ local rows is List(MakeRow(top), MakeRow(top)). local stk is iface:AddStack(). AddStockButtons(rows[0], "aircraft"). - -// rows[0]:AddLabel("FLAPS"). -// // Todo: make angles configurable... -// set rows[1]:AddButton("Takeoff"):onClick to { -// SetFlapAngle(10). -// }. - -// set rows[1]:AddButton("Land"):onClick to { -// SetFlapAngle(20). -// }. - -// set rows[2]:AddButton("Extend"):onClick to { -// SetFlaps(true). -// }. - -// set rows[2]:AddButton("Retract"):onClick to { -// SetFlaps(true). -// }. - -// rows[3]:AddLabel("AUTO"). +MakeMenu( + stk, + MakeButton(rows[0], "Config"), + List( + List("Takeoff Flap Angle", "SCALAR", "15"), + List("Landing Flap Angle", "SCALAR", "30") + ), + "Apply", + { + parameter options. + set takeoffAngle to options["Takeoff Flap Angle"]:TEXT:ToNumber(). + set landingAngle to options["Landing Flap Angle"]:TEXT:ToNumber(). + } +). MakeMenu( stk, diff --git a/prog/rocket.ks b/prog/rocket.ks index 4bbc917..7a664d9 100644 --- a/prog/rocket.ks +++ b/prog/rocket.ks @@ -148,7 +148,7 @@ MakeMenu( MakeMenu( stk, - MakeButton(rows[2], "CONF"), + MakeButton(rows[2], "Config"), List( List("Torque Epsilon Max", "SCALAR", "0.001"), List("Max Stopping Time", "SCALAR", "2.0")