Mission = {
};


function Mission:OnInit()
	-- you may want to load a string-table etc. here...
end

function Mission:OnUpdate()
	local i;
	local bFinished=1;
	for i,objective in Mission do
		if (type(objective)~="function") then
			if (objective==0) then 
				bFinished=0;				
			else
			end
		end	
	end
	if (bFinished==1) then	
		self.Finish();
	end
end


function Mission:Finish()
	-- go to next mission...
end


function Mission:Event_platformovie()

Movie:PlaySequence('platform');	
	
end

function Mission:Event_c130()

Movie:PlaySequence('c130');	

end

function Mission:Event_deltoplans()

Movie:PlaySequence('deltoplans');	

end

function Mission:Event_luk()

Movie:PlaySequence('luk');	
	
end

function Mission:Event_shark()

Movie:PlaySequence('shark');	
	
end

function Mission:Event_mutants()

Movie:PlaySequence('mutants');	
	
end

function Mission:Event_gates()

Movie:PlaySequence('gates');	
	
end

function Mission:Event_bigtrack()

Movie:PlaySequence('bigtrack');	
	
end

function Mission:Event_canon1()

Movie:PlaySequence('canon1');	
	
end


function Mission:Event_canon2()

Movie:PlaySequence('canon2');	
	
end

function Mission:Event_canon3()

Movie:PlaySequence('canon3');	
	
end

function Mission:Event_final()

Movie:PlaySequence('final');	
	
end

function Mission:Event_relocateplayer()
	
	local CutsceneJack=System:GetEntityByName("ProximityTrigger_MovePlayer");
		if((CutsceneJack)and(_localplayer))then
--			System:LogToConsole("#################################################");					
			_localplayer:SetPos(new(CutsceneJack:GetPos()));
			_localplayer:SetAngles(new(CutsceneJack:GetAngles()));

	end	
end

function Mission:Event_relocateplayer1()
	
	local CutsceneJack=System:GetEntityByName("ProximityTrigger_MovePlayer1");
		if((CutsceneJack)and(_localplayer))then
--			System:LogToConsole("#################################################");					
			_localplayer:SetPos(new(CutsceneJack:GetPos()));
			_localplayer:SetAngles(new(CutsceneJack:GetAngles()));

	end	
end



function Mission:Event_MissionFailed()	

	if (god) then
		god=nil;
	end	
	local ent = System:GetEntityByName("DelayTrigger20");	
	local pos=new(ent:GetPos());
	local ang=new(ent:GetAngles());
	_localplayer:SetPos(pos);
	_localplayer:SetAngles(ang);
	_localplayer.timetodie=1;	
	
end

function Mission:Event_start()
Hud:AddMessage("New objective",15)
Hud:PushObjective({},"Jump!")
end


function Mission:Event_artefacts()
Hud:CompleteObjective("Jump!")
Hud:FlashObjectives({},"");
Hud:AddMessage("New objective",15)
Hud:PushObjective({},"Find artefact globe")
Hud:PushObjective({},"Find artefact butterfly")
Hud:PushObjective({},"Find artefact skull")
Hud:PushObjective({},"Find artefact sphere")
Hud:PushObjective({},"Find artefact flag")
Hud:PushObjective({},"Find artefact plate")
Hud:PushObjective({},"Find artefact rock")
Hud:PushObjective({},"Find artefact idol")
Hud:PushObjective({},"Find artefact tablet")
Hud:PushObjective({},"Find artefact frog")
end


function Mission:Event_globe()
Hud:CompleteObjective("Find artefact globe")
end


function Mission:Event_skull()
Hud:CompleteObjective("Find artefact skull")
end


function Mission:Event_sphere()
Hud:CompleteObjective("Find artefact sphere")
end

function Mission:Event_plate()
Hud:CompleteObjective("Find artefact plate")
end

function Mission:Event_idol()
Hud:CompleteObjective("Find artefact idol")
end

function Mission:Event_tablet()
Hud:CompleteObjective("Find artefact tablet")
end

function Mission:Event_butterfly()
Hud:CompleteObjective("Find artefact butterfly")
end

function Mission:Event_rock()
Hud:CompleteObjective("Find artefact rock")
end

function Mission:Event_frog()
Hud:CompleteObjective("Find artefact frog")
end

function Mission:Event_flag()
Hud:CompleteObjective("Find artefact flag")
end

function Mission:Event_exit()
Hud:FlashObjectives({},"");
Hud:AddMessage("New objective",15)
Hud:PushObjective({},"Leave island")
Hud:SetRadarObjective("radar2")
end

function Mission:Event_explo()
Hud:AddMessage("New objective",15)
Hud:PushObjective({},"Take explosion")
Hud:SetRadarObjective("radar3")
end

function Mission:Event_exit2()
Hud:CompleteObjective("Take explosion")
Hud:SetRadarObjective("radar4")
end

function Mission:Event_motoplatform()
Hud:AddMessage("USE MOTOPLATFORM",60)
end

function Mission:Event_missionfinished()
Game:SendMessage('StartLevelFade Fort');
end

function Mission:Event_screenfadeout()
System:SetScreenFx("ScreenFade" , 1);                            	
--System:SetScreenFxParamFloat("ScreenFade", "ScreenPreFadeTime", 10);
System:SetScreenFxParamFloat("ScreenFade", "ScreenFadeTime", 3);
end

function Mission:Event_power()
Hud:AddMessage("Turn off power on the dam to open the door ",30)
end