Simplify lots of code in the launch sequence.

This commit is contained in:
Anna Rose Wiggins 2021-07-19 21:29:27 -04:00
parent 401f51425f
commit 642e5b17c5
4 changed files with 33 additions and 47 deletions

View file

@ -2,14 +2,7 @@
@lazyglobal off.
local G is 9.81.
lock G to GetGravAcc().
function GetGravAcc {
if HAS_GRAV_SENSOR = true {
return SHIP:SENSORS:GRAV:MAG.
}
return SHIP:BODY:MU / ((SHIP:BODY:RADIUS+SHIP:ALTITUDE)^2).
}
lock G to SHIP:BODY:MU / ((SHIP:BODY:RADIUS+SHIP:ALTITUDE)^2).
// Returns the throttle value you should use to achieve the
// target TWR. If TWR can't be achieved, returns 1.0. (full throttle)
@ -27,22 +20,6 @@ function TWR {
return t/(m*G).
}
// Check for various sensors and set appropriate global constants.
// Currently only checks for grav sensor, as that's the only one used by this library.
global HAS_GRAV_SENSOR is false.
function SensorCheck {
local SensorList is 0.
list SENSORS in SensorList.
for s in SensorList {
if s:type = "grav" {
print "Gravometric sensor detected".
set HAS_GRAV_SENSOR to true.
return.
}
}
set HAS_GRAV_SENSOR to false.
}
function BurnTime {
parameter dV.