Initial import
This commit is contained in:
72
lib/stage/probe.ks
Normal file
72
lib/stage/probe.ks
Normal file
@@ -0,0 +1,72 @@
|
||||
@lazyglobal off.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
|
||||
global probe is lex(
|
||||
"power_down", power_down@,
|
||||
"power_up", power_up@,
|
||||
"capture_burn", capture_burn@
|
||||
).
|
||||
|
||||
local function capture_burn {
|
||||
parameter threshold is 250_000.
|
||||
local engine is ship:partsdubbed("ROE-generic-quarter")[0].
|
||||
engine:shutdown().
|
||||
local initial_pe is ship:obt:periapsis.
|
||||
wait 1.
|
||||
warpto(eta:periapsis + time:seconds - 30).
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:warp = 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
power_up().
|
||||
rcs on.
|
||||
lock steering to ship:retrograde.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
lock throttle to 1.
|
||||
engine:activate().
|
||||
|
||||
if initial_pe > threshold {
|
||||
wait until ship:obt:periapsis < (threshold/2).
|
||||
lock throttle to 0.
|
||||
engine:shutdown().
|
||||
lock steering to sun:direction.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
power_down().
|
||||
unlock steering.
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
warpto(eta:periapsis + time:seconds - 30).
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:warp = 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
wait 1.
|
||||
power_up().
|
||||
lock steering to ship:retrograde.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
lock throttle to 1.
|
||||
engine:activate().
|
||||
wait until ship:obt:apoapsis < (threshold*2).
|
||||
} else {
|
||||
wait until ship:obt:eccentricity < 1 and ship:obt:apoapsis < threshold*2.
|
||||
}
|
||||
|
||||
engine:shutdown().
|
||||
lock throttle to 0.
|
||||
power_down().
|
||||
wait 1.
|
||||
}
|
||||
|
||||
local function power_down {
|
||||
local avionics is ship:rootpart.
|
||||
local avi_mod is avionics:getmodule("ModuleProceduralAvionics").
|
||||
avi_mod:doaction("shutdown avionics", true).
|
||||
}
|
||||
|
||||
local function power_up {
|
||||
local avionics is ship:rootpart.
|
||||
local avi_mod is avionics:getmodule("ModuleProceduralAvionics").
|
||||
avi_mod:doaction("activate avionics", true).
|
||||
}
|
||||
Reference in New Issue
Block a user