forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathterranweapons.lua
More file actions
262 lines (218 loc) · 9.12 KB
/
terranweapons.lua
File metadata and controls
262 lines (218 loc) · 9.12 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
--****************************************************************************
--**
--** File : /lua/terranweapons.lua
--** Author(s): John Comes, David Tomandl, Gordon Duclos
--**
--** Summary : Terran-specific weapon definitions
--**
--** Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
--****************************************************************************
local WeaponFile = import('/lua/sim/DefaultWeapons.lua')
local CollisionBeams = import('defaultcollisionbeams.lua')
local BareBonesWeapon = WeaponFile.BareBonesWeapon
local DefaultProjectileWeapon = WeaponFile.DefaultProjectileWeapon
local DefaultBeamWeapon = WeaponFile.DefaultBeamWeapon
local GinsuCollisionBeam = CollisionBeams.GinsuCollisionBeam
local OrbitalDeathLaserCollisionBeam = CollisionBeams.OrbitalDeathLaserCollisionBeam
local EffectTemplate = import('/lua/EffectTemplates.lua')
TDFFragmentationGrenadeLauncherWeapon= Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.THeavyFragmentationGrenadeMuzzleFlash,
}
TDFPlasmaCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TPlasmaGatlingCannonMuzzleFlash,
}
TIFFragLauncherWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TPlasmaCannonHeavyMuzzleFlash,
}
TDFHeavyPlasmaGatlingWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TPlasmaCannonHeavyMuzzleFlash,
}
TDFLightPlasmaCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TPlasmaCannonLightMuzzleFlash,
}
TDFHeavyPlasmaCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TPlasmaCannonHeavyMuzzleFlash,
}
TDFHeavyPlasmaGatlingCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.THeavyPlasmaGatlingCannonMuzzleFlash,
}
TDFOverchargeWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TCommanderOverchargeFlash01,
}
TDFMachineGunWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {
'/effects/emitters/machinegun_muzzle_fire_01_emit.bp',
'/effects/emitters/machinegun_muzzle_fire_02_emit.bp',
},
}
TDFGaussCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TGaussCannonFlash,
}
TDFShipGaussCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TShipGaussCannonFlash,
}
TDFLandGaussCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TLandGaussCannonFlash,
}
TDFZephyrCannonWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TLaserMuzzleFlash,
}
TDFRiotWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TRiotGunMuzzleFx,
}
TAAGinsuRapidPulseWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {},
}
TDFIonizedPlasmaCannon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TIonizedPlasmaGatlingCannonMuzzleFlash,
}
TDFHiroPlasmaCannon = Class(DefaultBeamWeapon) {
BeamType = CollisionBeams.TDFHiroCollisionBeam,
FxMuzzleFlash = {},
FxChargeMuzzleFlash = {},
FxUpackingChargeEffects = {},
FxUpackingChargeEffectScale = 1,
PlayFxWeaponUnpackSequence = function(self)
if not self.ContBeamOn then
local bp = self:GetBlueprint()
for k, v in self.FxUpackingChargeEffects do
for ek, ev in bp.RackBones[self.CurrentRackSalvoNumber].MuzzleBones do
CreateAttachedEmitter(self.unit, ev, self.unit.Army, v):ScaleEmitter(self.FxUpackingChargeEffectScale)
end
end
DefaultBeamWeapon.PlayFxWeaponUnpackSequence(self)
end
end,
}
TAAFlakArtilleryCannon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TFlakCannonMuzzleFlash01,
-- Custom over-ride for this weapon, so it passes data and damageTable
CreateProjectileForWeapon = function(self, bone)
local proj = self:CreateProjectile(bone)
local damageTable = self:GetDamageTable()
local blueprint = self:GetBlueprint()
local data = {
Instigator = self.unit,
Damage = blueprint.DoTDamage,
Duration = blueprint.DoTDuration,
Frequency = blueprint.DoTFrequency,
Radius = blueprint.DamageRadius,
Type = 'Normal',
DamageFriendly = blueprint.DamageFriendly,
}
if proj and not proj:BeenDestroyed() then
proj:PassDamageData(damageTable)
proj:PassData(data)
end
return proj
end
}
TAALinkedRailgun = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TRailGunMuzzleFlash01,
}
TAirToAirLinkedRailgun = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TRailGunMuzzleFlash02,
}
TIFCruiseMissileUnpackingLauncher = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {},
}
TIFCruiseMissileLauncher = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TIFCruiseMissileLaunchSmoke,
}
TIFCruiseMissileLauncherSub = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TIFCruiseMissileLaunchUnderWater,
}
TSAMLauncher = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TAAMissileLaunch,
}
TANTorpedoLandWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {
'/effects/emitters/default_muzzle_flash_01_emit.bp',
'/effects/emitters/default_muzzle_flash_02_emit.bp',
'/effects/emitters/torpedo_underwater_launch_01_emit.bp',
},
}
TANTorpedoAngler = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {
'/effects/emitters/default_muzzle_flash_01_emit.bp',
'/effects/emitters/default_muzzle_flash_02_emit.bp',
'/effects/emitters/torpedo_underwater_launch_01_emit.bp',
},
}
TIFSmartCharge = Class(DefaultProjectileWeapon) {
CreateProjectileAtMuzzle = function(self, muzzle)
local proj = DefaultProjectileWeapon.CreateProjectileAtMuzzle(self, muzzle)
local tbl = self:GetBlueprint().DepthCharge
proj:AddDepthCharge(tbl)
end,
}
TIFStrategicMissileWeapon = Class(DefaultProjectileWeapon) {}
TIFArtilleryWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TIFArtilleryMuzzleFlash
}
TIFCarpetBombWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {'/effects/emitters/antiair_muzzle_fire_02_emit.bp',},
CreateProjectileForWeapon = function(self, bone)
local projectile = self:CreateProjectile(bone)
local damageTable = self:GetDamageTable()
local blueprint = self:GetBlueprint()
local data = {
Instigator = self.unit,
Damage = blueprint.DoTDamage,
Duration = blueprint.DoTDuration,
Frequency = blueprint.DoTFrequency,
Radius = blueprint.DamageRadius,
Type = 'Normal',
DamageFriendly = blueprint.DamageFriendly,
}
if projectile and not projectile:BeenDestroyed() then
projectile:PassData(data)
projectile:PassDamageData(damageTable)
end
return projectile
end,
-- This function creates the projectile, and happens when the unit is trying to fire
-- Called from inside RackSalvoFiringState
CreateProjectileAtMuzzle = function(self, muzzle)
-- Adapt this function to keep the correct target lock during carpet bombing
local BallisticsList = import('/lua/sim/CalcBallisticAcceleration.lua').bomb_data
local data = BallisticsList[self.unit.EntityId]
if data and data.usestore and data.targetpos then -- We are repeating, and have lost our original target
self:SetTargetGround(data.targetpos)
end
DefaultProjectileWeapon.CreateProjectileAtMuzzle(self, muzzle)
end,
}
TIFSmallYieldNuclearBombWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {'/effects/emitters/antiair_muzzle_fire_02_emit.bp',},
}
TIFHighBallisticMortarWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TMobileMortarMuzzleEffect01,
}
TAMInterceptorWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = {'/effects/emitters/terran_antinuke_launch_01_emit.bp',},
}
TAMPhalanxWeapon = Class(DefaultProjectileWeapon) {
FxMuzzleFlash = EffectTemplate.TPhalanxGunMuzzleFlash,
FxShellEject = EffectTemplate.TPhalanxGunShells,
PlayFxMuzzleSequence = function(self, muzzle)
DefaultProjectileWeapon.PlayFxMuzzleSequence(self, muzzle)
for k, v in self.FxShellEject do
CreateAttachedEmitter(self.unit, self:GetBlueprint().TurretBonePitch, self.unit.Army, v)
end
end,
}
TOrbitalDeathLaserBeamWeapon = Class(DefaultBeamWeapon) {
BeamType = OrbitalDeathLaserCollisionBeam,
FxUpackingChargeEffects = {},
FxUpackingChargeEffectScale = 1,
PlayFxWeaponUnpackSequence = function(self)
local bp = self:GetBlueprint()
for k, v in self.FxUpackingChargeEffects do
for ek, ev in bp.RackBones[self.CurrentRackSalvoNumber].MuzzleBones do
CreateAttachedEmitter(self.unit, ev, self.unit.Army, v):ScaleEmitter(self.FxUpackingChargeEffectScale)
end
end
DefaultBeamWeapon.PlayFxWeaponUnpackSequence(self)
end,
}