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

n = 0

function init(me)
	node_setCursorActivation(me, true)
	n = getNaija()
end
	
function activate(me)
	n = getNaija()
	node = entity_getNearestNode(n, "avatar_nosave")
	if not node_isEntityIn(node, n) then
		savePoint(me)
	else
		playSfx("denied")
	end
end

function update(me, dt)
	if node_isEntityIn(me, n) then
		if node_isFlag(me, 0) then
			pickupGem("savepoint")
			node_setFlag(me, 1)
		end
	end
end
