Improve auto-staging on launch to work with more ships.
Wait until ship fully loaded (unpacked) before commencing boot procedure.
This commit is contained in:
parent
08246d4d83
commit
95c68aa15f
|
@ -1,5 +1,6 @@
|
|||
CLEARSCREEN.
|
||||
print "=================== BOOTING ===================".
|
||||
wait until SHIP:UNPACKED.
|
||||
|
||||
if HOMECONNECTION:ISCONNECTED {
|
||||
update_scripts().
|
||||
|
|
16
launch.ks
16
launch.ks
|
@ -47,14 +47,16 @@ function launch {
|
|||
set NAVMODE to "SURFACE".
|
||||
lock STEERING to HEADING(launch_azimuth, 90). // roll to launch azimuth
|
||||
lock THROTTLE to 1.0.
|
||||
STAGE.
|
||||
|
||||
// Enable auto-stage when the maximum engine thrust changes (i.e. some engines ran out of fuel)
|
||||
on SHIP:MAXTHRUSTAT(0) {
|
||||
when STAGE:READY then {
|
||||
print "STAGING".
|
||||
STAGE.
|
||||
}.
|
||||
|
||||
// LAUNCH
|
||||
|
||||
// Can't use flameout or MAXTHRUSTAT on the initial staging, since the rocket may be held down by a launch tower
|
||||
until STAGE:SOLIDFUEL + STAGE:LIQUIDFUEL <> 0 stage_when_ready().
|
||||
|
||||
// Auto-stage when any of the engines flameout or if there are no active engines (e.g. when we have an intermediate stage for decouplers before activating the next engine)
|
||||
when any_flameout() or SHIP:MAXTHRUSTAT(0) = 0 then {
|
||||
stage_when_ready().
|
||||
return true. // preserve trigger
|
||||
}
|
||||
|
||||
|
|
15
util.ks
15
util.ks
|
@ -11,6 +11,12 @@ function warp_for {
|
|||
}
|
||||
|
||||
|
||||
function stage_when_ready {
|
||||
wait until STAGE:READY.
|
||||
print "STAGING".
|
||||
STAGE.
|
||||
}
|
||||
|
||||
|
||||
function isp_sum {
|
||||
local sum is 0.
|
||||
|
@ -22,6 +28,15 @@ function isp_sum {
|
|||
}
|
||||
|
||||
|
||||
function any_flameout {
|
||||
list ENGINES in engines_list.
|
||||
for engine in engines_list {
|
||||
if engine:FLAMEOUT return true.
|
||||
}
|
||||
return false.
|
||||
}
|
||||
|
||||
|
||||
function round_towards_zero {
|
||||
parameter n.
|
||||
|
||||
|
|
Loading…
Reference in a new issue