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_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_OutsideMap()
--System:Log("setting timetodie to 1");
	_localplayer.timetodie=1;	
	_localplayer:SetTimer(100);
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