forked from FeistyBilla/billa-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launcher.ks
125 lines (117 loc) · 2.61 KB
/
launcher.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// SCRIPT TO LAUNCH AND CIRCULARIZE FROM KERBIN
//VARIABLES
SET launch_count TO 3.
SET v_throttle TO 0.3.
SET angle_of_the_dangle TO 90.
SET let_em_fly TO 0.
//FUNCTIONS
FUNCTION drop_it_like_it_is_hot {
IF (MAXTHRUST = 0 AND let_em_fly = 1) {
STAGE.
PRINT "JETTISONED SPENT STAGE".
PRINT " ".
}
}
FUNCTION steer_it {
SET angle_of_the_dangle TO (90 * (0.9 - ALTITUDE / 25000)).
LOCK STEERING TO HEADING (90,angle_of_the_dangle).
IF ALTITUDE > 20000 {
SET angle_of_the_dangle TO 20.
LOCK STEERING TO HEADING (90,angle_of_the_dangle).
}
}
FUNCTION throttle_it {
PARAMETER howfast.
IF (SHIP:SURFACESPEED > howfast AND v_throttle > 0.) {
SET v_throttle TO v_throttle - 0.5.
} ELSE IF v_throttle < 1 {
SET v_throttle TO v_throttle + 0.5.
}
LOCK THROTTLE TO v_throttle.
}
//FAKE PRE-FLIGHT CHECK OUTPUT
WAIT 1.
CLEARSCREEN.
WAIT 1.
PRINT "=========================".
PRINT "STARTING LAUNCH SEQUENCE".
PRINT "=========================".
PRINT " ".
WAIT 1.5.
PRINT "CHECKING SYSTEMS...".
PRINT " ".
WAIT 2.
PRINT "STATUS IS SLIGHTLY BETTER THAN OK".
PRINT " ".
WAIT 0.5.
PRINT SHIP:NAME + " IS READY FOR LAUNCH...".
PRINT " ".
WAIT 1.
//COUNTDOWN & LAUNCH
UNTIL launch_count = 0 {
PRINT "T-" + launch_count + "...".
PRINT " ".
SET launch_count TO launch_count -1.
IF launch_count = 1 {
}
WAIT 1.
}
SET SHIP:CONTROL:MAINTHROTTLE TO 0.
PRINT "START ENGINES AND RELEASE STABALIZERS".
PRINT " ".
LOCK THROTTLE TO 1.
STAGE.
SET let_em_fly TO 1.
PRINT SHIP:NAME + " IS AWAY".
PRINT " ".
//MOVIN' ON UP
WAIT UNTIL SHIP:ALTITUDE > 200.
PRINT "STARTING TURN".
PRINT " ".
WAIT 0.5.
LOCK STEERING TO HEADING (90,90).
WAIT 5.
UNTIL SHIP:APOAPSIS > 80000 {
UNTIL SHIP:ALTITUDE > 45000 {
IF SHIP:SURFACESPEED > 400 {
throttle_it((400 + (SHIP:ALTITUDE / 10)) / 3).
//PRINT "SURFACE SPEED = " + ROUND(SHIP:SURFACESPEED) + "M/S LIMIT = " + ROUND((300 + (SHIP:ALTITUDE / 10)) / 3.25) + "M/S".
}
steer_it().
drop_it_like_it_is_hot().
WAIT 0.2.
}
LOCK THROTTLE TO 1.
steer_it().
drop_it_like_it_is_hot().
WAIT 0.2.
}
LOCK THROTTLE TO 0.
LOCK STEERING TO PROGRADE.
PRINT "COASTING TO APOAPSIS".
PRINT " ".
//CIRCULARIZE
WAIT UNTIL SHIP:ALTITUDE > 70000.
WAIT 1.
PRINT "LEAVING " + BODY:NAME + " ATMOSPHERE".
PRINT " ".
PRINT "EXTENDING SOLAR PANELS AND POWERING LIGHTS".
PRINT " ".
WAIT 1.
ABORT ON.
PRINT "PREPARING FOR CIRCULARIZATION BURN".
PRINT " ".
WAIT UNTIL ETA:APOAPSIS < 8.
PRINT "CIRCULARIZATION BURN".
PRINT " ".
LOCK THROTTLE TO 1.
UNTIL SHIP:PERIAPSIS > 75000 {
drop_it_like_it_is_hot().
WAIT 0.1.
}
LOCK THROTTLE TO 0.
PRINT "YOU ARE NOW ORBITING KERBIN".
PRINT " ".
PRINT "SHUTTING DOWN PROGRAM".
PRINT " ".
WAIT 5.