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:moveplayercam(cameraname)
--	System:LogToConsole("Event_moveplayer");
	local camera=System:GetEntityByName(cameraname);
	if((camera)and(_localplayer))then
		local camerapos=camera:GetPos();
		camerapos.z=camerapos.z-1.7;
		_localplayer:SetPos(camerapos);
		_localplayer:SetAngles(camera:GetAngles());
	end
end

function Mission:Event_moveplayer()
	Mission:moveplayercam("jacks_new_position")
end

function Mission:Event_merctalk()
Hud:AddMessage("Merc: DON'T SHOOT!!! CARVER, HELP US STOP THESE THINGS!!!")
end

function Mission:Event_merctalk2()
Hud:AddMessage("Merc: TO ALL SQUADS! DO NOT ATTACK CARVER!! IGNORE ALL CONTRARY ORDERS!!!")
end

function Mission:Event_moveplayer2()
	Mission:moveplayercam("jacks_new_position")

	if (_localplayer) then
		local dir = new(_localplayer:GetDirectionVector());
		_localplayer:AddImpulseObj( dir, 300 );
	end
end


function Mission:Event_1stmessage()


--self.audio = Sound:LoadSound("LANGUAGES/missiontalk/dam/dam_specific_a_1.wav");
--	Sound:PlaySound(self.audio);

	--e_rain_amount = 0.2;
	Hud:AddMessage(Localize("NewObjective"),10);
	Hud:PushObjective({},Localize("GoToTheVulcanoLa"));
	
--	Hud:SetRadarObjective("heli");

		 
end





function Mission:Event_gate_message()


	Hud:SetRadarObjective("gate");

		 
end



function Mission:Event_lab_message()

	Hud:SetRadarObjective("lab");
	
		 
end


function Mission:Event_dam_rendered_cutseq()
	if (UI) then
		UI:PlayCutScene('dam.bik');
	end
	-- set the effect to 'mutated' hands
	_localplayer.iPlayerEffect = 6; 
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:Finish()
	-- go to next mission...
end
--
function Mission:Event_MissionFinished()
   System:LogToConsole('mission finished, loading next mission...');
	_localplayer.cnt:SavePlayerElements();
   Game:SendMessage('StartLevelFade Volcano');
end

-- InGameEvents

function Mission:Event_AB1_CollapsingWalkway()
  Movie:PlaySequence('AB1_CollapsingWalkway')
end

function Mission:Event_AB3_FloatingGun_1()
  Movie:PlaySequence('AB3_FloatingGun_1')
end


-- InGameMessage


--function Mission:Event_M1StartMessage()
--	Hud:AddMessage('Find the Volcano Laboratory! And get out of this building.',10);
--	Hud:PushObjective({},"Find the Volcano Laboratory!")
--end

--function Mission:Event_M2Rafthouse()
--	Hud:AddMessage('There is a raft tied up at the pier. Use it to go down the river!',10);
--	Hud:PushObjective({},"Use Raft!")
--end

--function Mission:Event_M3DamWall()
--	Hud:AddMessage('Watch out, there will be a lot of enemy activity here.',10);
--end

--function Mission:Event_M4Volcano()
--	Hud:AddMessage('Almost done. Will be hard to get inside!',10);
--end

--function Mission:Event_RaftMessage()
--	Hud:AddMessage('Shoot the shelves to get it loose!(!placeholder!)',10);
--	Hud:PushObjective({},"Shoot Shelfs!")
--end

--function Mission:Event_VolcanoLab()
--	Hud:AddMessage('You got it! Be careful inside ... ( !Mission 11 finished!)',10);
--end

--function Mission:Event_nomorphers()
--	Hud:AddMessage('Outdoor morphing mutants not working at the moment!',10);
--end






