Refactor reentry into a library and make it usable by rocket.ks
This commit is contained in:
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.
|
||||
}
|
Reference in New Issue
Block a user