Files
ksp-kos-scripts/boot/boot.ks
T

52 lines
1.1 KiB
Plaintext

copyPath("0:/ascent.ks", "1:/ascent.ks").
copyPath("0:/maneuver.ks", "1:/maneuver.ks").
copyPath("0:/staging.ks", "1:/staging.ks").
copyPath("0:/logger.ks", "1:/logger.ks").
// #include logger
run once logger.
// #include ascent
run once ascent.
createDir("1:/logs").
set LOG to loggerCreate(
"1:/logs/flight-" + ship:shipName + "-" + time:full + ".json",
list(
"time",
"altitude",
"apoapsis",
"periapsis",
"eccentricity",
"throttle",
"pitch",
"heading",
"mass",
"stageNum"
),
1.0
).
set LOG_DATA to {
return list(
time:seconds,
round(ship:altitude, 1),
round(ship:apoapsis, 1),
round(ship:periapsis, 1),
round(ship:orbit:eccentricity, 4),
round(ship:throttle, 3),
round(ship:pitch, 2),
round(ship:heading, 2),
round(ship:mass, 3),
stage:number
).
}.
function UPDATE_LOG {
loggerUpdate(LOG, LOG_DATA()).
}
wait until ship:unpacked.
core:part:getmodule("kOSProcessor"):doevent("Open Terminal").
basicAscent(90, 80000).
core:part:getmodule("kOSProcessor"):doevent("Close Terminal").
loggerFlush(LOG).