63 lines
1.5 KiB
Plaintext
63 lines
1.5 KiB
Plaintext
|
@LAZYGLOBAL OFF.
|
||
|
|
||
|
function any_flameout {
|
||
|
//
|
||
|
// Return true if any of our engines are starved for fuel. Primarily used to determine the need for staging.
|
||
|
//
|
||
|
local engines_list is list().
|
||
|
list ENGINES in engines_list.
|
||
|
for engine in engines_list {
|
||
|
if engine:IGNITION and engine:FLAMEOUT {
|
||
|
return true.
|
||
|
}
|
||
|
}
|
||
|
return false.
|
||
|
}
|
||
|
|
||
|
|
||
|
function should_stage {
|
||
|
//
|
||
|
// Return true if the rocket needs to stage.
|
||
|
//
|
||
|
return SHIP:STATUS = "PRELAUNCH" // e.g. still attached to launch tower
|
||
|
or any_flameout() // any engine starved for fuel
|
||
|
or SHIP:MAXTHRUSTAT(0) = 0. // no active engines (e.g. when we have an intermediate stage for decouplers before activating the next engine)
|
||
|
}
|
||
|
|
||
|
|
||
|
function stage_when_ready {
|
||
|
//
|
||
|
// Stage when ready. Blocks until staging has been initiated.
|
||
|
//
|
||
|
wait until STAGE:READY.
|
||
|
print "STAGING".
|
||
|
STAGE.
|
||
|
}
|
||
|
|
||
|
|
||
|
function isp_sum {
|
||
|
//
|
||
|
// Return the sum of vacuum ISP for enabled engines.
|
||
|
//
|
||
|
local sum is 0.
|
||
|
local engines_list is list().
|
||
|
list ENGINES in engines_list.
|
||
|
for engine in engines_list {
|
||
|
if engine:IGNITION {
|
||
|
set sum to sum + engine:VACUUMISP.
|
||
|
}
|
||
|
}
|
||
|
return sum.
|
||
|
}
|
||
|
|
||
|
|
||
|
function unlock_control {
|
||
|
//
|
||
|
// Ensure that the throttle is 0 and that the player is not locked out of control.
|
||
|
//
|
||
|
set SHIP:CONTROL:PILOTMAINTHROTTLE to 0.
|
||
|
set SHIP:CONTROL:NEUTRALIZE to true.
|
||
|
unlock STEERING.
|
||
|
unlock THROTTLE.
|
||
|
}
|