#
# Terran Gauss Cannon Projectile
#
local RailGun01Projectile = import('/mods/BlackOps/lua/BlackOpsprojectiles.lua').RailGun01Projectile
RailGun01 = Class(RailGun01Projectile) {
    
    OnCreate = function(self, inWater)
        RailGun01Projectile.OnCreate(self, inWater)
        if not inWater then
            self:SetDestroyOnWater(true)
        else
            self:ForkThread(self.DestroyOnWaterThread)
        end
    end,
    
    DestroyOnWaterThread = function(self)
        WaitSeconds(0.2)
        self:SetDestroyOnWater(true)
    end,
    
OnImpactDestroy = function( self, targetType, targetEntity )

   if targetEntity and not IsUnit(targetEntity) then
      RailGun01Projectile.OnImpactDestroy(self, targetType, targetEntity)
      return
   end
   
   if self.counter then
      if self.counter >= 3 then
         RailGun01Projectile.OnImpactDestroy(self, targetType, targetEntity)
         return
      else
         self.counter = self.counter + 1
      end
   else
      self.counter = 1
   end
   if targetEntity then
self.lastimpact = targetEntity:GetEntityId() #remember what was hit last
end
end,
}
TypeClass = RailGun01

