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

function init(me)	
end
	
function activate(me)
end

function run(me)
	if isFlag(FLAG_NAIJA_MEMORYCRYSTAL, 0) then
		setFlag(FLAG_NAIJA_MEMORYCRYSTAL, 1)
		
		n = getNaija()		
		entity_idle(n)
		
		entity_flipToNode(n, getNode("SAVEPOINT"))
		
		camNode = getNode("MEMORYCRYSTALCAM1")
		camNode2 = getNode("MEMORYCRYSTALCAM2")
		camNode3 = getNode("MEMORYCRYSTALCAM3")
		camNode4 = getNode("SAVEPOINT")
		camDummy = createEntity("Empty")
		entity_warpToNode(camDummy, camNode)
		
		setCameraLerpDelay(1.0)
		
		cam_toEntity(camDummy)
		
		overrideZoom(0.75, 1)
	
	
		entity_animate(getNaija(), "look45", LOOP_INF, LAYER_HEAD)
		entity_swimToNode(camDummy, camNode2, SPEED_SLOW)
		entity_watchForPath(camDummy)
		voice("naija_memorycrystal")
		entity_swimToNode(camDummy, camNode3, SPEED_SLOW)
		entity_watchForPath(camDummy)
		entity_swimToNode(camDummy, camNode4, SPEED_SLOW)
		entity_watchForPath(camDummy)
		
		overrideZoom(0.6, 9)
		watch(9)
		
		screenFadeCapture()		
		--overrideZoom(1, 4)
				
		
		overrideZoom(0)
		setCameraLerpDelay(0.0001)
		cam_toEntity(n)
		
		screenFadeGo(6)
		watch(6)
		
		entity_idle(n)
		
		setCameraLerpDelay(0)
		entity_delete(camDummy)
	end
end

function update(me, dt)
	if node_isEntityIn(me, getNaija()) then
		run(me)
	end
end