torch = FindShape("torch")
firelight = FindLight("torchlight")
t1 = GetFloatParam("t1", 3.7)
t2 = GetFloatParam("t2", 5.12)
timer = 0
broken = false

function tick(dt)
	if broken then
		return
	end

	if IsShapeBroken(torch) then
		SetShapeEmissiveScale(torch, 0)
		broken= true
	end

	local intensity = 0.25 + ((math.sin(timer/2)+1)/8)+((math.sin(timer*t1)+1)/4)+((math.sin(timer*t2)+1)/4)
	SetShapeEmissiveScale(torch, intensity)
	--SetLightIntensity(firelight, intensity)
	timer = timer + dt
end