From d518d86bc29a6e514d60efb2544d5463b91d3488 Mon Sep 17 00:00:00 2001 From: annabunches Date: Mon, 19 Jul 2021 21:36:04 -0400 Subject: [PATCH] Add some print lines and a button to toggle terminal. --- execnode.ks | 6 ++++-- launch.ks | 1 - ui/rocket.ks | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/execnode.ks b/execnode.ks index e0e3d33..93b3a86 100644 --- a/execnode.ks +++ b/execnode.ks @@ -7,11 +7,13 @@ local t is BurnTime(n:MAG)/2. lock STEERING to n:DELTAV. wait until VectorAngle(SHIP:VELOCITY, STEERINGMANAGER:TARGET) <= 0.1. - + +print "Warping to node". KUNIVERSE:WARP:WarpTo(n:TIME - t - 5). wait until n:ETA <= t. lock THROTTLE to 1.0. -wait until n:DELTAV:MAG <= 0.1. +wait until n:DELTAV:MAG <= 0.1. // todo: pid loop here or no? unlock THROTTLE. unlock STEERING. +print "Node Executed. Have a nice day." diff --git a/launch.ks b/launch.ks index 35cbd7c..0835f23 100644 --- a/launch.ks +++ b/launch.ks @@ -11,7 +11,6 @@ parameter MINIMUM_PITCH is 5. local ATMO_TWR is 1.6. // Configure subsystems. -CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal"). RCS off. SAS off. diff --git a/ui/rocket.ks b/ui/rocket.ks index 72c1862..b19fd47 100644 --- a/ui/rocket.ks +++ b/ui/rocket.ks @@ -12,6 +12,17 @@ function nodeButtonPressed { run "execnode". } +local termOn is false. +function terminalButtonPressed { + if termOn { + CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Close Terminal"). + set termOn to false. + } else { + CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal"). + set termOn to true. + } +} + // Main UI. local interface is gui(200). set interface:X to 200. @@ -44,6 +55,9 @@ set launchButton:onClick to launchButtonPressed@. local nodeButton is interface:AddButton("Execute Node"). set nodeButton:onClick to nodeButtonPressed@. +local termButton is interface:AddButton("Terminal"). +set termButton:onClick to terminalButtonPressed@. + interface:show(). wait until false.