// Map script for Decrypted

global Map =
{

	doorsOpen = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_docs.*" );
		Util.MapDebugPrint("doorsOpen!!!");
	},

	wallBlown = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_brickwall" );
		Util.MapDebugPrint("wallBlown!!!");
	},

	docsCaptured = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_cappoint.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_cappoint.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_docs.*" );
		Util.MapDebugPrint("docsCaptured!!!");
	},

	docsLost = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_cappoint.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_cappoint.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_docs.*" );
		Util.MapDebugPrint("docsLost!!!");
	},

};

global OnMapLoad = function()
{
	OnTrigger( "mainwall_axis_breach", Map.doorsOpen );
	OnTrigger( "Allies have blow the Brick Wall", Map.wallBlown );
	OnTrigger( "Allies have stolen The Decripted Message!", Map.docsCaptured );
	OnTrigger( "Flag returned documents!", Map.docsLost );

	brickwall = GetGoal("PLANT_Brick_Wall");
	if ( brickwall )
	{
		brickwall.AddUsePoint( Vector3(1500, -1000, -80) );
		brickwall.AddUsePoint( Vector3(1550, -1000, -80) );
	}

	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_.*" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_.*" );
	SetGoalPriority( "CHECKPOINT_flag_script", 0.8 );

	Util.SetGoalOffset( 20, 20, -130, "PLANT_Main_Doors" );

	Util.SetMaxUsersInProgress( 3, "CHECKPOINT_.*" );
	Util.SetMaxUsersInProgress( 3, "FLAG_.*" );

	// *** ROUTES ***
	Maproutes =
	{
		FLAG_documents =
		{
			ROUTE_doors =
			{
				ROUTE_leftdoor = {},
				ROUTE_rightdoor = {},
			},
			ROUTE_allied_spawn =
			{
				ROUTE_doors =
				{
					ROUTE_leftdoor = {},
					ROUTE_rightdoor = {},
				},
				ROUTE_brickwall2 =
				{
					ROUTE_leftdoor = {},
					ROUTE_rightdoor = {},
				}
			},
			ROUTE_forward_spawn =
			{
				ROUTE_leftdoor = {},
				ROUTE_rightdoor = {},
			}
		},
		CAPPOINT_197 =
		{
			ROUTE_docs =
			{
				ROUTE_stairs = {},
				ROUTE_brickwall = {},
			}
		},
		CHECKPOINT_flag_script =
		{
			ROUTE_allied_spawn =
			{
				ROUTE_stairs = {},
				ROUTE_brickwall2 = {},
			}
		},
	};
	Util.Routes(Maproutes);

	SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_brickwall" );

	Util.MapDebugPrint("Omni-bot map script for Decrypted executed.");
};

global OnBotJoin = function( _bot )
{
};
