From be227faa4709df4fdf53f8ce1626e81081f5007f Mon Sep 17 00:00:00 2001 From: Jip Date: Sun, 22 Jan 2023 11:31:56 +0100 Subject: [PATCH] Remove overwritten instances of `CreateProjectileForWeapon` (#4611) --- lua/aeonweapons.lua | 108 +----------------- lua/cybranweapons.lua | 69 ----------- lua/terranweapons.lua | 49 -------- .../ADFShieldDisruptor01_script.lua | 2 +- .../AIFFragmentationSensorShell01_script.lua | 11 +- .../AIFFragmentationSensorShell02_script.lua | 10 -- .../AIFMiasmaShell01_script.lua | 2 +- .../CDFTracker01/CDFTracker01_script.lua | 2 +- 8 files changed, 5 insertions(+), 248 deletions(-) diff --git a/lua/aeonweapons.lua b/lua/aeonweapons.lua index ac6b8a0ee3..5d435a8f3c 100644 --- a/lua/aeonweapons.lua +++ b/lua/aeonweapons.lua @@ -465,32 +465,7 @@ AIFMortarWeapon = ClassWeapon(DefaultProjectileWeapon) {} AIFBombGravitonWeapon = ClassWeapon(DefaultProjectileWeapon) {} ---@class AIFArtilleryMiasmaShellWeapon : DefaultProjectileWeapon -AIFArtilleryMiasmaShellWeapon = ClassWeapon(DefaultProjectileWeapon) { - ---@param self AIFArtilleryMiasmaShellWeapon - ---@param bone Bone - ---@return Projectile |nil - CreateProjectileForWeapon = function(self, bone) - local proj = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local blueprint = self.Blueprint - 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, -} +AIFArtilleryMiasmaShellWeapon = ClassWeapon(DefaultProjectileWeapon) {} ---@class AIFArtillerySonanceShellWeapon : DefaultProjectileWeapon AIFArtillerySonanceShellWeapon = ClassWeapon(DefaultProjectileWeapon) { @@ -509,97 +484,16 @@ AIFBombQuarkWeapon = ClassWeapon(DefaultProjectileWeapon) { ---@class AANDepthChargeBombWeapon : DefaultProjectileWeapon AANDepthChargeBombWeapon = ClassWeapon(DefaultProjectileWeapon) { FxMuzzleFlash = {'/effects/emitters/antiair_muzzle_fire_02_emit.bp', }, - - ---@param self AANDepthChargeBombWeapon - ---@param bone Bone - ---@return Projectile|nil - CreateProjectileForWeapon = function(self, bone) - local proj = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local blueprint = self.Blueprint - local data = { - Army = self.unit.Army, - Instigator = self.unit, - StartRadius = blueprint.DOTStartRadius, - EndRadius = blueprint.DOTEndRadius, - DOTtype = blueprint.DOTtype, - Damage = blueprint.DoTDamage, - Duration = blueprint.DoTDuration, - Frequency = blueprint.DoTFrequency, - Type = 'Normal', - } - - if proj and not proj:BeenDestroyed() then - proj:PassDamageData(damageTable) - proj:PassData(data) - end - - return proj - end, } ---@class AANDepthChargeBombWeapon02 : DefaultProjectileWeapon AANDepthChargeBombWeapon02 = ClassWeapon(DefaultProjectileWeapon) { FxMuzzleFlash = {'/effects/emitters/antiair_muzzle_fire_01_emit.bp', }, - - ---@param self AANDepthChargeBombWeapon02 - ---@param bone Bone - ---@return Projectile|nil - CreateProjectileForWeapon = function(self, bone) - local proj = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local blueprint = self.Blueprint - local data = { - Army = self.unit.Army, - Instigator = self.unit, - StartRadius = blueprint.DOTStartRadius, - EndRadius = blueprint.DOTEndRadius, - DOTtype = blueprint.DOTtype, - Damage = blueprint.DoTDamage, - Duration = blueprint.DoTDuration, - Frequency = blueprint.DoTFrequency, - Type = 'Normal', - } - - if proj and not proj:BeenDestroyed() then - proj:PassDamageData(damageTable) - proj:PassData(data) - end - - return proj - end, } ---@class AANTorpedoCluster : DefaultProjectileWeapon AANTorpedoCluster = ClassWeapon(DefaultProjectileWeapon) { FxMuzzleFlash = {'/effects/emitters/aeon_torpedocluster_flash_01_emit.bp', }, - - ---@param self AANTorpedoCluster - ---@param bone Bone - ---@return Projectile|nil - CreateProjectileForWeapon = function(self, bone) - local proj = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local blueprint = self.Blueprint - local data = { - Army = self.unit.Army, - Instigator = self.unit, - StartRadius = blueprint.DOTStartRadius, - EndRadius = blueprint.DOTEndRadius, - DOTtype = blueprint.DOTtype, - Damage = blueprint.DoTDamage, - Duration = blueprint.DoTDuration, - Frequency = blueprint.DoTFrequency, - Type = 'Normal', - } - - if proj and not proj:BeenDestroyed() then - proj:PassDamageData(damageTable) - proj:PassData(data) - end - - return proj - end, } ---@class AIFSmartCharge : DefaultProjectileWeapon diff --git a/lua/cybranweapons.lua b/lua/cybranweapons.lua index ec2c5053f2..8b82aa24f7 100644 --- a/lua/cybranweapons.lua +++ b/lua/cybranweapons.lua @@ -162,30 +162,6 @@ CANNaniteTorpedoWeapon = ClassWeapon(DefaultProjectileWeapon) { '/effects/emitters/default_muzzle_flash_02_emit.bp', '/effects/emitters/torpedo_underwater_launch_01_emit.bp', }, - - ---@param self CANNaniteTorpedoWeapon - ---@param bone Bone - ---@return Projectile|nil - CreateProjectileForWeapon = function(self, bone) - local projectile = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local bp = self.Blueprint - local data = { - Instigator = self.unit, - Damage = bp.DoTDamage, - Duration = bp.DoTDuration, - Frequency = bp.DoTFrequency, - Type = 'Normal', - PreDamageEffects = {}, - DuringDamageEffects = {}, - PostDamageEffects = {}, - } - if projectile and not projectile:BeenDestroyed() then - projectile:PassData(data) - projectile:PassDamageData(damageTable) - end - return projectile - end, } ---@class CDFMissileMesonWeapon : DefaultProjectileWeapon @@ -279,26 +255,6 @@ CAABurstCloudFlakArtilleryWeapon = ClassWeapon(DefaultProjectileWeapon) { '/effects/emitters/default_muzzle_flash_02_emit.bp' }, FxMuzzleFlashScale = 1.5, - - CreateProjectileForWeapon = function(self, bone) - local projectile = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local blueprint = self.Blueprint - 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, } ---@class CAAMissileNaniteWeapon : DefaultProjectileWeapon @@ -333,31 +289,6 @@ CIFBombNeutronWeapon = ClassWeapon(DefaultProjectileWeapon) { ---@class CIFNaniteTorpedoWeapon : DefaultProjectileWeapon CIFNaniteTorpedoWeapon = ClassWeapon(DefaultProjectileWeapon) { FxMuzzleFlash = {'/effects/emitters/antiair_muzzle_fire_02_emit.bp',}, - - ---@param self CIFNaniteTorpedoWeapon - ---@param bone Bone - ---@return Projectile|nil - CreateProjectileForWeapon = function(self, bone) - local proj = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local bp = self.Blueprint - local data = { - Instigator = self.unit, - Damage = bp.DoTDamage, - Duration = bp.DoTDuration, - Frequency = bp.DoTFrequency, - Type = 'Normal', - PreDamageEffects = {}, - DuringDamageEffects = {}, - PostDamageEffects = {}, - } - - if proj and not proj:BeenDestroyed() then - proj:PassDamageData(damageTable) - proj:PassData(data) - end - return proj - end, } ---@class CIFMissileLoaWeapon : DefaultProjectileWeapon diff --git a/lua/terranweapons.lua b/lua/terranweapons.lua index 3a08aca516..62da011a5f 100644 --- a/lua/terranweapons.lua +++ b/lua/terranweapons.lua @@ -122,32 +122,6 @@ TDFHiroPlasmaCannon = ClassWeapon(DefaultBeamWeapon) { ---@class TAAFlakArtilleryCannon : DefaultProjectileWeapon TAAFlakArtilleryCannon = ClassWeapon(DefaultProjectileWeapon) { FxMuzzleFlash = EffectTemplate.TFlakCannonMuzzleFlash01, - - --- Custom over-ride for this weapon, so it passes data and damageTable - ---@param self TAAFlakArtilleryCannon - ---@param bone Bone - ---@return Projectile|nil - CreateProjectileForWeapon = function(self, bone) - local proj = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local blueprint = self.Blueprint - 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 } ---@class TAALinkedRailgun : DefaultProjectileWeapon @@ -222,29 +196,6 @@ TIFArtilleryWeapon = ClassWeapon(DefaultProjectileWeapon) { TIFCarpetBombWeapon = ClassWeapon(DefaultProjectileWeapon) { FxMuzzleFlash = {'/effects/emitters/antiair_muzzle_fire_02_emit.bp',}, - ---@param self TIFCarpetBombWeapon - ---@param bone Bone - ---@return Projectile | nil - CreateProjectileForWeapon = function(self, bone) - local projectile = self:CreateProjectile(bone) - local damageTable = self:GetDamageTable() - local blueprint = self.Blueprint - 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 ---@param self TIFCarpetBombWeapon diff --git a/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua b/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua index 8fd61e8cff..cb9845fca2 100644 --- a/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua +++ b/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua @@ -15,7 +15,7 @@ ADFShieldDisruptor01 = ClassProjectile(ADisruptorProjectile) { if not TargetEntity then return end -- Never cause overspill damage to the unit, 1 min to avoid logspam with 0 declared damage - local damage = math.max(math.min(self.Data, TargetEntity:GetHealth()), 1) + local damage = math.max(math.min(1300, TargetEntity:GetHealth()), 1) -- TODO: find a better way to pass this damage Damage(self, {0,0,0}, TargetEntity, damage, 'Normal') end, } diff --git a/projectiles/AIFFragmentationSensorShell01/AIFFragmentationSensorShell01_script.lua b/projectiles/AIFFragmentationSensorShell01/AIFFragmentationSensorShell01_script.lua index 4c378caf90..95118088bb 100644 --- a/projectiles/AIFFragmentationSensorShell01/AIFFragmentationSensorShell01_script.lua +++ b/projectiles/AIFFragmentationSensorShell01/AIFFragmentationSensorShell01_script.lua @@ -47,16 +47,7 @@ AIFFragmentationSensorShell01 = ClassProjectile(AArtilleryFragmentationSensorShe proj:SetVelocity(velocity) proj.DamageData = self.DamageData end - local pos = self:GetPosition() - local spec = { - X = pos[1], - Z = pos[3], - Radius = self.Data.Radius, - LifeTime = self.Data.Lifetime, - Army = self.Data.Army, - Omni = false, - WaterVision = false, - } + self:Destroy() end, } diff --git a/projectiles/AIFFragmentationSensorShell02/AIFFragmentationSensorShell02_script.lua b/projectiles/AIFFragmentationSensorShell02/AIFFragmentationSensorShell02_script.lua index 44cff826e0..8efd665348 100644 --- a/projectiles/AIFFragmentationSensorShell02/AIFFragmentationSensorShell02_script.lua +++ b/projectiles/AIFFragmentationSensorShell02/AIFFragmentationSensorShell02_script.lua @@ -45,16 +45,6 @@ AIFFragmentationSensorShell02 = ClassProjectile(AArtilleryFragmentationSensorShe proj:SetVelocity(velocity) proj.DamageData = self.DamageData end - local pos = self:GetPosition() - local spec = { - X = pos[1], - Z = pos[3], - Radius = self.Data.Radius, - LifeTime = self.Data.Lifetime, - Army = self.Data.Army, - Omni = false, - WaterVision = false, - } self:Destroy() else self:DoDamage( self, self.DamageData, TargetEntity) diff --git a/projectiles/AIFMiasmaShell01/AIFMiasmaShell01_script.lua b/projectiles/AIFMiasmaShell01/AIFMiasmaShell01_script.lua index daf4e699e5..4cc7e7a409 100644 --- a/projectiles/AIFMiasmaShell01/AIFMiasmaShell01_script.lua +++ b/projectiles/AIFMiasmaShell01/AIFMiasmaShell01_script.lua @@ -25,4 +25,4 @@ AIFMiasmaShell01 = ClassProjectile(AMiasmaProjectile) { self:Destroy() end, } -TypeClass = AIFMiasmaShell01 \ No newline at end of file +TypeClass = AIFMiasmaShell01v \ No newline at end of file diff --git a/projectiles/CDFTracker01/CDFTracker01_script.lua b/projectiles/CDFTracker01/CDFTracker01_script.lua index 185e722fcb..da4049e5e1 100644 --- a/projectiles/CDFTracker01/CDFTracker01_script.lua +++ b/projectiles/CDFTracker01/CDFTracker01_script.lua @@ -7,7 +7,7 @@ CDFTracker01 = ClassProjectile(CDFTrackerProjectile) { OnImpact = function(self, TargetType, TargetEntity) if TargetEntity then local x,y,z = unpack(TargetEntity:GetPosition()) - local tracker = CreateUnit('URB5206', self.Data.Parent.Army, x, y, z, 0, 0, 0, 0) + local tracker = CreateUnit('URB5206', self.Army, x, y, z, 0, 0, 0, 0) tracker:AttachTo(TargetEntity, -1) end CDFTrackerProjectile.OnImpact(self, TargetType, TargetEntity)