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

naija = 0
door = 0
done = false

function init(me)
	naija = getNaija()
	node_setCursorActivation(me, false)
	door = node_getNearestEntity(me, "EnergyDoor")
	if door ~= 0 then
		entity_setState(door, STATE_OPENED)
	end
end

function activate(me)
end

function update(me, dt)
	if not done and getStory() <= 8 then
		if node_isEntityIn(me, naija) then
			done = true
			
			boss = node_getNearestEntity(me, "EnergyBoss")
			setStory(8)
			entity_setState(door, STATE_CLOSE)
			entity_flipToEntity(getNaija(), boss)
			wnd(1)
			txt("Naija: ...")
			wnd(0)
			
			entity_setState(boss, STATE_AWAKEN)
			
			playMusic("BigBoss")
		end
	end
end
