Browse Source

First commit

Contains a bootloader + an orbiter and a stager program
Yann Weber 6 years ago
commit
69dbff2c72
7 changed files with 521 additions and 0 deletions
  1. 12
    0
      boot/boot.ks
  2. 271
    0
      orbit.ks
  3. BIN
      orbit.ksm
  4. 55
    0
      stager.ks
  5. 1
    0
      test/hello.ks
  6. 182
    0
      test/orbit1.ks
  7. BIN
      test/orbit1.ksm

+ 12
- 0
boot/boot.ks View File

@@ -0,0 +1,12 @@
1
+clearscreen.
2
+if core:tag:length > 0 {
3
+	SET bootfile TO core:tag + ".ks".
4
+	if volume(0):exists(bootfile) {
5
+		print "Running 0:/"+bootfile.
6
+		RUNPATH("0:/"+bootfile).
7
+	} else {
8
+		print "Bootfile 0:/"+bootfile+" does not exists".
9
+	}
10
+} else {
11
+	print "No tag name. Unable to boot...".
12
+}

+ 271
- 0
orbit.ks View File

@@ -0,0 +1,271 @@
1
+clearscreen.
2
+
3
+SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0.0.
4
+SET terminal:width TO 41.
5
+SET terminal:height TO 23.
6
+SET GETVOICE(0):wave to "triangle".
7
+SET GETVOICE(0):attack to 0.
8
+
9
+WAIT 0.5.
10
+print "=========================================".
11
+print "  Launch to orbit program".
12
+print "    First arg is a target TWR".
13
+print "    Second arg is target altitude in m".
14
+print "=========================================".
15
+print "".
16
+DECLARE PARAMETER wantedTWR is 2.3, wantedALT is 95000, wantedHEAD is 90, maneuver_prep is 50.
17
+
18
+GETVOICE(0):PLAY( NOTE(300, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(400, .2) ).wait(0.1).
19
+
20
+declare function LocalG {
21
+	// Return local gravity
22
+	return ship:body:mu / ship:body:position:mag ^ 2.
23
+}
24
+
25
+declare function getTwrThrust {
26
+	// Estimate thrust for a given TWR (1.5 by default)
27
+	DECLARE PARAMETER TWR is 1.5.
28
+	set m to ship:mass.
29
+	set w to m * LocalG().
30
+	set p to ship:sensors:pres / 100.
31
+	set t to ship:maxthrustat(p).
32
+	set throt to (TWR * w) / t.
33
+	if throt <= 1.0 {
34
+		return throt.
35
+	} else {
36
+		return 1.0.
37
+	}
38
+}
39
+
40
+
41
+declare function dt {
42
+	SET dtim TO TIME - start.
43
+	return dtim:minute+"m"+dtim:second+"s".
44
+}
45
+
46
+declare function spd {
47
+	if ship:distance < 40000 {
48
+		return ship:velocity:surface:mag.
49
+	} else {
50
+		return ship:velocity:orbit:mag.
51
+	}
52
+}
53
+
54
+SET ctl TO ship:control.
55
+
56
+
57
+SET ctl:MAINTHROTTLE TO 0.0.
58
+LOCK throttle TO 0.0.
59
+print "Ready to orbit at "+wantedALT/1000+"km with TWR " + wantedTWR.
60
+HUDTEXT("Orbit "+wantedALT/1000+"km sequence ready(TWR "+wantedTWR+")", 10, 2, 20, red, false).
61
+HUDTEXT("Waiting 1st stage to run", 10, 2, 20, red, false).
62
+WAIT UNTIL not stage:ready.
63
+WAIT UNTIL ship:maxthrust() <> 0.
64
+HUDTEXT("Orbit sequence started. Lift off in 13s", 2, 2, 20, green, false).
65
+GETVOICE(0):PLAY( LIST(
66
+			SLIDENOTE(300, 320, 0.45, .5), SLIDENOTE(320, 300, 0.42, 0.5),
67
+			SLIDENOTE(300, 320, 0.45, .5), SLIDENOTE(320, 300, 0.42, 0.5),
68
+			SLIDENOTE(300, 320, 0.45, .5), SLIDENOTE(320, 300, 0.42, 0.5))).
69
+
70
+
71
+HUDTEXT("Throttle will be " + round(getTwrThrust(wantedTWR)*100) + "% for TWR " + wantedTWR, 5, 2, 20, green, false).
72
+print "Throttle at takeoff :" + round(getTwrThrust(wantedTWR)*100) + "% for TWR " + wantedTWR.
73
+WAIT 2.0.
74
+HUDTEXT("Moving controls in all directions...", 3, 2, 15, blue, false).
75
+SET ctl:yaw TO -1.0.
76
+SET ctl:pitch TO -1.0.
77
+SET ctl:roll TO -1.0.
78
+WAIT 1.0.
79
+HUDTEXT("So cool !", 3, 2, 12, blue, false).
80
+SET ctl:yaw TO 1.0.
81
+SET ctl:pitch TO 1.0.
82
+SET ctl:roll TO 1.0.
83
+WAIT 1.0.
84
+SET ctl:yaw TO 0.0.
85
+SET ctl:pitch TO 0.0.
86
+SET ctl:roll TO 0.0.
87
+WAIT 1.0.
88
+
89
+DECLARE i TO 10.
90
+UNTIL i < 1 {
91
+	HUDTEXT(i, 1, 2, 20, green, false).
92
+	print i+" " AT (0,7).
93
+	GETVOICE(0):PLAY( NOTE(300, .2) ).
94
+	wait(1.0).
95
+	SET i TO i - 1.
96
+}
97
+
98
+
99
+lock THROTTLE to getTwrThrust(wantedTWR).
100
+HUDTEXT("Lift off !", 2, 2, 20, green, false).
101
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
102
+DECLARE start TO TIME.
103
+print "-----------------------------------------".
104
+print dt() + " Lift off !".
105
+
106
+UNTIL spd() > 1 {
107
+	WAIT 0.1.
108
+}
109
+
110
+HUDTEXT(dt()+" Rotation 0", 2, 2, 20, green, false).
111
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(400, .1) ).
112
+lock STEERING to HEADING(wantedHEAD,90).
113
+print dt() + " Heading "+ wantedHEAD.
114
+
115
+UNTIL spd() > 50 {
116
+	WAIT 0.1.
117
+}
118
+
119
+HUDTEXT(dt()+" Rotation 1", 2, 2, 20, green, false).
120
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
121
+
122
+SET tgt_spd TO 600.
123
+print dt() + " Next rotation at "+tgt_spd+" m/s".
124
+
125
+lock STEERING to HEADING(wantedHEAD,70).
126
+
127
+UNTIL spd() > tgt_spd {
128
+	WAIT 0.1.
129
+}
130
+
131
+HUDTEXT(dt()+" Rotation 2", 2, 2, 20, green, false).
132
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
133
+print dt() + " Last rotation 1000 m/s".
134
+
135
+//declare function endrot {
136
+//	return 60 - ((spd() - tgt_spd) * (60 - 10) / (1000 - tgt_spd)).
137
+//}
138
+//lock STEERING to HEADING(wantedHEAD,endrot()).
139
+//WAIT UNTIL spd() > 1000 or SHIP:ORBIT:APOAPSIS > wantedALT.
140
+//if endrot() >= 10 {
141
+//	LOCK STEERING to HEADING(wantedHEAD, 10).
142
+//} else {
143
+//	LOCK STEERING to ship:prograde.
144
+//}
145
+
146
+UNTIL spd() > 1000 {
147
+	LOCK STEERING to ship:prograde.
148
+	WAIT 0.1.
149
+}
150
+LOCK STEERING to ship:prograde.
151
+
152
+HUDTEXT("Waiting for AP to reach 80km", 5, 2, 20, green, false).
153
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
154
+print dt() + " Waiting for AP to reach "+wantedALT/1000+"km".
155
+
156
+WAIT UNTIL SHIP:ORBIT:APOAPSIS > wantedALT.
157
+
158
+HUDTEXT("Apoapsis 100km reached", 5, 2, 20, green, false).
159
+GETVOICE(0):PLAY( LIST(NOTE(300, .1),NOTE(400, .2),NOTE(400, 0.2), NOTE(220,0.2)) ).
160
+
161
+UNLOCK throttle.
162
+SET ctl:MAINTHROTTLE TO 0.0.
163
+LOCK THROTTLE to 0.0.
164
+LOCK steering TO ship:prograde.
165
+print dt() + " Engine cut-off".
166
+print dt() + " Waiting for AP. ETA : " + ROUND(ETA:APOAPSIS) + "s".
167
+
168
+// TODO : calculate timeout given TWR
169
+SET ins_alrm TO addAlarm("Maneuver",time:seconds+(ETA:APOAPSIS - maneuver_prep + 0.6), "[kOS] "+(wantedALT/1000)+"km orbit insertion", "Targeting "+(wantedALT/1000)+"km").
170
+
171
+WAIT UNTIL MOD(round(eta:apoapsis), 5) = 0.
172
+UNTIL ETA:APOAPSIS < maneuver_prep {
173
+	if wantedALT - SHIP:ORBIT:APOAPSIS > 100 {
174
+		LOCK throttle TO 1.0.
175
+		WAIT UNTIL SHIP:ORBIT:APOAPSIS > wantedALT.
176
+		LOCK throttle TO 0.0.
177
+	}
178
+	if MOD(round(ETA:APOAPSIS), 5) = 0 {
179
+		HUDTEXT("Time to apoapsis " + round(eta:apoapsis) + "s", 5, 2, 20, green, false).
180
+		HUDTEXT("Time to insertion maneuver " + round(eta:apoapsis) - maneuver_prep + "s", 5, 2, 20, green, false).
181
+	}
182
+	WAIT .3.
183
+}
184
+DELETEALARM(ins_alrm:id).
185
+
186
+LOCK steering TO ship:prograde.
187
+DECLARE prev_ETA to ETA:APOAPSIS.
188
+LOCK throttle TO 1.0.
189
+SET throt TO SHIP:CONTROL:MAINTHROTTLE.
190
+SET throt_min TO 0.7.
191
+SET throt_brk TO 0.2.
192
+
193
+print dt() + " Starting insertion".
194
+GETVOICE(0):PLAY( NOTE(300, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(400, .2) ).
195
+HUDTEXT("Starting insertion", 5, 2, 20, green, false).
196
+
197
+// TODO : Problem occurs when there is stages left to drop
198
+// causing wrong estimation overtaking AP
199
+UNTIL SHIP:ORBIT:PERIAPSIS > wantedALT {
200
+	SET dETA TO ETA:APOAPSIS - prev_ETA.
201
+	if ETA:APOAPSIS > 120 {
202
+		print dt() + " AP behind us ! Full thrust to safe orbit !".
203
+		HUDTEXT("AP behind us ! Full thrust for orbit !", 0.1 ,2,20, red, false).
204
+		SET throt TO 1.0.
205
+		WAIT UNTIL SHIP:ORBIT:PERIAPSIS > 68000.
206
+		HUDTEXT("Wrong orbitreached "+dt(), 25, 2, 20, red, false).
207
+		break.
208
+	} else {
209
+		if dETA < 0 {
210
+			SET throt to throt + 0.0005.
211
+			if throt > 1.0 {
212
+				print dt() + "Node approach, notenough thrust !!".
213
+				SET throt TO 1.0.
214
+				WAIT 1.0.
215
+			}
216
+			if throt < throt_min - throt_brk {
217
+				GETVOICE(0):PLAY( SLIDENOTE(220,250, .3, .3) ).
218
+				set throt to throt_min.
219
+			} else {
220
+				//GETVOICE(0):PLAY( NOTE(300 + ((throt - .5) * 500), .1) ).
221
+			}
222
+		}
223
+		if dETA > 0 {
224
+			SET throt TO throt - 0.0005.
225
+			if throt < 0.0 {
226
+				print "Failing ! Node escape, WTF !!".
227
+				SET throt TO 0.
228
+			} else {
229
+				if throt < throt_min - throt_brk AND ETA:APOAPSIS > 10
230
+				{
231
+					// Breaking !
232
+					GETVOICE(0):PLAY( SLIDENOTE(250, 220, .3, .3) ).
233
+					SET throt TO 0.
234
+					LOCK throttle TO 0.
235
+					print "AP ETA " + round(ETA:APOAPSIS,1) + "s throttle BREAK" AT (0, terminal:height - 1).
236
+					if ETA:APOAPSIS > 20 {
237
+						WAIT((ETA:APOAPSIS / 3.5)-0.1).
238
+					} else {
239
+						if ETA:APOAPSIS > 10 {
240
+							WAIT 1.0.
241
+						}
242
+					}
243
+				} else {
244
+					//GETVOICE(0):PLAY( NOTE(300 + ((throt - .5) * 500), .1) ).
245
+				}
246
+			}
247
+		}
248
+	}
249
+	//SET SHIP:CONTROL:MAINTHROTTLE TO throt.
250
+	//SET SHIP:CONTROL:PILOTMAINTHROTTLE TO throt.
251
+	LOCK throttle TO throt.
252
+	//LOCK throttle TO throt.
253
+	SET prev_ETA to ETA:APOAPSIS.
254
+	print "AP ETA " + round(ETA:APOAPSIS,1) + "s throttle "+ round(throt * 100) + "%   " AT (0, terminal:height - 1).
255
+	//HUDTEXT("AP ETA " + ETA:APOAPSIS + "s throttle "+ throt * 100 + "%", 0.1,2,20, green, false).
256
+	WAIT 0.
257
+}
258
+
259
+
260
+print dt() + " Orbiting !".
261
+HUDTEXT("Orbiting after "+dt(), 15, 2, 20, green, false).
262
+HUDTEXT("programs exiting...", 15, 2, 20, red, false).
263
+GETVOICE(0):PLAY( LIST(
264
+			SLIDENOTE(300, 320, 0.3, .3), SLIDENOTE(320, 300, 0.3, 0.3),
265
+			SLIDENOTE(300, 320, 0.3, .3), SLIDENOTE(320, 300, 0.3, 0.3),
266
+			SLIDENOTE(300, 320, 0.3, .3), SLIDENOTE(320, 300, 0.3, 0.3))).
267
+
268
+unlock STEERING.
269
+unlock throttle.
270
+SET SHIP:CONTROL:MAINTHROTTLE TO 0.0.
271
+SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0.0.

BIN
orbit.ksm View File


+ 55
- 0
stager.ks View File

@@ -0,0 +1,55 @@
1
+clearscreen.
2
+declare function dt {
3
+	SET dtim TO TIME - start.
4
+	return dtim:minute+"m"+dtim:second+"s".
5
+}
6
+
7
+SET terminal:width TO 22.
8
+SET terminal:height TO 12.
9
+
10
+SET GETVOICE(1):wave to "sine".
11
+SET GETVOICE(1):volume to 1.
12
+SET GETVOICE(1):decay to 0.05.
13
+SET GETVOICE(1):attack to 0.05.
14
+SET GETVOICE(1):sustain to 1.0.
15
+SET GETVOICE(1):release to 0.8.
16
+
17
+print "======================".
18
+print "    Simple stager".
19
+print "======================".
20
+
21
+// TODO : detect launcher stability enhancer
22
+// TODO : detect empty fuel stages
23
+
24
+
25
+HUDTEXT("Stager ready. Waiting 1st stage...", 10, 2, 20, red, false).
26
+print "Waiting takeoff...".
27
+GETVOICE(1):PLAY( LIST(NOTE(400, .1), NOTE(300, .2)) ).
28
+WAIT UNTIL not stage:ready.
29
+print "Lets go !".
30
+DECLARE start TO TIME.
31
+print dt() + " Stage #"+stage:number.
32
+
33
+LIST ENGINES IN elist.
34
+UNTIL ship:obt:periapsis > 60000 AND stage:number > 0{
35
+
36
+	FOR e IN elist {
37
+		if e:flameout AND e:stage = stage:number
38
+		{
39
+			STAGE.
40
+			GETVOICE(1):PLAY( SLIDENOTE(220,320, 0.6, 0.7) ).
41
+			PRINT dt() + " Stage #" + stage:number.
42
+			HUDTEXT(dt() + " Stage #" + stage:number, 3, 2, 15, blue, false).
43
+			WAIT UNTIL STAGE:READY.
44
+			WAIT 1.0.
45
+			GETVOICE(1):PLAY( LIST(NOTE(400, .1), NOTE(300, .2)) ).
46
+			LIST ENGINES IN elist.
47
+			WAIT 1.0.
48
+		}
49
+	}
50
+	wait 0.
51
+}
52
+
53
+HUDTEXT("[Stager] Orbit detected. Exiting...", 10, 2, 20, blue, false).
54
+print dt() + " Orbit detected".
55
+print "exiting...".

+ 1
- 0
test/hello.ks View File

@@ -0,0 +1 @@
1
+print "HELLO WORLD !".

+ 182
- 0
test/orbit1.ks View File

@@ -0,0 +1,182 @@
1
+print "===============================".
2
+print "Ready to orbit ! Liftoff in 15s".
3
+print "===============================".
4
+SET wantedTWR TO 1.5.
5
+
6
+HUDTEXT("Orbit sequence started. Lift off in 15s", 2, 2, 20, green, false).
7
+GETVOICE(0):PLAY( NOTE(300, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(400, .2) ).
8
+
9
+SET GETVOICE(0):wave to "sawtooth".
10
+
11
+declare function LocalG {
12
+	// Return local gravity
13
+	return ship:body:mu / ship:body:position:mag ^ 2.
14
+}
15
+
16
+declare function getTwrThrust {
17
+	// Estimate thrust for a given TWR (1.5 by default)
18
+	DECLARE PARAMETER TWR is 1.5.
19
+	set m to ship:mass.
20
+	set w to m * LocalG().
21
+	set p to ship:sensors:pres / 100.
22
+	set t to ship:maxthrustat(p).
23
+	set throt to (TWR * w) / t.
24
+	return throt.
25
+}
26
+
27
+SET ctl TO ship:control.
28
+WAIT 2.0.
29
+SET ctl:yaw TO -1.0.
30
+SET ctl:pitch TO -1.0.
31
+SET ctl:roll TO -1.0.
32
+WAIT 1.0.
33
+SET ctl:yaw TO 1.0.
34
+SET ctl:pitch TO 1.0.
35
+SET ctl:roll TO 1.0.
36
+HUDTEXT("Wanted TWR = " + wantedTWR, 2, 2, 20, green, false).
37
+WAIT 1.0.
38
+SET ctl:yaw TO 0.0.
39
+SET ctl:pitch TO 0.0.
40
+SET ctl:roll TO 0.0.
41
+set ctl:MAINTHROTTLE TO 0.0.
42
+WAIT 1.0.
43
+lock THROTTLE to 0.0.
44
+
45
+DECLARE i TO 10.
46
+UNTIL i < 1 {
47
+	HUDTEXT(i, 1, 2, 20, green, false).
48
+	print i.
49
+	GETVOICE(0):PLAY( NOTE(300, .2) ).
50
+	wait(1.0).
51
+	SET i TO i - 1.
52
+	if i = 2 {
53
+		// Stage 2s before lift off
54
+		STAGE.
55
+		print "Stage !".
56
+		HUDTEXT("Throttle set to " + round(getTwrThrust(wantedTWR)*100) + "% for TWR " + wantedTWR, 2, 2, 20, green, false).
57
+		print "Throttle set to " + round(getTwrThrust(wantedTWR)*100) + "% for TWR " + wantedTWR.
58
+	}
59
+}
60
+
61
+
62
+
63
+
64
+
65
+HUDTEXT("Lift off !", 2, 2, 20, green, false).
66
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
67
+
68
+
69
+print "Lift off !".
70
+lock THROTTLE to getTwrThrust(wantedTWR).
71
+
72
+
73
+
74
+UNTIL SHIP:VERTICALSPEED > 20 {
75
+	WAIT 0.1.
76
+}
77
+
78
+HUDTEXT("Rotation 0", 2, 2, 20, green, false).
79
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(400, .1) ).
80
+lock STEERING to HEADING(90,90).
81
+
82
+UNTIL SHIP:VERTICALSPEED > 50 {
83
+	WAIT 0.1.
84
+}
85
+
86
+HUDTEXT("Rotation 1", 2, 2, 20, green, false).
87
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
88
+print "Next rotation at speed 600".
89
+
90
+lock STEERING to HEADING(90,70).
91
+
92
+UNTIL SHIP:GROUNDSPEED + SHIP:VERTICALSPEED > 600 {
93
+	WAIT 0.1.
94
+}
95
+
96
+HUDTEXT("Rotation 2", 2, 2, 20, green, false).
97
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
98
+
99
+declare function endrot {
100
+	set spd to SHIP:GROUNDSPEED + SHIP:VERTICALSPEED.
101
+	return 60 - ((spd - 600) * 60 / 1000)
102
+}
103
+lock STEERING to HEADING(90,endrot()).
104
+
105
+UNTIL SHIP:GROUNDSPEED + SHIP:VERTICALSPEED > 1000 {
106
+	WAIT 0.1.
107
+}
108
+lock STEERING to HEADING(90,0).
109
+
110
+HUDTEXT("Rotation 3", 2, 2, 20, green, false).
111
+GETVOICE(0):PLAY( NOTE(400, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(300, .2) ).
112
+lock steering to HEADING(90,30).
113
+print "Waiting for AP to reach 80km".
114
+
115
+UNTIL SHIP:ORBIT:APOAPSIS > 80000 {
116
+	WAIT 0.1.
117
+}
118
+
119
+HUDTEXT("Apoapsis 100km reached", 5, 2, 20, green, false).
120
+GETVOICE(0):PLAY( NOTE(300, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(400, .2) ).
121
+
122
+lock THROTTLE to 0.0.
123
+set ctl:MAINTHROTTLE TO 0.0.
124
+print "Waiting for AP".
125
+print ETA:APOAPSIS.
126
+
127
+UNTIL ETA:APOAPSIS < 50 {
128
+	print "Time to apoapsis : ".
129
+	HUDTEXT("Time to apoapsis", 5, 2, 20, green, false).
130
+	HUDTEXT(ETA:APOASPSIS, 5, 2, 20, green, false).
131
+	print ETA:APOAPSIS.
132
+	WAIT 10.0.
133
+}
134
+
135
+
136
+HUDTEXT("Preparing insertion", 5, 2, 20, green, false).
137
+GETVOICE(0):PLAY( NOTE(300, .1) ).wait(0.1).GETVOICE(0):PLAY( NOTE(400, .2) ).
138
+
139
+LOCK steering TO ship:prograde.
140
+
141
+UNTIL ETA:APOAPSIS < 30 {
142
+	print "Time to apoapsis : ".
143
+	print ETA:APOAPSIS.
144
+	WAIT 1.0.
145
+}
146
+
147
+
148
+DECLARE prev_ETA to ETA:APOAPSIS.
149
+SET aETA TO ETA:APOAPSIS.
150
+
151
+SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 1.0.
152
+SET throt TO SHIP:CONTROL:PILOTMAINTHROTTLE.
153
+
154
+UNTIL SHIP:ORBIT:PERIAPSIS > 80000 {
155
+	if aETA - prev_ETA < 0 {
156
+		if throt = 1.0 {
157
+			print "Failing ! Node approach, notenough thrust !!".
158
+		} else {
159
+			LOCK throttle TO throt + 0.1.
160
+			GETVOICE(0):PLAY( NOTE(300, .1) ).
161
+		}
162
+	}
163
+	if aETA - prev_ETA > 0 {
164
+		if throt = 0.0 {
165
+			print "Failing ! Node escape, WTF !!".
166
+		} else {
167
+			LOCK throttle TO throt - 0.1.
168
+			GETVOICE(0):PLAY( NOTE(400, .1) ).
169
+		}
170
+	}
171
+	WAIT 0.1.
172
+}
173
+
174
+HUDTEXT("Orbiting :D", 5, 2, 20, green, false).
175
+GETVOICE(0):PLAY( NOTE(300, .1) ).wait(0.1).
176
+GETVOICE(0):PLAY( NOTE(300, .1) ).wait(0.1).
177
+GETVOICE(0):PLAY( NOTE(400, .2) ).
178
+
179
+unlock STEERING.
180
+set ctl:MAINTHROTTLE TO 0.0.
181
+unlock THROTTLE.
182
+

BIN
test/orbit1.ksm View File


Loading…
Cancel
Save