Skip to content

Commit

Permalink
add decals/tree falling to SR projectiles
Browse files Browse the repository at this point in the history
  • Loading branch information
shalkya committed Nov 15, 2020
1 parent 179e2d4 commit 2b658df
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions lua/cybranprojectiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local EffectTemplate = import('/lua/EffectTemplates.lua')
local RandomFloat = import('/lua/utilities.lua').GetRandomFloat
local NukeProjectile = DefaultProjectileFile.NukeProjectile
local DefaultExplosion = import('defaultexplosions.lua')

local RandomFloat = import('/lua/utilities.lua').GetRandomFloat

--------------------------------------------------------------------------
-- CYBRAN BRACKMAN "HACK PEG-POD" PROJECTILE
Expand Down Expand Up @@ -401,6 +401,23 @@ CHeavyElectronBolterProjectile = Class(MultiPolyTrailProjectile) {
FxUnitHitScale = 2.5,
FxWaterHitScale = 2.5,
FxOnKilledScale = 2.5,

OnImpact = function(self, targetType, targetEntity)
if targetType ~= 'Shield' and targetType ~= 'Water' and targetType ~= 'Air' and targetType ~= 'UnitAir' and targetType ~= 'Projectile' then
local rotation = RandomFloat(0,2*math.pi)
local radius = self.DamageData.DamageRadius
local pos = self:GetPosition()
local army = self.Army

DamageArea(self, pos, radius, 1, 'Force', true)
DamageArea(self, pos, radius, 1, 'Force', true)
DamageRing( self, pos, radius, 5/4 * radius, 1, 'Fire', true )

CreateDecal(pos, rotation, 'scorch_001_albedo', '', 'Albedo', radius+1, radius+1, 250, 50, army)
end

SinglePolyTrailProjectile.OnImpact(self, targetType, targetEntity)
end,
}

--------------------------------------------------------------------------
Expand Down Expand Up @@ -488,6 +505,29 @@ CIridiumRocketProjectile = Class(SingleCompositeEmitterProjectile) {
FxImpactProp = EffectTemplate.CMissileHit02,
FxImpactLand = EffectTemplate.CMissileHit02,
FxImpactUnderWater = {},

OnImpact = function(self, targetType, targetEntity)
if targetType ~= 'Shield' and targetType ~= 'Water' and targetType ~= 'Air' and targetType ~= 'UnitAir' and targetType ~= 'Projectile' then
local rotation = RandomFloat(0,2*math.pi)
local radius = self.DamageData.DamageRadius
local pos = self:GetPosition()
local army = self.Army

if radius == 0 then
DamageArea(self, pos, 1, 1, 'Force', true)
DamageArea(self, pos, 1, 1, 'Force', true)

CreateDecal(pos, rotation, 'scorch_001_albedo', '', 'Albedo', 1, 1, 250, 50, army)
else
DamageArea(self, pos, radius, 1, 'Force', true)
DamageArea(self, pos, radius, 1, 'Force', true)

CreateDecal(pos, rotation, 'scorch_001_albedo', '', 'Albedo', radius+1, radius+1, 250, 50, army)
end
end

SinglePolyTrailProjectile.OnImpact(self, targetType, targetEntity)
end,
}

--------------------------------------------------------------------------
Expand All @@ -504,7 +544,6 @@ CCorsairRocketProjectile = Class(SingleCompositeEmitterProjectile) {

OnImpact = function(self, targetType, targetEntity)
if targetType ~= 'Shield' and targetType ~= 'Water' and targetType ~= 'Air' and targetType ~= 'UnitAir' and targetType ~= 'Projectile' then
local RandomFloat = import('/lua/utilities.lua').GetRandomFloat
local rotation = RandomFloat(0,2*math.pi)
local radius = self.DamageData.DamageRadius
local pos = self:GetPosition()
Expand Down

0 comments on commit 2b658df

Please sign in to comment.