-
Notifications
You must be signed in to change notification settings - Fork 0
/
shuttle.ks
43 lines (32 loc) · 1.18 KB
/
shuttle.ks
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
switch to 0.
run "boot/faito_init.ks".
runoncepath("libfalcon.ks").
set targetOrbit to 80000.
set targetHeading to 90.
//Find the index of the Liquid Fuel and solid fuel in the AggregateResources resources list
set ID_LiquidFuel to getResourceIndex("LIQUIDFUEL").
set ID_SolidFuel to getResourceIndex("SOLIDFUEL").
//Wait until launch
print "Waiting for launch. Press [SPACE] to start.".
WAIT UNTIL ship:status <> "PRELAUNCH".
on ABORT {
set throttle to 0.
unlock steering.
unlock throttle.
set ship:control:pilotmainthrottle to 0.
}
sas off.
// set throttle to 1.
//quick and dirty gravity turn
print "Performing gravity turn...".
lock steering to heading(targetHeading, 90 - ( (ship:orbit:apoapsis / targetOrbit)*90) ).
wait until ship:apoapsis > targetOrbit or stage:resources[ID_SolidFuel]:amount < stage:resources[ID_SolidFuel]:capacity/100.
STAGE.
wait until stage:ready.
wait until ship:apoapsis > targetOrbit or (stage:resources[ID_LiquidFuel]:amount / stage:resources[ID_LiquidFuel]:capacity) * 100 < 4.8.
// set throttle to 0.
// set ship:control:pilotmainthrottle to 0.
wait 0.5.
STAGE.
wait until stage:ready.
print "Done.".