Finally, code that works to orbit + creates a circ node.

This commit is contained in:
2021-07-19 04:46:05 -04:00
parent 6f9537547f
commit 3101aef1cc
5 changed files with 33 additions and 21 deletions

View File

@ -6,18 +6,19 @@ function GetPitch {
return 90 - vectorangle(SHIP:UP:FOREVECTOR, v).
}
function CreateCircularizationNode {
function AddCircularizationNode {
parameter usePeriapsis is false.
local target is SHIP:ORBIT:APOAPSIS.
local t is SHIP:ORBIT:ETA:APOAPSIS.
local t is TIME + SHIP:ORBIT:ETA:APOAPSIS.
if usePeriapsis {
set target to SHIP:ORBIT:PERIAPSIS.
set t to SHIP:ORBIT:ETA:PERIAPSIS.
}
local n is Node(t, 0, 0, 0).
add(n).
// move fast until we pass our target.
until (usePeriapsis and n:ORBIT:APOAPSIS < target) or n:ORBIT:PERIAPSIS > target {
until (usePeriapsis and n:ORBIT:APOAPSIS <= target) or n:ORBIT:PERIAPSIS >= target {
set n:PROGRADE to n:PROGRADE + 1.
}
@ -25,6 +26,4 @@ function CreateCircularizationNode {
until (usePeriapsis and n:ORBIT:APOAPSIS > target) or n:ORBIT:PERIAPSIS < target {
set n:PROGRADE to n:PROGRADE - 0.01.
}
return n.
}