Small QoL and readability.
This commit is contained in:
parent
703afe4e8b
commit
fc688799fe
|
@ -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 =====================".
|
||||||
|
|
|
@ -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
14
lib/rendezvous.ks
Normal 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).
|
||||||
|
}
|
||||||
|
}
|
18
lib/util.ks
18
lib/util.ks
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue