diff --git a/lua/sim/Projectile.lua b/lua/sim/Projectile.lua index 58236116efd..32687dd8d45 100644 --- a/lua/sim/Projectile.lua +++ b/lua/sim/Projectile.lua @@ -695,6 +695,22 @@ Projectile = ClassProjectile(ProjectileMethods) { -- check for entity-specific damage elseif DamageData.DamageAmount and targetEntity then + local damageToShields = DamageData.DamageToShields + local entityShield = targetEntity.MyShield or targetEntity.IsOn and targetEntity + if damageToShields and entityShield and entityShield.IsOn() then + local health = entityShield:GetHealth() + if damageToShields > health then + damageToShields = health + end + Damage( + instigator, + cachedPosition, + entityShield, + damageToShields, + DamageData.DamageType + ) + end + -- check for damage-over-time if not DamageData.DoTTime or DamageData.DoTTime <= 0 then diff --git a/lua/sim/weapon.lua b/lua/sim/weapon.lua index 28829bf2d3e..86da5c8aa22 100644 --- a/lua/sim/weapon.lua +++ b/lua/sim/weapon.lua @@ -409,6 +409,10 @@ Weapon = ClassWeapon(WeaponMethods) { GetDamageTableInternal = function(self) local weaponBlueprint = self.Blueprint local damageTable = {} + + if weaponBlueprint.DamageToShields then + damageTable.DamageToShields = weaponBlueprint.DamageToShields + end damageTable.InitialDamageAmount = weaponBlueprint.InitialDamage or 0 damageTable.DamageRadius = weaponBlueprint.DamageRadius + self.DamageRadiusMod damageTable.DamageAmount = weaponBlueprint.Damage + self.DamageMod diff --git a/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua b/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua index bc8713a9370..8ae1768818c 100644 --- a/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua +++ b/projectiles/ADFShieldDisruptor01/ADFShieldDisruptor01_script.lua @@ -25,32 +25,5 @@ local ADisruptorProjectileOnImpact = ADisruptorProjectile.OnImpact --- Aeon Shield Disruptor Projectile, DAL0310 ---@class ADFShieldDisruptor01 : AShieldDisruptorProjectile -ADFShieldDisruptor01 = ClassProjectile(ADisruptorProjectile) { - - ---@param self ADFShieldDisruptor01 - ---@param targetType string - ---@param targetEntity Unit - OnImpact = function(self, targetType, targetEntity) - ADisruptorProjectileOnImpact(self, targetType, targetEntity) - - -- try to find the shield that we hit - if targetType ~= 'Shield' then - targetEntity = targetEntity.MyShield - end - - if not targetEntity then - return - end - - -- we directly damage the shield to prevent generating overspill damage - local damage = targetEntity:GetHealth() - if damage > 1300 then -- TODO: find a better way to pass this damage - damage = 1300 - elseif damage < 1 then - damage = 1 - end - - Damage(self, self:GetPosition(), targetEntity, damage, 'Normal') - end, -} +ADFShieldDisruptor01 = ClassProjectile(ADisruptorProjectile) {} TypeClass = ADFShieldDisruptor01 diff --git a/projectiles/CIFOthismashEMPMissile01/CIFOthismashEMPMissile01_Script.lua b/projectiles/CIFOthismashEMPMissile01/CIFOthismashEMPMissile01_Script.lua index 00b07f9e6b2..0f871cedf64 100644 --- a/projectiles/CIFOthismashEMPMissile01/CIFOthismashEMPMissile01_Script.lua +++ b/projectiles/CIFOthismashEMPMissile01/CIFOthismashEMPMissile01_Script.lua @@ -11,15 +11,6 @@ CDFRocketIridium03 = Class(CIridiumRocketProjectile) { local army = self:GetArmy() CreateLightParticle( self, -1, army, 2, 1, 'glow_03', 'ramp_red_06' ) CreateLightParticle( self, -1, army, 1, 3, 'glow_03', 'ramp_antimatter_02' ) - if targetType == 'Shield' then - Damage( - self, - {0,0,0}, - targetEntity, - self.Data, - 'Normal' - ) - end end, }