FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Zero-K/scripts/bomberheavy.lua at master · ZeroK-RTS/Zero-K · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ZeroK-RTS
/
Zero-K
Public
Notifications
You must be signed in to change notification settings
Fork
251
Star
824
Code
Issues
1.2k
Pull requests
49
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Zero-K
/
scripts
/
bomberheavy.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
253 lines (206 loc) · 6.16 KB
Breadcrumbs
Zero-K
/
scripts
/
bomberheavy.lua
Copy path
File metadata and controls
253 lines (206 loc) · 6.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
include
"
constants.lua
"
include
"
bombers.lua
"
include
"
fixedwingTakeOff.lua
"
local
spSetUnitRulesParam
=
Spring
.
SetUnitRulesParam
local
base
=
piece
'
base
'
local
wing_L
=
piece
'
wing_L
'
local
wing_R
=
piece
'
wing_R
'
local
drop
=
piece
'
drop
'
local
ball_emit
=
piece
'
ball_emit
'
local
extra_L
=
piece
'
extra_L
'
local
extra_R
=
piece
'
extra_R
'
local
radiator_L
=
piece
'
radiator_L
'
local
radiator_R
=
piece
'
radiator_R
'
local
rad_L
=
piece
'
rad_L
'
--
empty piece for fx
local
rad_R
=
piece
'
rad_R
'
local
hatch_L
=
piece
'
hatch_L
'
local
hatch_R
=
piece
'
hatch_R
'
local
ball
=
piece
'
ball
'
local
thrust_L
,
thrust_R
=
piece
(
'
thrust_L
'
,
'
thrust_R
'
)
local
wingtip_L
,
wingtip_R
=
piece
(
'
wingtip_L
'
,
'
wingtip_R
'
)
local
INLOS
=
{
inlos
=
true
}
local
smokePiece
=
{
base
,
radiator_L
,
radiator_R
}
--
Signal
local
SIG_move
=
1
local
SIG_TAKEOFF
=
2
local
takeoffHeight
=
UnitDefNames
[
"
bomberheavy
"
].
cruiseAltitude
local
function
ShowBall
()
Show
(
ball
)
spSetUnitRulesParam
(
unitID
,
"
ballHalo
"
,
1
,
INLOS
)
--
show halo
Move
(
radiator_L
,
z_axis
,
0
,
2
)
Move
(
radiator_R
,
z_axis
,
0
,
2
)
Move
(
rad_L
,
z_axis
,
-
2
,
2
)
Move
(
rad_R
,
z_axis
,
-
2
,
2
)
Turn
(
hatch_L
,
y_axis
,
math.rad
(
0
),
1
)
Turn
(
hatch_R
,
y_axis
,
math.rad
(
0
),
1
)
Spin
(
ball_emit
,
y_axis
,
math.rad
(
30
))
for
i
=
1
,
15
do
Scale
(
ball
,
math.sin
(
i
/
15
*
1.602
))
Sleep
(
33
)
end
WaitForTurn
(
hatch_L
,
y_axis
)
WaitForTurn
(
hatch_R
,
y_axis
)
Hide
(
radiator_L
)
Hide
(
radiator_R
)
end
local
function
HideBall
()
Hide
(
ball
)
spSetUnitRulesParam
(
unitID
,
"
ballHalo
"
,
0
,
INLOS
)
--
hide halo
Scale
(
ball
,
0
)
Turn
(
ball_emit
,
y_axis
,
0
)
Spin
(
ball_emit
,
y_axis
,
0
)
Show
(
radiator_L
)
Show
(
radiator_R
)
Turn
(
hatch_L
,
y_axis
,
math.rad
(
-
90
),
2
)
Turn
(
hatch_R
,
y_axis
,
math.rad
(
90
),
2
)
Move
(
radiator_L
,
z_axis
,
3
,
1
)
Move
(
radiator_R
,
z_axis
,
3
,
1
)
Move
(
rad_L
,
z_axis
,
3
,
1
)
Move
(
rad_R
,
z_axis
,
3
,
1
)
end
--
add spin?
function
ReammoComplete
()
StartThread
(
ShowBall
)
end
local
function
Land
()
Turn
(
extra_L
,
z_axis
,
math.rad
(
-
30
),
3
)
Turn
(
extra_R
,
z_axis
,
math.rad
(
30
),
3
)
WaitForTurn
(
extra_L
,
z_axis
)
WaitForTurn
(
extra_R
,
z_axis
)
Turn
(
extra_L
,
z_axis
,
math.rad
(
-
146.3
),
2
)
Turn
(
extra_R
,
z_axis
,
math.rad
(
146.3
),
2
)
Move
(
wing_L
,
x_axis
,
-
7
,
6
)
Move
(
wing_R
,
x_axis
,
7
,
6
)
Move
(
wing_L
,
y_axis
,
-
9
,
8
)
Move
(
wing_R
,
y_axis
,
-
9
,
8
)
WaitForTurn
(
extra_L
,
z_axis
)
WaitForTurn
(
extra_R
,
z_axis
)
Move
(
extra_L
,
x_axis
,
-
1
,
3
)
Move
(
extra_R
,
x_axis
,
1
,
3
)
end
local
function
Stopping
()
Signal
(
SIG_move
)
SetSignalMask
(
SIG_move
)
Land
()
end
local
function
Fly
()
Move
(
wing_L
,
x_axis
,
0
,
6
)
Move
(
wing_R
,
x_axis
,
0
,
6
)
Move
(
wing_L
,
y_axis
,
0
,
8
)
Move
(
wing_R
,
y_axis
,
0
,
8
)
Move
(
extra_L
,
x_axis
,
0
,
3
)
Move
(
extra_R
,
x_axis
,
0
,
3
)
Turn
(
extra_L
,
z_axis
,
math.rad
(
-
30
),
2
)
Turn
(
extra_R
,
z_axis
,
math.rad
(
30
),
2
)
WaitForTurn
(
extra_L
,
z_axis
)
WaitForTurn
(
extra_R
,
z_axis
)
Turn
(
extra_L
,
z_axis
,
math.rad
(
0
),
1
)
Turn
(
extra_R
,
z_axis
,
math.rad
(
0
),
1
)
end
local
function
WingStart
()
Move
(
wing_L
,
x_axis
,
-
7
,
0
)
Move
(
wing_R
,
x_axis
,
7
,
0
)
Move
(
wing_L
,
y_axis
,
-
9
,
0
)
Move
(
wing_R
,
y_axis
,
-
9
,
0
)
Turn
(
extra_L
,
z_axis
,
math.rad
(
-
30
),
0
)
Turn
(
extra_R
,
z_axis
,
math.rad
(
30
),
0
)
WaitForTurn
(
extra_L
,
z_axis
)
WaitForTurn
(
extra_R
,
z_axis
)
Turn
(
extra_L
,
z_axis
,
math.rad
(
-
146.3
),
0
)
Turn
(
extra_R
,
z_axis
,
math.rad
(
146.3
),
0
)
WaitForTurn
(
extra_L
,
z_axis
)
WaitForTurn
(
extra_R
,
z_axis
)
Move
(
extra_L
,
x_axis
,
-
1
,
0
)
Move
(
extra_R
,
x_axis
,
1
,
0
)
end
local
function
WingStartOld
()
Turn
(
extra_L
,
z_axis
,
math.rad
(
-
146.3
),
0
)
Turn
(
extra_R
,
z_axis
,
math.rad
(
146.3
),
0
)
Turn
(
wing_L
,
y_axis
,
math.rad
(
-
90
),
0
)
Turn
(
wing_R
,
y_axis
,
math.rad
(
90
),
0
)
WaitForTurn
(
wing_L
,
y_axis
)
WaitForTurn
(
wing_R
,
y_axis
)
Turn
(
wing_L
,
x_axis
,
math.rad
(
6
),
0
)
Turn
(
wing_R
,
x_axis
,
math.rad
(
6
),
0
)
end
local
function
Moving
()
Signal
(
SIG_move
)
SetSignalMask
(
SIG_move
)
Fly
()
end
function
script
.
StartMoving
()
StartThread
(
Moving
)
end
function
script
.
StopMoving
()
StartThread
(
Stopping
)
StartThread
(
GG
.
TakeOffFuncs
.
TakeOffThread
,
unitID
,
takeoffHeight
,
SIG_TAKEOFF
)
end
local
function
ShowBallWhenConstructionFinished
()
local
stunned_or_inbuild
=
Spring
.
GetUnitIsStunned
(
unitID
)
or
(
Spring
.
GetUnitRulesParam
(
unitID
,
"
disarmed
"
)
==
1
)
while
stunned_or_inbuild
do
Sleep
(
100
)
stunned_or_inbuild
=
Spring
.
GetUnitIsStunned
(
unitID
)
or
(
Spring
.
GetUnitRulesParam
(
unitID
,
"
disarmed
"
)
==
1
)
end
ShowBall
()
end
function
script
.
Create
()
Move
(
thrust_L
,
y_axis
,
-
5
)
Move
(
thrust_R
,
y_axis
,
-
5
)
Move
(
wingtip_L
,
y_axis
,
5
)
Move
(
wingtip_R
,
y_axis
,
5
)
Turn
(
thrust_L
,
x_axis
,
math.rad
(
90
))
Turn
(
thrust_R
,
x_axis
,
math.rad
(
90
))
Turn
(
rad_L
,
x_axis
,
math.rad
(
180
))
Turn
(
rad_R
,
x_axis
,
math.rad
(
180
))
Move
(
rad_L
,
z_axis
,
-
2
)
Move
(
rad_R
,
z_axis
,
-
2
)
WingStart
()
Hide
(
ball
)
spSetUnitRulesParam
(
unitID
,
"
ballHalo
"
,
0
,
INLOS
)
--
hide halo
Hide
(
radiator_L
)
Hide
(
radiator_R
)
SetInitialBomberSettings
()
StartThread
(
GG
.
TakeOffFuncs
.
TakeOffThread
,
unitID
,
takeoffHeight
,
SIG_TAKEOFF
)
StartThread
(
GG
.
Script
.
SmokeUnit
,
unitID
,
smokePiece
)
StartThread
(
ShowBallWhenConstructionFinished
)
Spin
(
ball
,
y_axis
,
math.rad
(
30
))
end
function
script
.
FireWeapon
(
num
)
HideBall
()
SetUnarmedAI
()
Sleep
(
50
)
--
delay before clearing attack order; else bomb loses target and fails to home
Reload
()
end
function
script
.
AimWeapon
(
num
)
return
true
end
function
script
.
QueryWeapon
(
num
)
return
ball_emit
end
function
script
.
AimFromWeapon
(
num
)
return
drop
end
function
script
.
BlockShot
(
num
)
return
(
GetUnitValue
(
COB
.
CRASHING
)
==
1
)
or
RearmBlockShot
()
end
function
script
.
Killed
(
recentDamage
,
maxHealth
)
local
severity
=
recentDamage
/
maxHealth
if
severity
<=
.25
then
Explode
(
base
,
SFX
.
NONE
)
Explode
(
wing_L
,
SFX
.
NONE
)
Explode
(
wing_R
,
SFX
.
NONE
)
return
1
elseif
severity
<=
.50
or
((
Spring
.
GetUnitMoveTypeData
(
unitID
).
aircraftState
or
"
"
)
==
"
crashing
"
)
then
Explode
(
wing_L
,
SFX
.
FALL
+
SFX
.
SMOKE
+
SFX
.
FIRE
)
Explode
(
wing_R
,
SFX
.
FALL
+
SFX
.
SMOKE
+
SFX
.
FIRE
)
return
1
elseif
severity
<=
.75
then
Explode
(
wing_L
,
SFX
.
FALL
+
SFX
.
SMOKE
+
SFX
.
FIRE
+
SFX
.
EXPLODE
)
Explode
(
wing_R
,
SFX
.
FALL
+
SFX
.
SMOKE
+
SFX
.
FIRE
+
SFX
.
EXPLODE
)
return
2
else
Explode
(
wing_L
,
SFX
.
FALL
+
SFX
.
SMOKE
+
SFX
.
FIRE
+
SFX
.
EXPLODE
)
Explode
(
wing_R
,
SFX
.
FALL
+
SFX
.
SMOKE
+
SFX
.
FIRE
+
SFX
.
EXPLODE
)
return
2
end
end
Back
|
FazBrowse Home
|
New Git URL