Mission = {
};


function Mission:OnInit()
end

-- we now have a localplayer
function Mission:OnSetPlayer()
	-- set the effect to 'mutated' hands
	_localplayer.iPlayerEffect = 6;
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:Event_CutScene01()
	if (UI) then
		UI:PlayCutScene('volcano01.bik');
	end
	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_CutScene02()
	if (UI) then
		UI:PlayCutScene('volcano02.bik');
	end
	
	
	
	local CutsceneJack=System:GetEntityByName("ProximityTrigger_MovePlayer1");
		if((CutsceneJack)and(_localplayer))then
--			System:LogToConsole("#################################################");					
			_localplayer:SetPos(new(CutsceneJack:GetPos()));
			_localplayer:SetAngles(new(CutsceneJack:GetAngles()));

	end
	if (tonumber(g_timezone) ~= tonumber(__tz1)) then g_timezone = __tz0; end
end

function Mission:Event_CutScene03()
	if (UI) then
		UI:PlayCutScene('volcano03.bik');
	end
end

function Mission:Event_ChopperAnimated()
Movie:PlaySequence("Chopper_Idling");
end



function Mission:Event_CutScene_FINAL()
	local EndSequence=
	{
	--	{"volcano_final.bik", 1},
--		{"languages/movies/credits.bik", 1},
	};
	
	if (UI) then
		VideoSequencer:Play(EndSequence, VideoSequencer.TerminateGame);
	end
end


function Mission:Event_Locate_Krieger()
--	Hud:AddMessage("Krieger is somewhere in his Jacutan Complex.",10);
--	Hud:AddMessage("Go and get your revenge!",10);
	Hud:AddMessage(Localize("NewObjective"),10);
	Hud:PushObjective({},Localize("FindKriegerInHis"));
--	Hud:SetRadarObjective("radarwaypoint1");
end


function Mission:Event_Locate_Doyle()
--	Hud:AddMessage("Doyle has the mutagen antiserum.",10);
--	Hud:AddMessage("Get the serum before he leaves!",10);
	Hud:AddMessage(Localize("NewObjective"),10);
	Hud:PushObjective({},Localize("GetTheSerumFromD"));
	Hud:CompleteObjective(Localize("FindKriegerInHis"));
--	Hud:SetRadarObjective("radarwaypoint2");
end

function Mission:Event_TestObj3()
Hud:CompleteObjective(Localize("GetTheSerumFromD"));
Hud:PushObjective({},"Return to exit");
end

function Mission:Event_Locate_BadNews()
Hud:AddMessage("Merc Leader: Bad news, Carver! The other forces are not going to cease fire!!!!");
end

function Mission:Event_Locate_BadNews2()
Hud:AddMessage("You'll have to shoot your way to Krieger. We'll do what we can.");
end

function Mission:Event_Locate_GoodNews()
Hud:AddMessage("Merc Gunship: We've got your back, Carver! Get moving!!!");
end

function Mission:Event_MessageTEST()
Hud:AddMessage("Pick Up The Anti-Serum From The Table.");
end

function Mission:Event_WaterFlooding()
Hud:AddMessage("Jack Carver: What the hell! This place is going to flood!!!");
end

function Mission:Event_WaterFlooding2()
Hud:CompleteObjective("Return to exit");
Hud:AddMessage("GET OUT!!!");
end

function Mission:Event_WaterFlooding3()
Hud:AddMessage("Merc on radio: Carver! Are you there? You're not going to believe this....");
end

function Mission:Event_WaterFlooding4()
Hud:AddMessage("Jack Carver: What, like all that water coming in? It was really believable.");
end

function Mission:Event_WaterFlooding5()
Hud:AddMessage("Merc on radio: No, Carver. It's everywhere. Comms to the outside world are down.....");
end

function Mission:Event_WaterFlooding6()
Hud:AddMessage("Something's damaged the gps systems.... It doesn't look good.");
end

function Mission:Event_WaterFlooding7()
Hud:AddMessage("Jack Carver: Have you found Valerie?");
end

function Mission:Event_WaterFlooding8()
Hud:AddMessage("Merc on radio: Yes, she's with the evac unit in the crater; she was given a dose of the antigen and she's improving.");
end
function Mission:Event_FoundANTI()
Hud:AddMessage("JACK CARVER: I've found the antidote.");
end

function Mission:Event_FoundANTI2()
Hud:AddMessage("Merc On Radio: Carver, head back to the exit.");
end

function Mission:Event_Demand()
Hud:AddMessage("Merc: Sir, please hand over the antidote sample.");
end


function Mission:Event_Demand2()
Hud:AddMessage("Jack Carver: No!");
end

function Mission:Event_Demand3()
Hud:AddMessage("Merc: You're allowed to keep an injection for yourself and your friend.");
end

function Mission:Event_Demand4()
Hud:AddMessage("Give him the antidote.");
end

function Mission:Event_Demand5()
Hud:AddMessage("Merc: Thank you. Just head back the way you got in.");
end

function Mission:Event_LEAVE()
Hud:AddMessage("Jack Carver: Let's get out of here, before this place erupts!!");
end

function Mission:Event_OutsideMap()
--System:Log("setting timetodie to 1");
	_localplayer.timetodie=1;	
	_localplayer:SetTimer(100);
end
---------------------------------------------------------
---------------------------------------------------------
--Unused, due to development of BETA 5 cut short.
--Would have been good, though. A whole new series of maps,
--modelled after Robert-33's dropped Mod "MercWar."
--Future Version, perhaps?

function Mission:Event_ENDII()
Hud:AddMessage("END OF FC MAIN");
Game:SendMessage("StartLevelFade MercWar");
end
--------------------------------------------------------
--------------------------------------------------------
function Mission:Event_ValerieDiesMissionFailed()	

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