Refactor reentry into a library and make it usable by rocket.ks
This commit is contained in:
parent
bbf1d118e3
commit
b8f6e90e1f
|
@ -7,6 +7,7 @@ local compiled is list(
|
||||||
"/lib/navigation",
|
"/lib/navigation",
|
||||||
"/lib/stabilize_rocket",
|
"/lib/stabilize_rocket",
|
||||||
"/lib/ui",
|
"/lib/ui",
|
||||||
|
"/lib/reentry",
|
||||||
"/lib/throttle"
|
"/lib/throttle"
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ runoncepath("0:/lib/boot").
|
||||||
parameter debug is false.
|
parameter debug is false.
|
||||||
|
|
||||||
local compiled is List(
|
local compiled is List(
|
||||||
"/lib/navigation"
|
"/lib/navigation",
|
||||||
|
"/lib/reentry"
|
||||||
).
|
).
|
||||||
|
|
||||||
local copied is List(
|
local copied is List(
|
||||||
|
|
26
lib/reentry.ks
Normal file
26
lib/reentry.ks
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Automated reentry.
|
||||||
|
// Assumes stage 0 contains only parachutes.
|
||||||
|
// Primarily written for small science payload probes.
|
||||||
|
|
||||||
|
function PerformReentry {
|
||||||
|
SAS off.
|
||||||
|
|
||||||
|
// stage until only stage 0 remains.
|
||||||
|
until STAGE:NUMBER <= 1 {
|
||||||
|
stage.
|
||||||
|
}
|
||||||
|
|
||||||
|
lock STEERING to SHIP:SRFRETROGRADE.
|
||||||
|
|
||||||
|
for p in SHIP:PARTS {
|
||||||
|
if p:MODULES:Find("ModuleRTAntenna") > -1 and p:GetModule("ModuleRTAntenna"):ALLEVENTNAMES:Find("Deactivate") > -1 {
|
||||||
|
p:GetModule("ModuleRTAntenna"):DoEvent("Deactivate").
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when SHIP:ALTITUDE - SHIP:GEOPOSITION:TERRAINHEIGHT < 2500 then {
|
||||||
|
CHUTES on.
|
||||||
|
}
|
||||||
|
|
||||||
|
wait until false.
|
||||||
|
}
|
|
@ -4,23 +4,5 @@
|
||||||
|
|
||||||
@lazyglobal off.
|
@lazyglobal off.
|
||||||
|
|
||||||
SAS off.
|
runoncepath("/lib/reentry").
|
||||||
|
PerformReentry().
|
||||||
// stage until only stage 0 remains.
|
|
||||||
until STAGE:NUMBER <= 1 {
|
|
||||||
stage.
|
|
||||||
}
|
|
||||||
|
|
||||||
lock STEERING to SHIP:SRFRETROGRADE.
|
|
||||||
|
|
||||||
for p in SHIP:PARTS {
|
|
||||||
if p:MODULES:Find("ModuleRTAntenna") > -1 and p:GetModule("ModuleRTAntenna"):ALLEVENTNAMES:Find("Deactivate") > -1 {
|
|
||||||
p:GetModule("ModuleRTAntenna"):DoEvent("Deactivate").
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
when SHIP:ALTITUDE - SHIP:GEOPOSITION:TERRAINHEIGHT < 2500 then {
|
|
||||||
CHUTES on.
|
|
||||||
}
|
|
||||||
|
|
||||||
wait until false.
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ runoncepath("/lib/throttle").
|
||||||
runoncepath("/lib/stabilize_rocket").
|
runoncepath("/lib/stabilize_rocket").
|
||||||
runoncepath("/lib/launch_rocket").
|
runoncepath("/lib/launch_rocket").
|
||||||
runoncepath("/lib/sensors").
|
runoncepath("/lib/sensors").
|
||||||
|
runoncepath("/lib/reentry").
|
||||||
|
|
||||||
clearguis().
|
clearguis().
|
||||||
|
|
||||||
|
@ -71,6 +72,17 @@ MakeMenu(
|
||||||
}
|
}
|
||||||
).
|
).
|
||||||
|
|
||||||
|
MakeMenu(
|
||||||
|
stk,
|
||||||
|
MakeButton(rows[1], "REENTRY"),
|
||||||
|
List(),
|
||||||
|
"Execute",
|
||||||
|
{
|
||||||
|
parameter options.
|
||||||
|
PerformReentry().
|
||||||
|
}
|
||||||
|
).
|
||||||
|
|
||||||
MakeButton(rows[1], "HOVER", { Hover(). }).
|
MakeButton(rows[1], "HOVER", { Hover(). }).
|
||||||
MakeButton(rows[1], "LAND", { Land(). }).
|
MakeButton(rows[1], "LAND", { Land(). }).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user