Small QoL and readability.

This commit is contained in:
Casper V. Kristensen 2019-02-10 15:33:50 +01:00
parent 703afe4e8b
commit fc688799fe
Signed by: caspervk
GPG key ID: 289CA03790535054
4 changed files with 36 additions and 2 deletions

View file

@ -4,8 +4,8 @@ clearscreen.
clearguis(). clearguis().
clearvecdraws(). clearvecdraws().
set TERMINAL:width to 50. set TERMINAL:width to max(TERMINAL:width, 50).
set TERMINAL:height to 30. set TERMINAL:height to max(TERMINAL:height, 30).
CORE:doaction("Open Terminal", true). CORE:doaction("Open Terminal", true).
print "==================== BOOTING =====================". print "==================== BOOTING =====================".

View file

@ -9,7 +9,9 @@ run once "lib/warp".
function launch { function launch {
//
// Launch to orbit of provided altitude and inclination. // Launch to orbit of provided altitude and inclination.
//
parameter target_orbit_altitude is 100_000. // meters parameter target_orbit_altitude is 100_000. // meters
parameter target_orbit_inclination is 0. // 0-180 degrees parameter target_orbit_inclination is 0. // 0-180 degrees
parameter pitchover_tilt is 20. // how many degrees to tilt at pitchover maneuver parameter pitchover_tilt is 20. // how many degrees to tilt at pitchover maneuver

14
lib/rendezvous.ks Normal file
View file

@ -0,0 +1,14 @@
@LAZYGLOBAL off.
run once "lib/node".
function kill_relative_velocity {
parameter target is TARGET.
parameter tolerance is 0.1.
local relative_velocity is target:velocity:orbit - SHIP:velocity:orbit.
if relative_velocity:mag > tolerance {
execute_burn(relative_velocity).
}
}

View file

@ -18,3 +18,21 @@ function atmosphere_exit_eta {
// The vdot gives us the magnitude of the orbital velocity vector in the UP direction because UP is a unit vector // The vdot gives us the magnitude of the orbital velocity vector in the UP direction because UP is a unit vector
return (BODY:atm:height - ALTITUDE) / vdot(velocity:orbit, UP:vector). return (BODY:atm:height - ALTITUDE) / vdot(velocity:orbit, UP:vector).
} }
function list_remove {
//
// Remove given element from a list.
//
parameter lst.
parameter element.
local i is 0.
until lst:empty or i = lst:length {
if lst[i] = element {
lst:remove(i).
} else {
set i to i + 1. // dont increment if we deleted an element since this index now contains a new one
}
}
}