-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknorbit
More file actions
75 lines (73 loc) · 2.28 KB
/
knorbit
File metadata and controls
75 lines (73 loc) · 2.28 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
clearscreen.
print "knorbit init...".
set talt to 100000.
set nap to talt.
set buffer to 2.
set instable to True.
set norb to node(time:seconds + 10,0,0,-50).
add norb.
set thresh to True.
set inOrbit to False.
until inOrbit
{
print "nap: " + nap at(0,4).
set nold to norb.
if instable and norb:orbit:apoapsis <= ship:apoapsis - buffer
{
set norb:eta to norb:eta + 1.
if norb:orbit:apoapsis < nold:orbit:apoapsis
{
set norb:eta to norb:eta - 2.01.
}.
set nap to norb:orbit:apoapsis.
} else if norb:orbit:periapsis < nap - 100{
if norb:orbit:apoapsis > ship:apoapsis - buffer.
{
set instable to False.
}.
print " " at(0,6).//testing line *****
if norb:orbit:periapsis < 70000 and thresh
{
print "1.0" at(0,5).//testing line *****
set norb:prograde to norb:prograde + 1.
if norb:orbit:periapsis >= 70000
{
set thresh to False.
}.
} else if norb:orbit:apoapsis > norb:orbit:periapsis + 100{
print "3.0" at(0,5).//testing line *****
set oapo to norb:orbit:apoapsis.
set oper to norb:orbit:periapsis.
set norb:prograde to norb:prograde - 1.
set odiff to oapo - oper.
set ndiff to norb:orbit:apoapsis - norb:orbit:periapsis.
set ddiff to odiff - ndiff.
print "old diff: " + odiff at(10,9).//testing line *****
print "new diff: " + ndiff at(10,10).//testing line *****
print "diff diff: " + ddiff at(10,11).//testing line *****
if odiff < ndiff
{
print "3.1" at(0,6).//testing line *****
set norb:prograde to norb:prograde + 2.
}.
}.
if norb:orbit:periapsis >= 70000 and norb:orbit:periapsis < nap - buffer{
set oper to norb:orbit:periapsis.
set norb:radialout to norb:radialout - 1.
print "2.0" at(0,5).//testing line *****
print "old periapsis: "+ oper at(10,5).//testing line *****
print "periapsis: " + norb:orbit:periapsis at(10,6).//testing line *****
set diff to norb:orbit:periapsis - oper.
print "diff: " + diff at(10,7).//testing line *****
if oper - norb:orbit:periapsis > 0
{
print "2" at(0,6).//testing line *****
set norb:radialout to norb:radialout + 2.1.
}.
}.
} else{
set inOrbit to True.
}.
}.
unlock steering.
run nexec.