-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCatchTarget.ks
More file actions
31 lines (23 loc) · 795 Bytes
/
CatchTarget.ks
File metadata and controls
31 lines (23 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
DECLARE parameter mytarget.
RUNONCEPATH("ExecNode.ks").
if(SHIP:ORBIT:HASNEXTPATCH and SHIP:ORBIT:NEXTPATCH:BODY = mytarget){
print "Warping to next encounter".
local otherOrbit to SHIP:ORBIT:NEXTPATCH.
local arrivalTime to time:seconds + SHIP:ORBIT:NEXTPATCHETA + 5.
KUNIVERSE:TIMEWARP:WARPTO(arrivalTime).
wait until time:seconds >= arrivalTime.
}
if(SHIP:ORBIT:BODY = mytarget and SHIP:ORBIT:HASNEXTPATCH){
LOCAL myNode to NODE( TIME:SECONDS+ETA:PERIAPSIS, 0, 0, 0 ).
ADD myNode.
print "Searching for circularizing manoeuvre...".
LOCAL delta to 0.
UNTIL myNode:ORBIT:HASNEXTPATCH = False {
set delta to delta - 1.
SET myNode:PROGRADE to delta.
}
print "Found circularizing manoeuvre".
print "Needed DeltaV: " + delta.
executeNode(myNode).
}
print "Done catching".