ascend + basic auto landing + misc

This commit is contained in:
2026-04-18 23:19:23 -04:00
parent 8a0700c36a
commit 9a4ae5e472
17 changed files with 504 additions and 7 deletions
+88
View File
@@ -0,0 +1,88 @@
declare function CreateDeorbit{
parameter target.
parameter dv is 300.
parameter offsetX is 0.0.
parameter offsetZ is 0.0.
local tol to 100.
lock steering to retrograde.
local lock align to vDot(ship:facing:vector, retrograde:vector).
wait until align > 0.95.
print align.
if dv > 0 {
set dv to dv * -1.
}
local tr to ADDONS:TR.
if not tr:AVAILABLE {
print "Trajectoris is not available".
return.
}
tr:settarget(target).
local deorbit to NODE(time:seconds + 200, 0, 0, dv).
until not hasNode{
remove nextNode.
wait 0.001.
}
add deorbit.
wait until tr:hasimpact.
local ipos to tr:impactpos.
local lock offset to (ipos:ALTITUDEPOSITION(0) - target:ALTITUDEPOSITION(0)).
local lock xDist to offset:x.
local lock zDist to ipos:lat - target:lat.
local dt is 60.
when xDist < 500000 then{
set dt to 30.
}
when xDist < 100000 then{
set dt to 5.
}
when xDist < 10000 then{
set dt to 1.
}
when xDist < 5000 then{
set dt to 0.5.
}
until xDist < offsetX + tol {
remove nextNode.
wait 0.001.
set deorbit:eta to deorbit:eta + dt.
add deorbit.
wait until tr:hasimpact.
set ipos to tr:impactpos.
wait 0.001.
}
until abs(zDist) < offsetZ + tol{
remove nextNode.
wait 0.001.
if zDist > 0 {
set deorbit:normal to deorbit:normal - 0.1.
} else{
set deorbit:normal to deorbit:normal + 0.1.
}
add deorbit.
wait until tr:hasimpact.
set ipos to tr:impactpos.
}
unlock steering.
}
declare function CalculateCircularizationDV{
local mu is body:mu.
local apR is apoapsis + body:radius.
local circVel is sqrt(mu / apR).
local apVel is sqrt(mu * ((2 / apR) - (1 / orbit:semimajoraxis))).
return circVel - apVel.
}