forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaeonunits.lua
More file actions
335 lines (290 loc) · 12.1 KB
/
aeonunits.lua
File metadata and controls
335 lines (290 loc) · 12.1 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
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
--****************************************************************************
--**
--** File : /lua/aeonunits.lua
--** Author(s): John Comes, Gordon Duclos
--**
--** Summary :
--**
--** Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
----------------------------------------------------------------------------
-- AEON DEFAULT UNITS
----------------------------------------------------------------------------
local DefaultUnitsFile = import('defaultunits.lua')
local FactoryUnit = DefaultUnitsFile.FactoryUnit
local AirFactoryUnit = DefaultUnitsFile.AirFactoryUnit
local AirStagingPlatformUnit = DefaultUnitsFile.AirStagingPlatformUnit
local AirUnit = DefaultUnitsFile.AirUnit
local ConcreteStructureUnit = DefaultUnitsFile.ConcreteStructureUnit
local ConstructionUnit = DefaultUnitsFile.ConstructionUnit
local EnergyCreationUnit = DefaultUnitsFile.EnergyCreationUnit
local EnergyStorageUnit = DefaultUnitsFile.EnergyStorageUnit
local LandFactoryUnit = DefaultUnitsFile.LandFactoryUnit
local MassCollectionUnit = DefaultUnitsFile.MassCollectionUnit
local MassFabricationUnit = DefaultUnitsFile.MassFabricationUnit
local MassStorageUnit = DefaultUnitsFile.MassStorageUnit
local RadarUnit = DefaultUnitsFile.RadarUnit
local SeaFactoryUnit = DefaultUnitsFile.SeaFactoryUnit
local ShieldHoverLandUnit = DefaultUnitsFile.ShieldHoverLandUnit
local ShieldLandUnit = DefaultUnitsFile.ShieldLandUnit
local ShieldStructureUnit = DefaultUnitsFile.ShieldStructureUnit
local SonarUnit = DefaultUnitsFile.SonarUnit
local StructureUnit = DefaultUnitsFile.StructureUnit
local QuantumGateUnit = DefaultUnitsFile.QuantumGateUnit
local RadarJammerUnit = DefaultUnitsFile.RadarJammerUnit
local TransportBeaconUnit = DefaultUnitsFile.TransportBeaconUnit
local WalkingLandUnit = DefaultUnitsFile.WalkingLandUnit
local WallStructureUnit = DefaultUnitsFile.WallStructureUnit
local EffectTemplate = import('/lua/EffectTemplates.lua')
local EffectUtil = import('/lua/EffectUtilities.lua')
local CreateAeonFactoryBuildingEffects = EffectUtil.CreateAeonFactoryBuildingEffects
---------------------------------------------------------------
-- FACTORIES
---------------------------------------------------------------
AFactoryUnit = Class(FactoryUnit) {
StartBuildFx = function(self, unitBeingBuilt)
local thread = self:ForkThread(CreateAeonFactoryBuildingEffects, unitBeingBuilt, self.BuildEffectBones, 'Attachpoint', self.BuildEffectsBag)
unitBeingBuilt.Trash:Add(thread)
end,
OnPaused = function(self)
-- When factory is paused take some action
if self:IsUnitState('Building') and self.unitBeingBuilt then
self:StopUnitAmbientSound('ConstructLoop')
StructureUnit.StopBuildingEffects(self, self.UnitBeingBuilt)
self:StartBuildFx(self:GetFocusUnit())
end
StructureUnit.OnPaused(self)
end,
OnUnpaused = function(self)
FactoryUnit.OnUnpaused(self)
if self:IsUnitState('Building') and self.unitBeingBuilt then
StructureUnit.StopBuildingEffects(self, self.UnitBeingBuilt)
self:StartBuildFx(self:GetFocusUnit())
end
end,
}
---------------------------------------------------------------
-- AIR STRUCTURES
---------------------------------------------------------------
AAirFactoryUnit = Class(AirFactoryUnit) {
StartBuildFx = function(self, unitBeingBuilt)
AFactoryUnit.StartBuildFx(self, unitBeingBuilt)
end,
OnPaused = function(self)
AFactoryUnit.OnPaused(self)
end,
OnUnpaused = function(self)
AFactoryUnit.OnUnpaused(self)
end,
}
---------------------------------------------------------------
-- AIR UNITS
---------------------------------------------------------------
AAirUnit = Class(AirUnit) {}
---------------------------------------------------------------
-- AIR STAGING STRUCTURES
---------------------------------------------------------------
AAirStagingPlatformUnit = Class(AirStagingPlatformUnit) {}
---------------------------------------------------------------
-- WALL STRUCTURES
---------------------------------------------------------------
AConcreteStructureUnit = Class(ConcreteStructureUnit) {
AdjacencyBeam = false,
}
---------------------------------------------------------------
-- Construction Units
---------------------------------------------------------------
AConstructionUnit = Class(ConstructionUnit) {
CreateBuildEffects = function(self, unitBeingBuilt, order)
EffectUtil.CreateAeonConstructionUnitBuildingEffects(self, unitBeingBuilt, self.BuildEffectsBag)
end,
}
---------------------------------------------------------------
-- ENERGY CREATION UNITS
---------------------------------------------------------------
AEnergyCreationUnit = Class(EnergyCreationUnit) {
OnCreate = function(self)
EnergyCreationUnit.OnCreate(self)
self.NumUsedAdjacentUnits = 0
end,
OnStopBeingBuilt = function(self,builder,layer)
EnergyCreationUnit.OnStopBeingBuilt(self, builder, layer)
if self.AmbientEffects then
for k, v in EffectTemplate[self.AmbientEffects] do
CreateAttachedEmitter(self, 0, self.Army, v)
end
end
end,
}
---------------------------------------------------------------
-- ENERGY STORAGE STRUCTURES
---------------------------------------------------------------
AEnergyStorageUnit = Class(EnergyStorageUnit) {}
---------------------------------------------------------------
-- HOVERING LAND UNITS
---------------------------------------------------------------
AHoverLandUnit = Class(DefaultUnitsFile.HoverLandUnit) {
FxHoverScale = 1,
HoverEffects = nil,
HoverEffectBones = nil,
}
---------------------------------------------------------------
-- LAND FACTORY STRUCTURES
---------------------------------------------------------------
ALandFactoryUnit = Class(LandFactoryUnit) {
StartBuildFx = function(self, unitBeingBuilt)
AFactoryUnit.StartBuildFx(self, unitBeingBuilt)
end,
OnPaused = function(self)
AFactoryUnit.OnPaused(self)
end,
OnUnpaused = function(self)
AFactoryUnit.OnUnpaused(self)
end,
}
---------------------------------------------------------------
-- LAND UNITS
---------------------------------------------------------------
ALandUnit = Class(DefaultUnitsFile.LandUnit) {}
---------------------------------------------------------------
-- MASS COLLECTION UNITS
---------------------------------------------------------------
AMassCollectionUnit = Class(MassCollectionUnit) {}
---------------------------------------------------------------
-- MASS FABRICATION STRUCTURES
---------------------------------------------------------------
AMassFabricationUnit = Class(MassFabricationUnit) {}
---------------------------------------------------------------
-- MASS STORAGE UNITS
---------------------------------------------------------------
AMassStorageUnit = Class(MassStorageUnit) {}
---------------------------------------------------------------
-- RADAR STRUCTURES
---------------------------------------------------------------
ARadarUnit = Class(RadarUnit) {}
---------------------------------------------------------------
-- RADAR STRUCTURES
---------------------------------------------------------------
ASonarUnit = Class(SonarUnit) {}
---------------------------------------------------------------
-- SEA FACTORY STRUCTURES
---------------------------------------------------------------
ASeaFactoryUnit = Class(SeaFactoryUnit) {
StartBuildFx = function(self, unitBeingBuilt)
local thread = self:ForkThread(CreateAeonFactoryBuildingEffects, unitBeingBuilt, self.BuildEffectBones, 'Attachpoint01', self.BuildEffectsBag)
unitBeingBuilt.Trash:Add(thread)
end,
OnPaused = function(self)
AFactoryUnit.OnPaused(self)
end,
OnUnpaused = function(self)
AFactoryUnit.OnUnpaused(self)
end,
}
---------------------------------------------------------------
-- SEA UNITS
---------------------------------------------------------------
ASeaUnit = Class(DefaultUnitsFile.SeaUnit) {}
---------------------------------------------------------------
-- SHIELD LAND UNITS
---------------------------------------------------------------
AShieldHoverLandUnit = Class(ShieldHoverLandUnit) {}
---------------------------------------------------------------
-- SHIELD LAND UNITS
---------------------------------------------------------------
AShieldLandUnit = Class(ShieldLandUnit) {}
---------------------------------------------------------------
-- SHIELD STRUCTURES
---------------------------------------------------------------
AShieldStructureUnit = Class(ShieldStructureUnit) {
RotateSpeed = 60,
OnShieldEnabled = function(self)
ShieldStructureUnit.OnShieldEnabled(self)
local bp = self:GetBlueprint()
if not self.Rotator then
self.Rotator = CreateRotator(self, 'Pod', 'z', nil, 0, 50, 0)
self.Trash:Add(self.Rotator)
end
self.Rotator:SetSpinDown(false)
self.Rotator:SetTargetSpeed(self.RotateSpeed)
end,
OnShieldDisabled = function(self)
ShieldStructureUnit.OnShieldDisabled(self)
if self.Rotator then
self.Rotator:SetTargetSpeed(0)
end
end,
}
---------------------------------------------------------------
-- STRUCTURES
---------------------------------------------------------------
AStructureUnit = Class(StructureUnit) {}
---------------------------------------------------------------
-- SUBMARINE UNITS
---------------------------------------------------------------
ASubUnit = Class(DefaultUnitsFile.SubUnit) {
IdleSubBones = {},
IdleSubEffects = {}
}
---------------------------------------------------------------
-- TRANSPORT BEACON UNITS
---------------------------------------------------------------
ATransportBeaconUnit = Class(TransportBeaconUnit) {}
---------------------------------------------------------------
-- WALKING LAND UNITS
---------------------------------------------------------------
AWalkingLandUnit = Class(WalkingLandUnit) {}
---------------------------------------------------------------
-- WALL STRUCTURES
---------------------------------------------------------------
AWallStructureUnit = Class(WallStructureUnit) {}
---------------------------------------------------------------
-- CIVILIAN STRUCTURES
---------------------------------------------------------------
ACivilianStructureUnit = Class(AStructureUnit) {}
---------------------------------------------------------------
-- QUANTUM GATE UNITS
---------------------------------------------------------------
AQuantumGateUnit = Class(QuantumGateUnit) {}
---------------------------------------------------------------
-- RADAR JAMMER UNITS
---------------------------------------------------------------
ARadarJammerUnit = Class(RadarJammerUnit) {
RotateSpeed = 60,
OnStopBeingBuilt = function(self, builder, layer)
RadarJammerUnit.OnStopBeingBuilt(self, builder, layer)
local bp = self:GetBlueprint()
local bpAnim = bp.Display.AnimationOpen
if not bpAnim then return end
if not self.OpenAnim then
self.OpenAnim = CreateAnimator(self)
self.OpenAnim:PlayAnim(bpAnim)
self.Trash:Add(self.OpenAnim)
end
if not self.Rotator then
self.Rotator = CreateRotator(self, 'B02', 'z', nil, 0, 50, 0)
self.Trash:Add(self.Rotator)
end
end,
OnIntelEnabled = function(self)
RadarJammerUnit.OnIntelEnabled(self)
if self.OpenAnim then
self.OpenAnim:SetRate(1)
end
if not self.Rotator then
self.Rotator = CreateRotator(self, 'B02', 'z', nil, 0, 50, 0)
self.Trash:Add(self.Rotator)
end
self.Rotator:SetSpinDown(false)
self.Rotator:SetTargetSpeed(self.RotateSpeed)
end,
OnIntelDisabled = function(self)
RadarJammerUnit.OnIntelDisabled(self)
if self.OpenAnim then
self.OpenAnim:SetRate(-1)
end
if self.Rotator then
self.Rotator:SetTargetSpeed(0)
end
end,
}