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.
|
CLEARSCREEN.
|
||||||
print "=================== BOOTING ===================".
|
print "=================== BOOTING ===================".
|
||||||
|
wait until SHIP:UNPACKED.
|
||||||
|
|
||||||
if HOMECONNECTION:ISCONNECTED {
|
if HOMECONNECTION:ISCONNECTED {
|
||||||
update_scripts().
|
update_scripts().
|
||||||
|
|
16
launch.ks
16
launch.ks
|
@ -47,14 +47,16 @@ function launch {
|
||||||
set NAVMODE to "SURFACE".
|
set NAVMODE to "SURFACE".
|
||||||
lock STEERING to HEADING(launch_azimuth, 90). // roll to launch azimuth
|
lock STEERING to HEADING(launch_azimuth, 90). // roll to launch azimuth
|
||||||
lock THROTTLE to 1.0.
|
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) {
|
// LAUNCH
|
||||||
when STAGE:READY then {
|
|
||||||
print "STAGING".
|
// Can't use flameout or MAXTHRUSTAT on the initial staging, since the rocket may be held down by a launch tower
|
||||||
STAGE.
|
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
|
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 {
|
function isp_sum {
|
||||||
local sum is 0.
|
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 {
|
function round_towards_zero {
|
||||||
parameter n.
|
parameter n.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue