Files
kos-scripts/lib/stage/v2.ks
2025-10-29 15:40:14 -07:00

38 lines
1.0 KiB
Plaintext

@lazyglobal off.
runoncepath("0:/lib/common.ks").
global v2 is lex(
"launch", launch@
).
local function launch {
parameter hdg, target_pitch is 10.
lock throttle to 1.0.
local engine is 0.
// local a4 is ship:partsdubbed("ROE-A4").
local xlr41 is ship:partsdubbed("ROE-XLR41").
local naa75 is ship:partsdubbed("ROE-A7").
local engine is choose naa75[0] if xlr41:empty else xlr41[0].
stage.
wait until stage:ready.
wait until engine:thrust > (engine:maxthrust * 0.9).
stage.
print "Beginning initial pitchover".
local target_vel is 150.
lock steering to heading(hdg, 90 - min(target_pitch, target_pitch * (ship:velocity:surface:mag / target_vel)), -hdg).
wait until ship:velocity:surface:mag > target_vel.
//wait until steering_locked().
print "Heading stable, switching to gravity turn".
lock steering to lookdirup(ship:srfprograde:forevector, ship:up:forevector).
wait until ship:thrust = 0.
unlock throttle.
unlock steering.
}