dofile("scripts/entities/entityinclude.lua")

altar = 0
function init(me)
	node_setCursorActivation(me, true)
end

function update(me, dt)
	if altar == 0 then
		altar = node_getNearestEntity(me, "Altar")
	end
	if altar ~=0 then
		node_setCursorActivation(me, entity_isState(altar, STATE_OPENED))
	end
end

function activate(me)
	if altar ~= 0 then
		debugLog("found altar")
		if entity_isState(altar, STATE_OPENED) then
			entity_setState(altar, STATE_CLOSE)
		elseif entity_isState(altar, STATE_CLOSED) then
			entity_setState(altar, STATE_OPEN)
		end
	end
end

