Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
276 lines (250 loc) · 9.12 KB

File metadata and controls

276 lines (250 loc) · 9.12 KB
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
--linear constant 65536
include "constants.lua"
local base, torso, head = piece('base', 'torso', 'head')
local rthigh, rshin, rfoot, lthigh, lshin, lfoot = piece('rthigh', 'rshin', 'rfoot', 'lthigh', 'lshin', 'lfoot')
local lturret, rturret, lflare, rflare = piece('lturret', 'rturret', 'lflare', 'rflare')
local firepoints = {[0] = lflare, [1] = rflare}
local smokePiece = {torso}
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
local PACE = 2
local THIGH_FRONT_ANGLE = -math.rad(50)
local THIGH_FRONT_SPEED = math.rad(60) * PACE
local THIGH_BACK_ANGLE = math.rad(30)
local THIGH_BACK_SPEED = math.rad(60) * PACE
local SHIN_FRONT_ANGLE = math.rad(45)
local SHIN_FRONT_SPEED = math.rad(90) * PACE
local SHIN_BACK_ANGLE = math.rad(10)
local SHIN_BACK_SPEED = math.rad(90) * PACE
local ARM_FRONT_ANGLE = -math.rad(20)
local ARM_FRONT_SPEED = math.rad(22.5) * PACE
local ARM_BACK_ANGLE = math.rad(10)
local ARM_BACK_SPEED = math.rad(22.5) * PACE
local FOREARM_FRONT_ANGLE = -math.rad(40)
local FOREARM_FRONT_SPEED = math.rad(45) * PACE
local FOREARM_BACK_ANGLE = math.rad(10)
local FOREARM_BACK_SPEED = math.rad(45) * PACE
local SIG_WALK = 1
local SIG_AIM = {2, 4}
local SIG_RESTORE = 8
local unitDefID = Spring.GetUnitDefID(unitID)
local wd = UnitDefs[unitDefID].weapons[1] and UnitDefs[unitDefID].weapons[1].weaponDef
local reloadTime = wd and WeaponDefs[wd].reload*30 or 30
local torpRange = WeaponDefNames["amphskirm_torpedo"].range
local shotRange = WeaponDefNames["amphskirm_torpmissile"].range
local longRange = true
local ROCKET_DEPTH = -32
local recoil = -1.1
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
local gun_1 = 0
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
local function Walk()
Signal(SIG_WALK)
SetSignalMask(SIG_WALK)
while true do
--Spring.Echo("Left foot up, right foot down")
Turn(lthigh, x_axis, math.rad(20), math.rad(120)*PACE)
Turn(lshin, x_axis, math.rad(-60), math.rad(140)*PACE)
Turn(lfoot, x_axis, math.rad(40), math.rad(210)*PACE)
Turn(rthigh, x_axis, math.rad(-20), math.rad(210)*PACE)
Turn(rshin, x_axis, math.rad(50), math.rad(210)*PACE)
Turn(rfoot, x_axis, math.rad(-30), math.rad(210)*PACE)
Turn(torso, z_axis, math.rad(-5), math.rad(20)*PACE)
Turn(lthigh, z_axis, math.rad(5), math.rad(20)*PACE)
Turn(rthigh, z_axis, math.rad(5), math.rad(420)*PACE)
Move(torso, y_axis, 4, 9*PACE)
WaitForMove(torso, y_axis)
Sleep(0) -- needed to prevent anim breaking, DO NOT REMOVE
--Spring.Echo("Right foot middle, left foot middle")
Turn(lthigh, x_axis, math.rad(-10), math.rad(160)*PACE)
Turn(lshin, x_axis, math.rad(-40), math.rad(250)*PACE)
Turn(lfoot, x_axis, math.rad(50), math.rad(140)*PACE)
Turn(rthigh, x_axis, math.rad(40), math.rad(140)*PACE)
Turn(rshin, x_axis, math.rad(-40), math.rad(140)*PACE)
Turn(rfoot, x_axis, math.rad(0), math.rad(140)*PACE)
Move(torso, y_axis, 0, 12*PACE)
WaitForMove(torso, y_axis)
Sleep(0)
--Spring.Echo("Right foot up, Left foot down")
Turn(rthigh, x_axis, math.rad(20), math.rad(120)*PACE)
Turn(rshin, x_axis, math.rad(-60), math.rad(140)*PACE)
Turn(rfoot, x_axis, math.rad(40), math.rad(210)*PACE)
Turn(lthigh, x_axis, math.rad(-20), math.rad(210)*PACE)
Turn(lshin, x_axis, math.rad(50), math.rad(210)*PACE)
Turn(lfoot, x_axis, math.rad(-30), math.rad(420)*PACE)
Turn(torso, z_axis, math.rad(5), math.rad(20)*PACE)
Turn(lthigh, z_axis, math.rad(-5), math.rad(20)*PACE)
Turn(rthigh, z_axis, math.rad(-5), math.rad(20)*PACE)
Move(torso, y_axis, 4, 9*PACE)
WaitForMove(torso, y_axis)
Sleep(0)
--Spring.Echo("Left foot middle, right foot middle")
Turn(rthigh, x_axis, math.rad(-10), math.rad(160)*PACE)
-- Turn(rknee, x_axis, math.rad(15), math.rad(135)*PACE)
Turn(rshin, x_axis, math.rad(-40), math.rad(250)*PACE)
Turn(rfoot, x_axis, math.rad(50), math.rad(140)*PACE)
Turn(lthigh, x_axis, math.rad(40), math.rad(140)*PACE)
-- Turn(lknee, x_axis, math.rad(-35), math.rad(135))
Turn(lshin, x_axis, math.rad(-40), math.rad(140)*PACE)
Turn(lfoot, x_axis, math.rad(0), math.rad(140)*PACE)
Move(torso, y_axis, 0, 12*PACE)
WaitForMove(torso, y_axis)
Sleep(0)
end
end
local function GunRecoilThread(num)
if num == 0 then
Move(lturret, y_axis, recoil)
Move(lturret, x_axis, recoil/2)
else
Move(rturret, y_axis, recoil)
Move(rturret, x_axis, recoil/2)
end
Sleep(200)
if num == 0 then
Move(lturret, y_axis, 0, 1.1)
Move(lturret, x_axis, 0, 0.55)
else
Move(rturret, y_axis, 0, 1.1)
Move(rturret, x_axis, 0, 0.55)
end
end
local function Stopping()
Signal(SIG_WALK)
SetSignalMask(SIG_WALK)
Turn(rthigh, x_axis, 0, math.rad(80)*PACE)
Turn(rshin, x_axis, 0, math.rad(120)*PACE)
Turn(rfoot, x_axis, 0, math.rad(80)*PACE)
Turn(lthigh, x_axis, 0, math.rad(80)*PACE)
Turn(lshin, x_axis, 0, math.rad(80)*PACE)
Turn(lfoot, x_axis, 0, math.rad(80)*PACE)
Turn(torso, z_axis, 0, math.rad(20)*PACE)
Move(torso, y_axis, 0, 12*PACE)
end
function script.StartMoving()
StartThread(Walk)
end
function script.StopMoving()
StartThread(Stopping)
end
local function WeaponRangeUpdate()
while true do
local height = select(2, Spring.GetUnitPosition(unitID))
if height < ROCKET_DEPTH then
if longRange then
Spring.SetUnitWeaponState(unitID, 1, {range = torpRange})
Spring.SetUnitMaxRange(unitID, torpRange)
longRange = false
end
elseif not longRange then
Spring.SetUnitWeaponState(unitID, 1, {range = shotRange})
Spring.SetUnitMaxRange(unitID, shotRange)
longRange = true
end
Sleep(200)
end
end
function script.Create()
StartThread(GG.Script.SmokeUnit, unitID, smokePiece)
--StartThread(WeaponRangeUpdate)
end
local function RestoreAfterDelay()
Signal(SIG_RESTORE)
SetSignalMask(SIG_RESTORE)
Sleep(5000)
Turn(head, y_axis, 0, math.rad(65))
Turn(lturret, x_axis, 0, math.rad(47.5))
Turn(rturret, x_axis, 0, math.rad(47.5))
end
function script.AimFromWeapon()
return head
end
function script.AimWeapon(num, heading, pitch)
Signal(SIG_AIM[num])
SetSignalMask(SIG_AIM[num])
Turn(head, y_axis, heading, math.rad(380))
Turn(lturret, x_axis, -pitch, math.rad(160))
Turn(rturret, x_axis, -pitch, math.rad(160))
WaitForTurn(head, y_axis)
WaitForTurn(lturret, x_axis)
WaitForTurn(rturret, x_axis)
StartThread(RestoreAfterDelay)
return true
end
function script.QueryWeapon(num)
return firepoints[gun_1]
end
function script.FireWeapon(num)
local toChange = 3 - num
local reloadSpeedMult = Spring.GetUnitRulesParam(unitID, "totalReloadSpeedChange") or 1
if reloadSpeedMult <= 0 then
-- Safety for div0. In theory a unit with reloadSpeedMult = 0 cannot fire because it never reloads.
reloadSpeedMult = 1
end
local reloadTimeMult = 1/reloadSpeedMult
Spring.SetUnitWeaponState(unitID, toChange, "reloadFrame", Spring.GetGameFrame() + reloadTime*reloadTimeMult)
if num == 2 then
local px, py, pz = Spring.GetUnitPosition(unitID)
if py < -8 then
Spring.PlaySoundFile("sounds/weapon/torpedo/torp_launch_amph_light.wav", 85, px, py, pz)
else
Spring.PlaySoundFile("sounds/weapon/missile/air_launched_missile.wav", 85, px, py, pz)
end
end
end
function script.BlockShot(num, targetID)
if num == 1 then -- surface missiles
return GG.OverkillPrevention_CheckBlock(unitID, targetID, 130, 40, 0, 0)
elseif num == 2 then -- torpedoes
return GG.OverkillPrevention_CheckBlock(unitID, targetID, 130, 40, 0, 0)
end
return false
end
function script.Shot(num)
if num == 1 then
StartThread(GunRecoilThread, gun_1)
end
gun_1 = 1 - gun_1
end
function script.Killed(recentDamage, maxHealth)
local severity = recentDamage/maxHealth
if severity <= .25 then
Explode(lfoot, SFX.NONE)
Explode(lshin, SFX.NONE)
Explode(lthigh, SFX.NONE)
Explode(rfoot, SFX.NONE)
Explode(rshin, SFX.NONE)
Explode(rthigh, SFX.NONE)
Explode(torso, SFX.NONE)
return 1
elseif severity <= .50 then
Explode(lfoot, SFX.FALL)
Explode(lshin, SFX.FALL)
Explode(lthigh, SFX.FALL)
Explode(rfoot, SFX.FALL)
Explode(rshin, SFX.FALL)
Explode(rthigh, SFX.FALL)
Explode(torso, SFX.SHATTER)
return 1
elseif severity <= .99 then
Explode(lfoot, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(lshin, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(lthigh, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(rfoot, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(rshin, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(rthigh, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(torso, SFX.SHATTER)
return 2
else
Explode(lfoot, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(lshin, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(lthigh, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(rfoot, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(rshin, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(rthigh, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
Explode(torso, SFX.SHATTER + SFX.EXPLODE)
return 2
end
end
Morty Proxy This is a proxified and sanitized view of the page, visit original site.