#****************************************************************************
#**
#**  File     :  /data/projectiles/CDFHeavyDisintegratorPulseLaser01/CDFHeavyDisintegratorPulseLaser01_script.lua
#**  Author(s):  Gordon Duclos
#**
#**  Summary  :  Cybran Heavy Disintegrator Pulse Laser Projectile script, XRL0305
#**
#**  Copyright © 2007 Gas Powered Games, Inc.  All rights reserved.
#****************************************************************************

CDFHeavyDisintegratorPulseLaser01 = Class(import('/mods/IMBA_Mod_V4/lua/cybranprojectiles.lua').CHeavyDisintegratorPulseLaser) {

	OnImpactDestroy = function( self, targetType, targetEntity )
--LOG(targetEntity)
		if not targetEntity then
		--LOG(repr(targetEntity))
			self:Destroy() 
			--NRailgunProjectilePolytrail.OnImpactDestroy(self, targetType, targetEntity)
			return
		end
		

   
		if self.counter then
			if targetEntity and not(self.lastimpact == targetEntity:GetEntityId())then
				if self.counter >= 10 then
					self:Destroy() 
				
					--NRailgunProjectilePolytrail.OnImpactDestroy(self, targetType, targetEntity)
					return
				else
					self.counter = self.counter + 1
				end
			end
		else
			self.counter = 1
		end
		
		if targetEntity then
			self.lastimpact = targetEntity:GetEntityId() #remember what was hit last
		end
	end,
 


}
TypeClass = CDFHeavyDisintegratorPulseLaser01