

function EFFECT:Init(data)
	
	self.WeaponEnt = data:GetEntity()
	self.Attachment = data:GetAttachment()
	
	self.Position = self:GetTracerShootPos(data:GetOrigin(), self.WeaponEnt, self.Attachment)
	self.Forward = data:GetNormal()
	self.Angle = self.Forward:Angle()
	self.Right = self.Angle:Right()
	self.Up = self.Angle:Up()
	
	local AddVel = self.WeaponEnt:GetOwner():GetVelocity()
	
	local emitter = ParticleEmitter(self.Position)
		
	local particle = emitter:Add( "sprites/heatwave", self.Position - self.Forward * 4 )

	particle:SetVelocity( 120 * self.Forward + 20 * VectorRand() + 1.05 * AddVel )
	particle:SetGravity( Vector( 0, 0, 100 ) )
	particle:SetAirResistance( 160 )
	particle:SetDieTime( math.Rand( 0.2, 0.35 ) )
	particle:SetStartSize( math.random( 3, 5 ) )
	particle:SetEndSize( math.Rand( 17, 29 ) )

	particle:SetRoll( math.Rand( 180, 480 ) )
	particle:SetRollDelta( math.Rand( -1, 1 ) )
		
	for i = 1,4 do
		local particle = emitter:Add("particle/particle_smokegrenade", self.Position)
		particle:SetVelocity(60 * i * self.Forward + 1.1 * AddVel)
		particle:SetDieTime(math.Rand(0.36,0.78))
		particle:SetStartAlpha(math.Rand(150,200))
		particle:SetStartSize(math.random(3,4))
		particle:SetEndSize(math.Rand(17,28))
		particle:SetRoll(math.Rand(180,480))
		particle:SetRollDelta(math.Rand(-1,1))
		particle:SetColor(190,190,190)
		particle:SetLighting(true)
		particle:SetAirResistance(150)
    end
		
	if math.random(1,3) == 1 then
		
		for i = 1, math.random(3,6) do
			local particle = emitter:Add("effects/yellowflare", self.Position)
			particle:SetVelocity(math.Rand( 100, 320 ) * self.Forward + VectorRand() * 100 )
			particle:SetDieTime(math.Rand(0.2, 1))
			particle:SetStartAlpha(255)
			particle:SetStartSize(math.random(1,3))
			particle:SetRoll(0)
			particle:SetGravity(Vector(0, 0, -(math.random(100,400))))
			particle:SetCollide(true)
			particle:SetAirResistance(30)
			particle:SetStartLength(0.2)
			particle:SetEndLength(0.2)
			particle:SetVelocityScale(true)
			particle:SetCollide(true)
		end
		
		for i = 1, math.random(2,10) do
			local particle = emitter:Add("Effects/spark", self.Position)
			particle:SetVelocity(math.Rand( 60, 80 ) * self.Forward + VectorRand() * 30 )
			particle:SetDieTime(math.Rand(0.1, 0.3))
			particle:SetStartAlpha(255)
			particle:SetStartSize(1)
			particle:SetEndSize(0)
			particle:SetRoll(0)
			particle:SetGravity(Vector(0, 0, 0))
			particle:SetCollide(true)
			particle:SetBounce(0.8)
			particle:SetAirResistance(120)
			particle:SetStartLength(0)
			particle:SetEndLength(0.2)
			particle:SetVelocityScale(true)
			particle:SetCollide(true)
		end
		
		for i = 1,4 do
			local particle = emitter:Add("effects/muzzleflash"..math.random(1,4), self.Position - 3*self.Forward + 2*self.Right)
			particle:SetVelocity( 75 * i * self.Forward + 8 * VectorRand() + AddVel )
			particle:SetGravity(Vector(0,0,0))
			particle:SetDieTime(0.1)
			particle:SetStartAlpha(250)
			particle:SetStartSize(math.random(3,4))
			particle:SetEndSize(math.random(10,15))
			particle:SetRoll(math.Rand(180,480))
			particle:SetRollDelta(math.Rand(-1,1))
			particle:SetColor(255,255,255)	
		end
		
		if math.random(1,3)	== 1 then	
			for j = 1,2 do
				for i = -1,1,2 do 
					local particle = emitter:Add( "effects/muzzleflash"..math.random( 1, 4 ), self.Position - 3 * self.Forward + 2 * j * i * self.Right)
					particle:SetVelocity( 30 * j * i * self.Right + AddVel )
					particle:SetGravity( AddVel )
					particle:SetDieTime( 0.1 )
					particle:SetStartAlpha( 150 )
					particle:SetEndAlpha( 0 )
					particle:SetStartSize( 0.3 )
					particle:SetEndSize( 10 )
					particle:SetRoll( math.Rand( 180, 480 ) )
					particle:SetRollDelta( math.Rand( -1, 1 ) )
					particle:SetColor( 255, 255, 255 )	
				
					local particle = emitter:Add( "effects/muzzleflash"..math.random( 1, 4 ), self.Position - 3 * self.Forward + 2 * j * i * self.Up)

					particle:SetVelocity( 20 * j * i * self.Up + AddVel )
					particle:SetGravity( AddVel )
					particle:SetDieTime( 0.1 )
					particle:SetStartAlpha( 150 )
					particle:SetEndAlpha( 0 ) 
					particle:SetStartSize( 0.3 )
					particle:SetEndSize( 10 )
					particle:SetRoll( math.Rand( 180, 480 ) )
					particle:SetRollDelta( math.Rand( -1, 1 ) )
					particle:SetColor( 255, 255, 255 )

				end
			end
        end		
		
		local dlight = DynamicLight(0)
		if (dlight) then
			dlight.Pos 		= self.Position
			dlight.r 		= 70
			dlight.g 		= 50
			dlight.b 		= 0
			dlight.Brightness = 3
			dlight.size 	= 600
			dlight.DieTime 	= CurTime() + 0.01
		end
		
    end
	
	emitter:Finish()

end


function EFFECT:Think()

	return false
	
end


function EFFECT:Render()

	
end



