-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_functions.ks
More file actions
208 lines (197 loc) · 5.93 KB
/
deploy_functions.ks
File metadata and controls
208 lines (197 loc) · 5.93 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
function deploy_fairing
{
for p in ship:parts
{
if p:hasmodule("moduleproceduralfairing")
{
until (alt:radar > 55000) wait 0.1.
print "Fairing Jettison".
local decoupler is p:getmodule("moduleproceduralfairing").
if decoupler:hasevent("deploy") decoupler:doevent("deploy").
break.
}
}
}
function deploy_solar_panels
{
local check is false.
for p in ship:parts
{
if p:hasmodule("moduledeployablesolarpanel")
{
local panel is p:getmodule("moduledeployablesolarpanel").
if panel:hasevent("extend solar panel")
{
panel:doevent("extend solar panel").
set check to true.
}
}
}
if (check = true)
{
print "Extending Solar Panels".
wait 5.
}
}
function retract_solar_panels
{
local check is false.
for p in ship:parts
{
if p:hasmodule("moduledeployablesolarpanel")
{
local panel is p:getmodule("moduledeployablesolarpanel").
if panel:hasevent("retract solar panel")
{
panel:doevent("retract solar panel").
set check to true.
}
}
}
if (check = true)
{
print "Retracting Solar Panels".
wait 5.
}
}
function deploy_antenna
{
for p in ship:parts
{
if p:hasmodule("moduledeployableantenna")
{
local dish is p:getmodule("moduledeployableantenna").
if dish:hasevent("extend antenna")
{
print "Extending Antenna".
dish:doevent("extend antenna").
wait 5.
}
}
}
}
function deploy_bay_doors
{
parameter mode is "toggle".
for p in ship:parts
{
if p:hasmodule("moduleanimategeneric")
{
if (mode = "toggle") {
print "Toggling Cargo Bay Doors".
local dp is p:getmodule("moduleanimategeneric").
if dp:hasevent("open bay doors") dp:doevent("open bay doors").
else if dp:hasevent("retract bay doors") dp:doevent("retract bay doors").
}
else if (mode = "open") {
print "Opening Cargo Bay Doorsd".
local dp is p:getmodule("moduleanimategeneric").
if dp:hasevent("open bay doors") dp:doevent("open bay doors").
}
else if (mode = "close") {
print "Closing Cargo Bay Doors".
local dp is p:getmodule("moduleanimategeneric").
if dp:hasevent("retract bay doors") dp:doevent("retract bay doors").
}
}
}
wait 5.
}
function deploy_dp_shield
{
parameter mode is "toggle".
for p in ship:parts
{
if (p:tag = "docker" or p:tag = "undocker")
{
if p:hasmodule("moduleanimategeneric")
{
if (mode = "toggle") {
print "Toggling Docking Port Shield".
local dp is p:getmodule("moduleanimategeneric").
if dp:hasevent("open shield") dp:doevent("open shield").
else if dp:hasevent("close shield") dp:doevent("close shield").
else if dp:hasevent("open docking shield") dp:doevent("open docking shield").
else if dp:hasevent("close docking shield") dp:doevent("close docking shield").
else if dp:hasevent("open") dp:doevent("open").
else if dp:hasevent("close") dp:doevent("close").
else if dp:hasevent("deploy docking port") dp:doevent("deploy docking port").
else if dp:hasevent("retract docking port") dp:doevent("retract docking port").
}
else if (mode = "open") {
print "Opening Docking Port Shield".
local dp is p:getmodule("moduleanimategeneric").
if dp:hasevent("open shield") dp:doevent("open shield").
else if dp:hasevent("open docking shield") dp:doevent("open docking shield").
else if dp:hasevent("open") dp:doevent("open").
else if dp:hasevent("deploy docking port") dp:doevent("deploy docking port").
}
else if (mode = "close") {
print "Closing Docking Port Shield".
local dp is p:getmodule("moduleanimategeneric").
if dp:hasevent("close shield") dp:doevent("close shield").
else if dp:hasevent("close docking shield") dp:doevent("close docking shield").
else if dp:hasevent("close") dp:doevent("close").
else if dp:hasevent("retract docking port") dp:doevent("retract docking port").
}
wait 5.
}
}
}
}
function deploy_payload
{
// pass name of payload decoupler - need to set this in VAB and adjust script to call
parameter dname.
for p in ship:parts
{
if (p:tag = dname)
{
print "Deploying Payload".
if (p:hasmodule("moduledecouple")) p:getmodule("moduledecouple"):doevent("decouple").
else p:undock.
wait 5.
}
}
}
function activate_engines
{
parameter tlimit is 100.
lock throttle to 0.
list engines in ship_engines.
for en in ship_engines
{
if (en:tag <> "en1")
{
if not en:ignition en:activate.
set en:thrustlimit to tlimit.
}
}
wait 5.
}
function deploy_gear
{
if (rover_lander = False) Gear on.
else
{
AG3.
Gear on.
wait 1.5.
AG1 on.
wait 1.
AG2 on.
}
}
function retract_gear
{
if (rover_lander = False) Gear off.
else
{
AG2 on.
Gear Off.
wait 1.
AG1 on.
wait 1.
AG3.
}
}