Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Entity = import('/lua/sim/Entity.lua').Entity
- local DefaultDamage = import('/lua/sim/damage.lua')
- local Utilities = import('/lua/system/utilities.lua')
- local prevClass = Projectile
- Projectile = Class(prevClass) {
- CreateChildProjectile = function(self, bpid)
- local child = prevClass.CreateChildProjectile(self, bpid)
- if self.DamageData and self.DamageData.PassChildDamageData then
- --Make a copy of damagedata for child projectile
- local childDamageData = table.copy(self.DamageData)
- childDamageData.PassChildDamageData = nil
- childDamageData.OnlyChildDamage = nil
- --If weapon blueprint-specified child projectile overrides are present,
- --replace existing values with Child overrides
- childDamageData.DamageAmount = childDamageData.ChildDamageAmount or childDamageData.DamageAmount
- childDamageData.DamageRadius = childDamageData.ChildDamageRadius or childDamageData.DamageRadius
- childDamageData.DoTTime = childDamageData.ChildDoTTime or childDamageData.DoTTime
- childDamageData.DoTPulses = childDamageData.ChildDoTPulses or childDamageData.DoTPulses
- child:PassDamageData(childDamageData) --see local child above
- LOG('ThisChildShouldHaveDamageData')
- LOG('ChildDamageData Info =' .. repr(childDamageData))
- end
- return child
- end,
- DoDamage = function(self, instigator, damageData, targetEntity, passThrough)
- if not damageData.OnlyChildDamage then --no if self.DamageData?
- prevClass.DoDamage(self, instigator, damageData, targetEntity, passThrough)
- LOG('ThisParentShouldDoDamage')
- else
- LOG('ChildDoDamage Run')
- self.ChildSetToDamage = true
- end
- end,
- OnImpact = function( self, targetType, targetEntity )
- prevClass.OnImpact( self, targetType, targetEntity )
- local instigator = self:GetLauncher()
- if self.ChildSetToDamage then
- local damageamount = self.DamageTable.DamageAmount
- LOG('ChildDamage =' .. repr(damageamount))
- self:DoDamage( instigator, damageamount, targetEntity)
- end
- end,
- }
Add Comment
Please, Sign In to add comment