//==========================================================================================
//
//	[dark]-siege_beta.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
//	palota	02 May 2011	Initial Script
//	palota	29 April 2012	roles, DEFEND_checkpoint, DEFEND_cap, MOBILEMG42, CALLARTILLERY_depot, more allied covertops when tank is near cannons
//
//==========================================================================================
//

global Map =
{
	Debug = 0,
	Movers = { "MOVER_tank" },

	barrierDestroyed = false,
	bridgeDestroyed = true,
	northCannonDestroyed = false,
	southCannonDestroyed = false,
	eastAADestroyed = false,
	westAADestroyed = false,
	eastTowerDestroyed = false,
	westTowerDestroyed = false,
	flagAxis = true,
	tankPosition = 0,
	FocusPrimary = false,

	Est_Entrance_Dyno = 0,
	East_Anti_Air_Cannon_Dyno = 0,
	West_Anti_Air_Cannon_Dyno = 0,

	Roles =
	{
		AXIS =
		{
			AllBots = true,
			DEFENDER =
			{
				numbots = 9,
			},
			ATTACKER1 =
			{
				numbots = 8,
			},
			ATTACKER2 =
			{
				numbots = 3,
			},
		},
		ALLIES =
		{
			AllBots = true,
			DEFENDER1 =
			{
				numbots = 3,
			},
			DEFENDER2 =
			{
				numbots = 3,
			},
			DEFENDER3 =
			{
				numbots = 3,
			},
			ATTACKER =
			{
				numbots = 10,
				crucialClass = CLASS.ENGINEER,
			},
		},
	},

	SetEscort = function()
	{
		b = true;
		if(Map.tankPosition == 1){ b = !Map.bridgeDestroyed; }
		if(Map.tankPosition == 10){ b = Map.barrierDestroyed; }
		if(Map.tankPosition == 20){ b = Map.northCannonDestroyed && Map.southCannonDestroyed; }
		SetAvailableMapGoals( TEAM.ALLIES, b, "ESCORT_tank" );
	},

	Tank_Arrived = function( trigger )
	{
		if(Map.tankPosition>=20){
			Server.MinClassCount[TEAM.ALLIES][CLASS.COVERTOPS] -= 2;
		}
		Map.tankPosition = 0;
		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*MG42_axis_bunker",
			".*MG42_Axis_Depot_MG",
			"MOBILEMG42_axis.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"PLANT_Axis_Depot_MG",
			"PLANT_.*_Anti_Tank_Cannon",
			"GRENADE_axis_bunker",
			"CALLARTILLERY_depot1",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier" );
		SetGoalPriority( "ATTACK_v2.*", 0.5);
		Util.SetMaxUsers(1, "ESCORT_tank");
		ETUtil.SetStartIndex("BUILD_Tank", -1);
		Util.OnTriggerPosition("MOVER_tank", "tank_bridge", 250.0, Map.Tank_Bridge);
		Util.MapDebugPrint( "Tank_Arrived" );
	},

	Tank_Bridge = function( trigger )
	{
		Map.tankPosition = 1;
		Map.SetEscort();
		SetGoalPriority( "BUILD_HQ_Bridge", 0.95, TEAM.ALLIES);
		Util.OnTriggerPosition("MOVER_tank", "past_bridge", 200.0, Map.Tank_Past_Bridge);
		Util.MapDebugPrint( "Tank_Bridge" );
	},

	Tank_Past_Bridge = function( trigger )
	{
		Map.tankPosition = 2;
		Map.SetEscort();
		SetGoalPriority( "BUILD_HQ_Bridge", 0.85, TEAM.ALLIES);
		Util.OnTriggerPosition("MOVER_tank", "tank_barrier", 200.0, Map.Tank_Barrier);
		Util.MapDebugPrint( "Tank_Past_Bridge" );
	},

	HQ_Bridge_Built = function( trigger )
	{
		Map.bridgeDestroyed = false;
		Map.SetEscort();
		Util.EnableGoal("ROUTE_bridge");
		Util.MapDebugPrint( "HQ_Bridge_Built" );
	},

	HQ_Bridge_Destroyed = function( trigger )
	{
		Map.bridgeDestroyed = true;
		Map.SetEscort();
		Util.DisableGoal("ROUTE_bridge");

		Util.MapDebugPrint( "HQ_Bridge_Destroyed" );
	},

	Est_Entrance_Built = function( trigger )
	{
		Util.DisableGoal("ROUTE_east_entrance");
		SetAvailableMapGoals( TEAM.ALLIES, false, ".*MG42_tunnel" );
		Util.MapDebugPrint( "Est_Entrance_Built" );
	},

	Est_Entrance_Destroyed = function( trigger )
	{
		Util.EnableGoal("ROUTE_east_entrance");
		Map.Est_Entrance_Dyno = 0;

		Util.MapDebugPrint( "Est_Entrance_Destroyed" );
	},

	Tank_Barrier = function( trigger )
	{
		Map.tankPosition = 10;
		Map.SetEscort();
		SetGoalPriority( "PLANT_Tank_Barrier", 0.95, TEAM.ALLIES);
		Util.OnTriggerPosition("MOVER_tank", "past_barrier", 200.0, Map.Tank_Past_Barrier);
		Util.MapDebugPrint( "Tank_Barrier" );
	},

	Tank_Barrier_Built = function( trigger )
	{
		Map.barrierDestroyed = false;
		Map.SetEscort();
		Util.MapDebugPrint( "Tank_Barrier_Built" );
	},

	Tank_Barrier_Destroyed = function( trigger )
	{
		Map.barrierDestroyed = true;
		Map.SetEscort();
		Util.MapDebugPrint( "Tank_Barrier_Destroyed" );
	},

	Tank_Past_Barrier = function( trigger )
	{
		Map.tankPosition = 11;
		Map.SetEscort();
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			".*MG42_axis_bunker",
			".*MG42_Axis_Depot_MG",
			"MOBILEMG42_axis.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_Axis_Depot_MG",
			"PLANT_.*_Anti_Tank_Cannon",
			"GRENADE_axis_bunker",
			"CALLARTILLERY_depot1",
		});
		SetGoalPriority( "PLANT_Tank_Barrier", 0.81, TEAM.ALLIES);
		Util.SetMaxUsers(2, "ESCORT_tank");
		ETUtil.SetStartIndex("BUILD_Tank", 0);
		Util.OnTriggerPosition("MOVER_tank", "tank_cannons", 290.0, Map.Tank_Cannons);
		Util.MapDebugPrint( "Tank_Past_Barrier" );
	},

	Tank_Cannons = function( trigger )
	{
		Map.tankPosition = 20;
		Map.SetEscort();
		Util.OnTriggerPosition("MOVER_tank", "tank_cannons2", 200.0, Map.Tank_Near_Cannons);
		Server.MinClassCount[TEAM.ALLIES][CLASS.COVERTOPS] += 2;
		Util.MapDebugPrint( "Tank_Cannons" );
	},

	North_Anti_Tank_Cannon_Built = function( trigger )
	{
		Map.northCannonDestroyed = false;
		Map.SetEscort();
		Util.MapDebugPrint( "North_Anti_Tank_Cannon_Built" );
	},

	North_Anti_Tank_Cannon_Destroyed = function( trigger )
	{
		Map.northCannonDestroyed = true;
		Map.SetEscort();
		Util.MapDebugPrint( "North_Anti_Tank_Cannon_Destroyed" );
	},

	South_Anti_Tank_Cannon_Built = function( trigger )
	{
		Map.southCannonDestroyed = false;
		Map.SetEscort();
		Util.MapDebugPrint( "South_Anti_Tank_Cannon_Built" );
	},

	South_Anti_Tank_Cannon_Destroyed = function( trigger )
	{
		Map.southCannonDestroyed = true;
		Map.SetEscort();
		Util.MapDebugPrint( "South_Anti_Tank_Cannon_Destroyed" );
	},

	Tank_Near_Cannons = function( trigger )
	{
		Map.tankPosition = 21;
		Map.SetEscort();
		SetGoalPriority( "ATTACK_v2.*", 0.67);
		SetAvailableMapGoals( TEAM.ALLIES, false, "CALLARTILLERY_depot1" );
		Util.MapDebugPrint( "Tank_Near_Cannons" );
	},

	East_Anti_Air_Cannon_Destroyed = function( trigger )
	{
		Map.eastAADestroyed = true;
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_east_aa.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_east_aa.*" );
		if (Map.westAADestroyed){
			SetGoalRole( "FLAG_docs", ROLE.ATTACKER2);
		}
		SetGoalRole({ "DEFEND_west_aa.*", "DEFEND_docs.*" }, ROLE.DEFENDER1);
		Map.East_Anti_Air_Cannon_Dyno = 0;

		Util.MapDebugPrint( "East_Anti_Air_Cannon_Destroyed" );
	},

	West_Anti_Air_Cannon_Destroyed = function( trigger )
	{
		Map.westAADestroyed = true;
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_west_aa.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_west_aa.*" );
		if (Map.eastAADestroyed){
			SetGoalRole( "FLAG_docs", ROLE.ATTACKER2);
		}
		SetGoalRole({ "DEFEND_east_aa.*", "DEFEND_docs.*" }, ROLE.DEFENDER2);
		Map.West_Anti_Air_Cannon_Dyno = 0;

		Util.MapDebugPrint( "West_Anti_Air_Cannon_Destroyed" );
	},

	docs_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_docs.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_cap.*" );
		Util.MapDebugPrint( "docs_Taken" );
	},

	docs_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_cap.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_docs.*" );
		Util.MapDebugPrint( "docs_Returned" );
	},

	docs_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "FLAG_docs" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			".*MG42_docs_mg",
			"DEFEND_cap.*",
		});
		SetGoalRole({ "ATTACK_east_aa.*", "ATTACK_west_aa.*" }, ROLE.ATTACKER1);
		SetGoalRole({ "DEFEND_east_aa.*", "DEFEND_west_aa.*" }, ROLE.DEFENDER3);
		Util.MapDebugPrint( "docs_Secured" );
	},

	forward_spawn_Axis_Captured = function( trigger )
	{
		Map.flagAxis = true;
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOBILEMG42_l_checkpoint.*" );
		Util.LimitToTeam(TEAM.AXIS, ".*_Command_Post");
		SetAvailableMapGoals( TEAM.ALLIES, true, ".*MG42_docs_mg" );
		if (!Map.FocusPrimary){ SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_HQ_Bridge" ); }
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_HQ_Bridge" );
		if (Map.tankPosition <= 10){ SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier" ); }
		SetAvailableMapGoals( TEAM.ALLIES, false, "CALLARTILLERY_depot1" );
		SetAvailableMapGoals( TEAM.AXIS, true, ".*_Command_Post" );
		Util.MapDebugPrint( "forward_spawn_Axis_Captured" );
	},

	forward_spawn_Allies_Captured = function( trigger )
	{
		Map.flagAxis = false;
		SetAvailableMapGoals( TEAM.ALLIES, false, ".*MG42_docs_mg" );
		if (Map.tankPosition > 1){
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_HQ_Bridge" );
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_HQ_Bridge" );
		}
		if (Map.tankPosition >= 11){ SetAvailableMapGoals( TEAM.ALLIES, true, "CALLARTILLERY_depot1" ); }
		Util.LimitToTeam(TEAM.ALLIES, ".*_Command_Post");
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMG42_l_checkpoint.*" );
		Util.MapDebugPrint( "forward_spawn_Allies_Captured" );
	},


	East_Tower_Built = function( trigger )
	{
		Map.eastTowerDestroyed = false;
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNTMG42_East_MG_Tower" );
		SetGoalPriority( "BUILD_Tank", 0.91);
		Util.MapDebugPrint( "East_Tower_Built" );
	},

	East_Tower_Destroyed = function( trigger )
	{
		Map.eastTowerDestroyed = true;
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNTMG42_East_MG_Tower" );
		if(Map.westTowerDestroyed){
			SetGoalPriority( "BUILD_Tank", 0.9);
		}
		Util.MapDebugPrint( "East_Tower_Destroyed" );
	},

	West_Tower_Built = function( trigger )
	{
		Map.westTowerDestroyed = false;
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNTMG42_West_MG_Tower" );
		SetGoalPriority( "BUILD_Tank", 0.91);
		Util.MapDebugPrint( "West_Tower_Built" );
	},

	West_Tower_Destroyed = function( trigger )
	{
		Map.westTowerDestroyed = true;
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNTMG42_West_MG_Tower" );
		if(Map.eastTowerDestroyed){
			SetGoalPriority( "BUILD_Tank", 0.9);
		}
		Util.MapDebugPrint( "West_Tower_Destroyed" );
	},


	Est_Entrance_Planted = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, ".*MG42_tunnel" );
		Map.Est_Entrance_Dyno += 1;
		Util.MapDebugPrint( "Est_Entrance_Planted" );
	},

	Est_Entrance_Defused = function( trigger )
	{
		Map.Est_Entrance_Dyno -= 1;
		if (Map.Est_Entrance_Dyno == 0){
			SetAvailableMapGoals( TEAM.ALLIES, false, ".*MG42_tunnel" );
		}
		Util.MapDebugPrint( "Est_Entrance_Defused" );
	},

	East_Anti_Air_Cannon_Planted = function( trigger )
	{
		Map.East_Anti_Air_Cannon_Dyno += 1;
		Util.MapDebugPrint( "East_Anti_Air_Cannon_Planted" );
	},

	East_Anti_Air_Cannon_Defused = function( trigger )
	{
		Map.East_Anti_Air_Cannon_Dyno -= 1;
		Util.MapDebugPrint( "East_Anti_Air_Cannon_Defused" );
	},

	West_Anti_Air_Cannon_Planted = function( trigger )
	{
		Map.West_Anti_Air_Cannon_Dyno += 1;
		Util.MapDebugPrint( "West_Anti_Air_Cannon_Planted" );
	},

	West_Anti_Air_Cannon_Defused = function( trigger )
	{
		Map.West_Anti_Air_Cannon_Dyno -= 1;
		Util.MapDebugPrint( "West_Anti_Air_Cannon_Defused" );
	},

	two_minute = function( trigger )
	{
		if (GetGameTimeLeft() > 0)
		{
			Map.FocusPrimary = true;
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_.*_MG_Tower" );
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_HQ_Bridge" );
		}
		Util.MapDebugPrint( "two_minute" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "Allied team has built the HQ bridge!", Map.HQ_Bridge_Built );
	OnTrigger( "Axis team has destroyed the HQ bridge!", Map.HQ_Bridge_Destroyed );
	OnTrigger( "Allied team has destroyed the Tank Barrier!", Map.Tank_Barrier_Destroyed );
	OnTrigger( "Axis team has re-built the Tank Barrier!", Map.Tank_Barrier_Built );
	OnTrigger( "Axis capture the Main Entrance!", Map.forward_spawn_Axis_Captured );
	OnTrigger( "Allies capture the Main Entrance!", Map.forward_spawn_Allies_Captured );
	OnTrigger( "Allied team has built the East MG Tower!", Map.East_Tower_Built );
	OnTrigger( "Axis team has destroyed the East MG Tower!", Map.East_Tower_Destroyed );
	OnTrigger( "Allied team has built the West MG Tower!", Map.West_Tower_Built );
	OnTrigger( "Axis team has destroyed the West MG Tower!", Map.West_Tower_Destroyed );
	OnTrigger( "Allied team has re-built the East entrance!", Map.Est_Entrance_Built );
	OnTrigger( "Axis have breached the East entrance!!", Map.Est_Entrance_Destroyed );
	OnTrigger( "Allied team has destroyed the North Anti-Tank Cannon!!", Map.North_Anti_Tank_Cannon_Destroyed );
	OnTrigger( "Axis team has re-built the North Anti-Tank Cannon!!", Map.North_Anti_Tank_Cannon_Built );
	OnTrigger( "Allied team has destroyed the South Anti-Tank Cannon!!", Map.South_Anti_Tank_Cannon_Destroyed );
	OnTrigger( "Axis team has re-built the South Anti-Tank Cannon!!", Map.South_Anti_Tank_Cannon_Built );
	OnTrigger( "Axis has destroyed the East Flack Cannon!", Map.East_Anti_Air_Cannon_Destroyed );
	OnTrigger( "Axis has destroyed the West Flack Cannon!", Map.West_Anti_Air_Cannon_Destroyed );
	OnTrigger( "Axis has stolen the Allied battle plans!", Map.docs_Taken ); //this wm_announce text is in map script
	OnTrigger( "Axis have stolen the Allied battle plans!", Map.docs_Taken );
	OnTrigger( "Flag returned docs!", Map.docs_Returned );
	OnTrigger( "Axis has secured the Allied battle plans!", Map.docs_Secured );
	OnTrigger( "allies_tank_arrived", Map.Tank_Arrived );
	OnTrigger( "Axis team has ruined the Allied Tank! A new one is on it's route to the Allied base.", Map.Tank_Arrived );
	OnTrigger( "Planted at the East Anti-Air-Cannon.", Map.East_Anti_Air_Cannon_Planted );
	OnTrigger( "Planted at the West Anti-Air-Cannon.", Map.West_Anti_Air_Cannon_Planted );
	OnTrigger( "Planted at the Est Entrance.", Map.Est_Entrance_Planted );
	OnTrigger( "Defused at the East Anti-Air-Cannon.", Map.East_Anti_Air_Cannon_Defused );
	OnTrigger( "Defused at the West Anti-Air-Cannon.", Map.West_Anti_Air_Cannon_Defused );
	OnTrigger( "Defused at the Est Entrance.", Map.Est_Entrance_Defused );
	OnTrigger( "two minute warning.", Map.two_minute );

	Util.DisableGoal("ROUTE_east_entrance");
	Util.DisableGoal("ROUTE_bridge");
	Util.LimitToTeam(TEAM.AXIS, "ATTACK_east_aa.*");
	Util.LimitToTeam(TEAM.AXIS, "ATTACK_west_aa.*");
	Util.LimitToTeam(TEAM.AXIS, ".*cabinet"); //health and ammo in axis bunker
	Util.LimitToTeam(TEAM.AXIS, "DEFEND_checkpoint.*");
	Util.LimitToTeam(TEAM.ALLIES, "ESCORT_tank");
	Util.LimitToTeam(TEAM.ALLIES, "DEFEND_east_aa.*");
	Util.LimitToTeam(TEAM.ALLIES, "DEFEND_west_aa.*");
	Util.LimitToTeam(TEAM.ALLIES, "DEFEND_docs.*");
	Util.LimitToTeam(TEAM.ALLIES, "ATTACK_v2_.*");
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		".*_Command_Post",
		"PLANT_Axis_Depot_MG",
		"PLANT_.*_Anti_Tank_Cannon",
	});
	Util.DisableGoal("GRENADE_.*");
	Util.DisableGoal("DEFEND_cap.*");

	Util.DisableGoal(".*MG42_.*");
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"REPAIRMG42_East_MG_Tower",
		"REPAIRMG42_West_MG_Tower",
		".*MG42_docs_mg",
	});

	// Roles
	ClearGoalRole( "FLAG_docs", ROLE.ATTACKER2);
	ClearGoalRole({ "ATTACK_east_aa.*", "ATTACK_west_aa.*" }, ROLE.ATTACKER1);
	SetGoalRole( "FLAG_docs", ROLE.ATTACKER1);
	SetGoalRole({ "ATTACK_east_aa.*", "ATTACK_west_aa.*" }, ROLE.ATTACKER2);

	SetGoalRole( "CHECKPOINT_forward_spawn", { ROLE.ATTACKER, ROLE.DEFENDER });

	ClearGoalRole({ "DEFEND_west_aa.*", "DEFEND_docs.*" }, ROLE.DEFENDER1);
	ClearGoalRole({ "DEFEND_east_aa.*", "DEFEND_docs.*" }, ROLE.DEFENDER2);
	SetGoalRole({ "ESCORT_tank", "MOUNT_tank", "GRENADE_axis_bunker" }, ROLE.ATTACKER);
	SetGoalRole( "MOUNTMG42_tunnel", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole({ "DEFEND_east_aa.*", "MOUNTMG42_East_MG_Tower" }, ROLE.DEFENDER1);
	SetGoalRole({ "DEFEND_west_aa.*", "MOUNTMG42_West_MG_Tower" }, ROLE.DEFENDER2);
	SetGoalRole({ "DEFEND_docs.*", "MOUNTMG42_docs_mg" }, ROLE.DEFENDER3);

	// Priority
	SetGoalPriority( "CHECKPOINT_forward_spawn", 0.51, TEAM.AXIS);
	SetGoalPriority( "PLANT_.*_MG_Tower", 0.0, TEAM.AXIS, CLASS.ENGINEER);
	SetGoalPriority( "FLAG_docs", 0.5, TEAM.AXIS, CLASS.ENGINEER);

	SetGoalPriority( "BUILD_Tank", 0.91);
	SetGoalPriority( "MOUNT_tank", 0.7);
	SetGoalPriority( "ESCORT_tank", 0.69);
	SetGoalPriority( "MOUNTMG42_.*", 0.62);
	SetGoalPriority( "CHECKPOINT_forward_spawn", 0.61, TEAM.ALLIES);
	SetGoalPriority( "DEFEND_cap.*", 0.66);
	SetGoalPriority( "GRENADE.*", 0.55);
	SetGoalPriority( "DEFUSE_Est_Entrance.*", 0.9, TEAM.ALLIES, CLASS.ENGINEER, true);
	SetGoalPriority( "PLANT_Axis_Depot_MG", 0.8, TEAM.ALLIES, CLASS.COVERTOPS);
	SetGoalPriority( "PLANT_Axis_Depot_MG", 0.0, TEAM.ALLIES, CLASS.ENGINEER);

	// Max users per goal
	foreach (goal in { "DEFEND_.*", ".*MG42_.*", "GRENADE_.*", "CALLARTILLERY_.*",
		"*._Command_Post", "BUILD_Axis_Depot_MG", "BUILD_.*_MG_Tower",
		"BUILD_.*_Anti_Tank_Cannon", "BUILD_Est_Entrance" }){
		Util.SetMaxUsers(1, goal);
	}

	// Camp times
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=10, MaxCampTime=70} );
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=25, MaxCampTime=90} );

	// Use points
	Util.AddUsePoint("BUILD_Est_Entrance", Vector3(429.646, -951.034, 1160.125));
	Util.AddUsePoint("BUILD_East_MG_Tower", Vector3(-1422.278, 1041.602, 1182.297));
	Util.AddUsePoint("PLANT_East_MG_Tower", Vector3(-1535.365, 920.671, 1146.563));
	Util.AddUsePoint("PLANT_West_MG_Tower", Vector3(-2981.903, 907.603, 1252.831));
	Util.AddUsePoint("PLANT_South_Anti_Tank_Cannon", Vector3(1002.940, -1891.341, 1123.125));
	Util.AddUsePoint("PLANT_Tank_Barrier", Vector3(-1626.051, -1861.131, 1376.327));
	Util.SetGoalOffset(30, -30, 0, "MOUNTMG42_axis_bunker");

	Map.Tank_Arrived();

	MapRoutes =
	{
		FLAG_docs = {
			ROUTE_flag_spawn = {
				ROUTE_bridge = {},
				ROUTE_bridge_east = {},
				ROUTE_bridge_west = { ROUTE_north_tunnel = {}},
				ROUTE_east_entrance = { Weight=2 },
			},
			ROUTE_axis_spawn = {
				ROUTE_east_entrance = {},
				ROUTE_fence = {
					ROUTE_bridge_east = {},
					ROUTE_bridge_west = {},
				},
			},
		},
		CAPPOINT_truck = {
			ROUTE_docs = {
				ROUTE_north_tunnel = { Weight=2,
					ROUTE_bridge_west = {
						ROUTE_command_post = {},
						ROUTE_south_west = {},
					}
				},
				ROUTE_east_entrance = {},
				ROUTE_bridge_east = {},
			}
		},
		CHECKPOINT_forward_spawn = {
			ROUTE_allied_spawn = {
				ROUTE_fence = {},
				ROUTE_bridge_west = {
					ROUTE_south_west = {},
					ROUTE_command_post = {},
				},
				ROUTE_west_tunnel = { Weight=3 },
			},
			ROUTE_axis_spawn = {
				ROUTE_axis_north = { ROUTE_fence = { ROUTE_barrier = {}}},
				ROUTE_axis_south = {},
			},
		},
		MOUNTMG42_axis_bunker = {
			ROUTE_axis_spawn = { ROUTE_axis_tunnel = {}},
		},
		PLANT_Tank_Barrier = {
			ROUTE_allied_spawn = {
				ROUTE_bridge = {},
			}
		},
	};
	MapRoutes.REPAIRMG42_axis_bunker = MapRoutes.MOUNTMG42_axis_bunker;
	Util.Routes(MapRoutes);

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

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 90.0;
	bot.MaxViewDistance = 2440;
};
