

local burnTime = {}
local burningEntity = {}
fireDecalE = {}

function firedecal_init(e)
	fireDecalE[e] = e
	SetActivated(e,0)
end 


function firedecal_main(e)
	local ent = g_Entity[e]
	if ent.activated == 0 then 
		CollisionOff(e)
		Hide(e)
		SetActivated(e,1)
	elseif ent.activated == 1 then 		
	
	--fire decal is active and showing
	elseif ent.activated == 2 then 
		RotateToPlayer(e)
		if burnTime[e] ~= nil then 
			burnTime[e] = burnTime[e] - GetElapsedTime()
			if burnTime[e] < 0 or (burningEntity[e] ~= nil and g_Entity[burningEntity[e]]['health'] < 1) then 				
				if burningEntity[e] ~= nil and g_Entity[burningEntity[e]]['health'] < 1 then 
					Destroy(burningEntity[e])
				end
				RemoveFireDecal(e)
			end 
		end 
		
	end 
	
end 

function PlaceFireDecal(e, x,y,z, timer,burningE)
	SetPosition(e,x,y,z)
	burnTime[e] = timer 
	burningEntity[e] = burningE
	Show(e)
	SetActivated(e,2)
end 

function RemoveFireDecal(e)
	burningEntity[e] = nil 
	burnTime[e] = nil 
	SetActivated(e,0)
end 
