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_MissionFinished()
	_localplayer.cnt:SavePlayerElements();
	Game:SendMessage('StartLevelFade Training');
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_GameSaved()
-- displays game saved message
Hud:AddMessage("Game Saved", 60);
end

function Mission:Event_FlashObj()
-- Flash All Objectives
Hud:AddMessage("All Objectives Flashed", 60);
Hud:FlashObjectives({},"");
end

function Mission:Event_GearUp()
-- Gear Up
Hud:PushObjective({},"Gear Up! Locate Weapons and Ammo.");
Hud:SetRadarObjective("nil");
end

function Mission:Event_FindHut()
Hud:AddMessage("New Mission Objectives", 60);
Hud:PushObjective({},"Find Information Regarding Recent Events on the Island.");
Hud:SetRadarObjective("FindHut");
end

function Mission:Event_Sniper_Tower()
-- Sniper Tower
Hud:AddMessage("New Mission Objective", 60);
Hud:PushObjective({},"Take out Sniper. Reach the High Ground.");
Hud:SetRadarObjective("nil");
end

function Mission:Event_Sniper_TowerCompleted()
-- Sniper Tower Completed
Hud:AddMessage("Objective Complete", 60);
Hud:CompleteObjective("Take out Sniper. Reach the High Ground.");
end

function Mission:Event_RoadBlock()
-- Locate Lieutenant and Retrieve Credentials
Hud:AddMessage("New Mission Objective", 60);
Hud:PushObjective({},"Locate Lieutenant and Retrieve Credentials.");
Hud:CompleteObjective("Gear Up! Locate Weapons and Ammo.");
Hud:CompleteObjective("Find Information Regarding Recent Events on the Island.");
Hud:SetRadarObjective("RoadBlock");
end

function Mission:Event_EastHut()
-- Find Computer Terminal. Use Credentials to Gain Access.
Hud:AddMessage("New Mission Objective", 60);
Hud:PushObjective({},"Find Computer Terminal. Use Credentials to Gain Network Access.");
Hud:CompleteObjective("Locate Lieutenant and Retrieve Credentials.");
Hud:SetRadarObjective("EastHut");
end
 
function Mission:Event_WestHut()
-- Locate and Enter Hut on West Coast of the Island.
Hud:AddMessage("New Mission Objective", 60);
Hud:PushObjective({},"Locate and Enter the Hut on West Coast of the Island.");
Hud:CompleteObjective("Find Computer Terminal. Use Credentials to Gain Network Access.");
Hud:SetRadarObjective("WestHut");
end

function Mission:Event_Encampment()
-- Find Credentials to Gain Access to the Shipyard Grounds.
Hud:AddMessage("New Mission Objective", 60);
Hud:PushObjective({},"Find Credentials to Gain Access to the Shipyard Grounds.");
Hud:CompleteObjective("Locate and Enter the Hut on West Coast of the Island.");
Hud:SetRadarObjective("Encampment");
end