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

function init(me)
	node_setCursorActivation(me, false)
	orbHolder = node_getNearestEntity(me)
	energyOrb = entity_getNearestEntity(me, "EnergyOrb")
	if energyOrb ~=0 and orbHolder ~=0 then	
		entity_setPosition(energyOrb, entity_x(orbHolder), entity_y(orbHolder))
		entity_setState(energyOrb, STATE_CHARGED)
	else
		--debugLog("NO ORB")
	end
	door = node_getNearestEntity(me, "EnergyDoor")
	if door ~= 0 then
		--debugLog("setting door to open")
		entity_setState(door, STATE_OPENED)
	end
	--end
end

function activate(me)
--[[
	if getFlag(FLAG_ENERGYTEMPLE01DOOR)==0 then
		energyOrb = node_getNearestEntity(me, "EnergyOrb")
		msg ("HERE")
		if energyOrb ~= 0 then
			msg("ENERGY ORB OUT")
			setFlag(FLAG_ENERGYTEMPLE01DOOR, entity_getID(energyOrb))
			
			door = node_getNearestEntity(me, "EnergyDoor")
			if door ~= 0 then
				entity_setState(door, STATE_OPEN)
			end
		else
			msg("NO ENERGY ORB")
		end
	end
	]]--
end

function update(me, dt)
end
