Guest User

Untitled

a guest
Jan 14th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. local Entity = import('/lua/sim/Entity.lua').Entity
  2. local DefaultDamage = import('/lua/sim/damage.lua')
  3. local Utilities = import('/lua/system/utilities.lua')
  4.  
  5. local prevClass = Projectile
  6.  
  7. Projectile = Class(prevClass) {
  8. CreateChildProjectile = function(self, bpid)
  9. local child = prevClass.CreateChildProjectile(self, bpid)
  10. if self.DamageData and self.DamageData.PassChildDamageData then
  11. --Make a copy of damagedata for child projectile
  12. local childDamageData = table.copy(self.DamageData)
  13. childDamageData.PassChildDamageData = nil
  14. childDamageData.OnlyChildDamage = nil
  15. --If weapon blueprint-specified child projectile overrides are present,
  16. --replace existing values with Child overrides
  17. childDamageData.DamageAmount = childDamageData.ChildDamageAmount or childDamageData.DamageAmount
  18. childDamageData.DamageRadius = childDamageData.ChildDamageRadius or childDamageData.DamageRadius
  19. childDamageData.DoTTime = childDamageData.ChildDoTTime or childDamageData.DoTTime
  20. childDamageData.DoTPulses = childDamageData.ChildDoTPulses or childDamageData.DoTPulses
  21. child:PassDamageData(childDamageData) --see local child above
  22. LOG('ThisChildShouldHaveDamageData')
  23. LOG('ChildDamageData Info =' .. repr(childDamageData))
  24. end
  25.  
  26. return child
  27. end,
  28.  
  29. DoDamage = function(self, instigator, damageData, targetEntity, passThrough)
  30. if not damageData.OnlyChildDamage then --no if self.DamageData?
  31. prevClass.DoDamage(self, instigator, damageData, targetEntity, passThrough)
  32. LOG('ThisParentShouldDoDamage')
  33. else
  34. LOG('ChildDoDamage Run')
  35. self.ChildSetToDamage = true
  36. end
  37. end,
  38.  
  39. OnImpact = function( self, targetType, targetEntity )
  40. prevClass.OnImpact( self, targetType, targetEntity )
  41. local instigator = self:GetLauncher()
  42. if self.ChildSetToDamage then
  43. local damageamount = self.DamageTable.DamageAmount
  44. LOG('ChildDamage =' .. repr(damageamount))
  45. self:DoDamage( instigator, damageamount, targetEntity)
  46. end
  47. end,
  48. }
Add Comment
Please, Sign In to add comment