on = true
snd = GetStringParam("snd","")
function init()	

	radio = FindShape("radio")

	SetShapeEmissiveScale(radio, 0)
	SetTag(radio, "interact", "Turn on")

	clickSound = LoadSound("clickdown.ogg")
	musicLoop = LoadLoop(snd)

	if on then
		SetShapeEmissiveScale(radio, 1)
		SetTag(radio, "interact", "Turn off")			
	else
		SetShapeEmissiveScale(radio, 0)
		SetTag(radio, "interact", "Turn on")			
	end
end
function tick(dt)
	if IsShapeBroken(radio) then
		RemoveTag(radio, "interact")
		return
	end
	if GetPlayerInteractShape() == radio and InputPressed("interact") then
		PlaySound(clickSound)
		if on then
			on = false
			SetShapeEmissiveScale(radio, 0)
			SetTag(radio, "interact", "Turn on")			
		else
			on = true
			SetShapeEmissiveScale(radio, 1)
			SetTag(radio, "interact", "Turn off")			
		end
	end
	if on then 
		local pos = GetShapeWorldTransform(radio).pos
		PlayLoop(musicLoop, pos)
	end
end