//==========================================================================================
//
//	the_moskeeb1.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
// palota	13 May 2010	Initial script
// palota	27 November 2010	axis role to defend side door and bar spawn, ForceRouting to build tank or boat, GRENADE_depot_mg,
//       	BUILD_Boat has jump stance, escort is disabled at tank barriers, MOUNT_tank aim vector, boat barrier2 has 2 plant positions,
//       	tank barrier 1 has use point, new route to mg42_bank, coverspots, changed spawns
//==========================================================================================
//
global Map =
{
	Movers = { "MOVER_tank", "MOVER_truck" }, //truck is boat

	phase = 0,
	barrier1Destroyed = true,
	barrier2Destroyed = true,
	boatBarrier1Destroyed = true,
	boatBarrier2Destroyed = false,
	sideDoorDestroyed = false,
	barCaptured = false,

	Roles =
	{
		AXIS =
		{
			DEFENDER2 =
			{
				numbots = 3,
			},
		},
	},

	SetSpawn1 = function(bot)
	{
		if(bot.GetTeam()==TEAM.ALLIES){
			if(Map.phase < 10 && RandInt(0,2)==0)
			{
				bot.ChangeSpawnPoint(2); //helicopter
			}
			else if(Map.barCaptured &&
				( Map.phase < 10
				|| Map.phase >= 18 && Map.phase < 40
				|| Map.phase >= 15 && RandInt(0,1)==0))
			{
				bot.ChangeSpawnPoint(5); //bar
			}else{
				bot.ChangeSpawnPoint(1); //church at tank depot
			}
		}else{ //AXIS
			if(Map.phase < 10)
			{
				bot.ChangeSpawnPoint(1); //depot bunker
			}
			else
			{
				if(Map.phase < 16){ p=13; } //tank at barrier 1
				else if(Map.phase < 20){ p=5; } //tank near port
				else if(Map.phase < 40){ p=2; } //tank pass barrier 2
				else{ p=9; } //escort boat
				if(RandInt(0,p)<=1){
					bot.ChangeSpawnPoint(3); //axis spawn
				}else{
					bot.ChangeSpawnPoint(4); //port
				}
			}
		}
	},

	SetSpawn = function()
	{
		foreach(bot in BotTable)
		{
			Map.SetSpawn1(bot);
		}
	},

	Bar_Captured = function()
	{
		Map.barCaptured = true;
		SetAvailableMapGoals(TEAM.AXIS, false, {
			"DEFEND_bar.*",
			"DEFEND_beach.*",
		});
		SetAvailableMapGoals(TEAM.AXIS, true, "CHECKPOINT_rien_du_tout");
		if (!Map.sideDoorDestroyed){
			SetAvailableMapGoals(TEAM.AXIS, true, "DEFEND_side_door.*");
			SetAvailableMapGoals(TEAM.ALLIES, true, "PLANT_Side_Door__bunker");
		}
		Map.SetSpawn();
		Util.MapDebugPrint("Bar_Captured");
	},

	Bar_Reclaimed = function()
	{
		Map.barCaptured = false;
		SetAvailableMapGoals(TEAM.AXIS, true, "DEFEND_bar.*");
		if (!Map.sideDoorDestroyed && Map.phase<15){
			SetAvailableMapGoals(TEAM.ALLIES, false, "PLANT_Side_Door__bunker");
		}
		SetAvailableMapGoals(TEAM.AXIS, false, "CHECKPOINT_rien_du_tout");
		Map.SetSpawn();
		Util.MapDebugPrint("Bar_Reclaimed");
	},

	Port_Captured = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, true, "CHECKPOINT_rien_du_tout_1");
		Util.MapDebugPrint("Port_Captured");
	},

	Port_Reclaimed = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, false, "CHECKPOINT_rien_du_tout_1");
		Util.MapDebugPrint("Port_Reclaimed");
	},

	Tank_Barrier1_Constructed = function()
	{
		Map.barrier1Destroyed = false;
		Util.MapDebugPrint("Tank_Barrier1_Constructed");
	},

	Tank_Barrier1_Destroyed = function()
	{
		Map.barrier1Destroyed = true;
		if (Map.phase==13){
			SetAvailableMapGoals(TEAM.ALLIES, true, "ESCORT_tank");
		}
		Util.MapDebugPrint("Tank_Barrier1_Destroyed");
	},

	Tank_Barrier2_Constructed = function()
	{
		Map.barrier2Destroyed = false;
		Util.MapDebugPrint("Tank_Barrier2_Constructed");
	},

	Tank_Barrier2_Destroyed = function()
	{
		Map.barrier2Destroyed = true;
		if (Map.phase==20){
			SetAvailableMapGoals(TEAM.ALLIES, true, "ESCORT_tank");
		}
		Util.MapDebugPrint("Tank_Barrier2_Destroyed");
	},

	Tank_Depot_Door_Destroyed = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, true, {
			"ESCORT_tank",
			"BUILD_Tank",
		});
		Util.ForceRouting("BUILD_Tank", true);
		Util.MapDebugPrint("Tank_Depot_Door_Destroyed");
	},

	Side_Door__bunker_Destroyed = function()
	{
		Map.sideDoorDestroyed = true;
		Util.EnableGoal("ROUTE_side_door");
		SetAvailableMapGoals(TEAM.AXIS, false, "DEFEND_side_door.*");
		SetAvailableMapGoals(TEAM.ALLIES, false, "DEFEND_a_side_door.*");
		SetGoalPriority("REPAIRMG42_mg42_bank", 0.9);
		Util.MapDebugPrint("Side_Door__bunker_Destroyed");
	},

	Tank_Stolen = function()
	{
		Map.phase = 10;
		Map.SetSpawn();
		Util.SetMaxUsersInProgress(2, "CHECKPOINT_rien_du_tout_1");
		SetAvailableMapGoals(TEAM.AXIS, false, "DEFEND_depot.*");
		SetAvailableMapGoals(TEAM.ALLIES, false, {
			"ATTACK_depot.*",
			"SNIPE_depot1",
			".*MG42_mg42_bank",
			"GRENADE_depot_mg",
		});
		SetAvailableMapGoals(TEAM.AXIS, true, {
			"ATTACK_tank1",
			"BUILD_Tank_Barrier_2",
		});
		SetAvailableMapGoals(TEAM.ALLIES, true, {
			".*Command_Post",
			"ATTACK_tank6",
			"PLANT_Tank_Barrier_1",
			"BUILD_Allied_MG42_Construction",
			".*MG42_alliedconstruct1_track",
			".*MG42_mg42_bank_1",
			"MOUNT_tank",
		});
		SetGoalPriority("CHECKPOINT_rien_du_tout_1", 0.71);
		Util.ForceRouting("BUILD_Tank", false);
		Util.OnTriggerPosition("MOVER_tank", "tank_turn1", 200.0, Map.Tank_Turn1);
		Util.MapDebugPrint("Tank_Stolen");
	},

	Tank_Damaged = function()
	{
		Util.MapDebugPrint("Tank_Damaged");
	},

	Tank_Repaired = function()
	{
		Util.MapDebugPrint("Tank_Repaired");
	},

	Tank_Turn1 = function()
	{
		SetAvailableMapGoals(TEAM.AXIS, true, {
			"ATTACK_tank2",
			"SNIPE_crane",
		});
		SetAvailableMapGoals(TEAM.ALLIES, true, "ATTACK_barrier1_.*");
		Util.OnTriggerPosition("MOVER_tank", "tank_barrier1", 200.0, Map.Tank_Barrier1);
		Util.MapDebugPrint("Tank_Turn1");
	},

	Tank_Barrier1 = function()
	{
		Map.phase = 13;
		if(!Map.barrier1Destroyed){
			SetAvailableMapGoals(TEAM.ALLIES, false, "ESCORT_tank");
		}
		SetGoalPriority("PLANT_Tank_Barrier_1", 0.95, TEAM.ALLIES);
		ETUtil.SetAimModeForMount("MOUNT_tank", Vector3(8665, 1668, 10));
		Util.OnTriggerPosition("MOVER_tank", "tank_turn2", 200.0, Map.Tank_Turn2);
		Util.MapDebugPrint("Tank_Barrier1");
	},

	Tank_Turn2 = function()
	{
		Map.phase = 15;
		Map.SetSpawn();
		if (!Map.sideDoorDestroyed){
			SetAvailableMapGoals(TEAM.ALLIES, true, "DEFEND_a_side_door.*");
		}
		SetAvailableMapGoals(TEAM.AXIS, false, "ATTACK_tank1");
		SetAvailableMapGoals(TEAM.ALLIES, false, ".*MG42_mg42_bank_1");
		SetAvailableMapGoals(TEAM.AXIS, true, "PLANT_Right_bridge");
		SetAvailableMapGoals(TEAM.ALLIES, true, {
			"ATTACK_barrier2_.*",
			"PLANT_Tank_Barrier_2",
		});
		Util.OnTriggerPosition("MOVER_tank", "tank_turn3", 200.0, Map.Tank_Turn3);
		Util.MapDebugPrint("Tank_Turn2");
	},

	Tank_Turn3 = function()
	{
		Map.phase = 16;
		Map.SetSpawn();
		SetAvailableMapGoals(TEAM.AXIS, false, "ATTACK_tank2");
		SetAvailableMapGoals(TEAM.ALLIES, false, {
			"ATTACK_barrier1_.*",
			"ATTACK_tank6",
		});
		SetAvailableMapGoals(TEAM.AXIS, true, "ATTACK_tank3");
		SetAvailableMapGoals(TEAM.ALLIES, true, "ATTACK_tank7");
		SetGoalPriority("BUILD_Tank", 0.91, TEAM.ALLIES);
		SetGoalPriority("PLANT_Side_Door__bunker", 0.95, TEAM.ALLIES);
		ETUtil.SetAimModeForMount("MOUNT_tank", Vector3(8132, 5127, -87));
		Util.OnTriggerPosition("MOVER_tank", "tank_turn4", 200.0, Map.Tank_Turn4);
		Util.MapDebugPrint("Tank_Turn3");
	},

	Tank_Turn4 = function()
	{
		Map.phase = 18;
		Map.SetSpawn();
		SetAvailableMapGoals(TEAM.AXIS, true, "ATTACK_tank4");
		Util.OnTriggerPosition("MOVER_tank", "tank_barrier2", 240.0, Map.Tank_Barrier2);
		Util.MapDebugPrint("Tank_Turn4");
	},

	Tank_Barrier2 = function()
	{
		Map.phase = 20;
		Map.SetSpawn();
		if(!Map.barrier2Destroyed){
			SetAvailableMapGoals(TEAM.ALLIES, false, "ESCORT_tank");
		}
		SetGoalPriority("PLANT_Tank_Barrier_2", 0.95, TEAM.ALLIES);
		SetAvailableMapGoals(TEAM.AXIS, true, "ATTACK_tank5");
		Util.OnTriggerPosition("MOVER_tank", "tank_turn5", 250.0, Map.Tank_Turn5);
		Util.MapDebugPrint("Tank_Barrier2");
	},

	Tank_Turn5 = function()
	{
		Map.phase = 21;
		SetAvailableMapGoals(TEAM.AXIS, false, "ATTACK_tank3");
		SetAvailableMapGoals(TEAM.ALLIES, false, "ATTACK_barrier2_.*");
		SetAvailableMapGoals(TEAM.ALLIES, true, "BUILD_Right_bridge");
		SetGoalPriority("PLANT_Tank_Barrier_2", 0.92, TEAM.ALLIES);
		Util.MapDebugPrint("Tank_Turn5");
	},

	Right_bridge_Built = function()
	{
		Wp.SetWaypointFlag("bridge", "closed", false);
		//Util.EnableGoal("ROUTE_bridge");
		Util.MapDebugPrint("Right_bridge_Built");
	},

	Right_bridge_Destroyed = function()
	{
		Wp.SetWaypointFlag("bridge", "closed", true);
		//Util.DisableGoal("ROUTE_bridge");
		Util.MapDebugPrint("Right_bridge_Destroyed");
	},

	Mosque_Accessible = function()
	{
		Map.phase = 30;
		Map.SetSpawn();
		SetAvailableMapGoals(TEAM.AXIS, false, "ATTACK_tank.*");
		SetAvailableMapGoals(TEAM.ALLIES, false, "ATTACK_tank7");
		SetAvailableMapGoals(TEAM.AXIS, true, {
			"DEFEND_mosque.*",
			"DEFEND_boat.*",
			"BUILD_Boat_Barrier_.*",
		});
		SetAvailableMapGoals(TEAM.ALLIES, true, {
			"FLAG_Gold_Bars",
			"CAPPOINT_boat",
		});
		SetAvailableMapGoals(TEAM.ALLIES, false, "ESCORT_tank");
		SetGoalPriority("BUILD_Tank", 0.8, TEAM.ALLIES);
		SetGoalPriority("CHECKPOINT_rien_du_tout_1", 0.73);
		SetGoalPriority("CHECKPOINT_rien_du_tout", 0.75, TEAM.ALLIES);
		SetGoalPriority("MOUNTMG42_alliedconstruct1_track", 0.6, TEAM.ALLIES);
		ETUtil.SetAimModeForMount("MOUNT_tank", Vector3(9787, 4396, -87));
		Util.MapDebugPrint("Mosque_Accessible");
	},

	SetBoat = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, Map.phase>=40 && Map.boatBarrier1Destroyed
			&& (Map.phase<50 || Map.boatBarrier2Destroyed), "ESCORT_boat");
	},

	SetBoatBarrier2 = function()
	{
		goal = GetGoal("PLANT_Boat_Barrier_2");
		goal.SetPosition(Util.WpNameInfo("boat_barrier2_" + RandInt(1,2)).position);
		goal.DynamicPosition = false;
	},

	Escort_Boat = function()
	{
		Map.phase = 40;
		Map.SetSpawn();
		Map.SetBoat();
		Map.SetBoatBarrier2();
		Util.SetMaxUsersInProgress(1, "CHECKPOINT_rien_du_tout");
		Util.SetMaxUsersInProgress(5, "CHECKPOINT_rien_du_tout_1");
		Util.ForceRouting("BUILD_Boat", true);
		SetAvailableMapGoals(TEAM.AXIS, false, {
			"DEFEND_mosque.*",
			"PLANT_Right_bridge",
		});
		SetAvailableMapGoals(TEAM.ALLIES, false, {
			"BUILD_Right_bridge",
			"FLAG_Gold_Bars",
			"CAPPOINT_boat",
			"BUILD_Tank",
			"MOUNT_tank",
		});
		SetAvailableMapGoals(TEAM.AXIS, true, {
			"DEFEND_port.*",
			"SNIPE_port.*",
		});
		SetAvailableMapGoals(TEAM.ALLIES, true, {
			"BUILD_Boat",
			"ATTACK_port.*",
			"PLANT_Boat_Barrier_1",
			"PLANT_Boat_Barrier_2",
		});
		Util.OnTriggerPosition("MOVER_truck", "boat_barrier1", 200.0, Map.Boat_Past_Barrier1);
		Util.MapDebugPrint("Escort_Boat");
	},

	Boat_Barrier1_Constructed = function()
	{
		Map.boatBarrier1Destroyed = false;
		Map.SetBoat();
		Util.MapDebugPrint("Boat_Barrier1_Constructed");
	},

	Boat_Barrier1_Destroyed = function()
	{
		Map.boatBarrier1Destroyed = true;
		Map.SetBoat();
		Util.MapDebugPrint("Boat_Barrier1_Destroyed");
	},

	Boat_Past_Barrier1 = function()
	{
		SetAvailableMapGoals(TEAM.AXIS, false, "BUILD_Boat_Barrier_1");
		Util.ForceRouting("BUILD_Boat", false);
		SetGoalPriority("MOUNTMG42_alliedconstruct1_track", 0.7, TEAM.ALLIES);
		Util.OnTriggerPosition("MOVER_truck", "boat_barrier2", 200.0, Map.Boat_Barrier2);
		Util.MapDebugPrint("Boat_Past_Barrier1");
	},

	Boat_Barrier2 = function()
	{
		Map.phase = 50;
		SetGoalPriority("PLANT_Boat_Barrier_2", 0.95, TEAM.ALLIES);
		Util.MapDebugPrint("Boat_Barrier2");
	},

	Boat_Barrier2_Constructed = function()
	{
		Map.boatBarrier2Destroyed = false;
		Map.SetBoat();
		Util.MapDebugPrint("Boat_Barrier2_Constructed");
	},

	Boat_Barrier2_Destroyed = function()
	{
		Map.boatBarrier2Destroyed = true;
		Map.SetBoat();
		Util.MapDebugPrint("Boat_Barrier2_Destroyed");
	},

	Boat_Barrier2_Planted = function()
	{
		Map.SetBoatBarrier2();
		Util.MapDebugPrint("Boat_Barrier2_Planted", true);
	},

	Boat_Damaged = function()
	{
		Util.SetMaxUsersInProgress(1, "ESCORT_boat");
		Util.MapDebugPrint("Boat_Damaged", true);
	},

	Boat_Repaired = function()
	{
		Util.SetMaxUsersInProgress(4, "ESCORT_boat");
		Util.MapDebugPrint("Boat_Repaired", true);
	},
};

global OnMapLoad = function()
{
	OnTrigger("allies_capture_rien_du_tout", Map.Bar_Captured);
	OnTrigger("axis_neutralized_rien_du_tout", Map.Bar_Reclaimed);
	OnTrigger("axis_capture_rien_du_tout", Map.Port_Captured);
	OnTrigger("allies_neutralized_rien_du_tout", Map.Port_Reclaimed);
	OnTrigger("Allies have blown the tanks bunker door!", Map.Tank_Depot_Door_Destroyed);
	OnTrigger("Allied team has stolen the Tank!", Map.Tank_Stolen);
	OnTrigger("The Tank has been damaged!", Map.Tank_Damaged);
	OnTrigger("The Tank has been repaired!", Map.Tank_Repaired);
	OnTrigger("Allies have blown the Side bunker door!", Map.Side_Door__bunker_Destroyed);
	OnTrigger("Tank Barrier #1 has been constructed.", Map.Tank_Barrier1_Constructed);
	OnTrigger("Tank Barrier #1 has been destroyed.", Map.Tank_Barrier1_Destroyed);
	OnTrigger("Tank Barrier #2 has been constructed.", Map.Tank_Barrier2_Constructed);
	OnTrigger("Tank Barrier #2 has been destroyed.", Map.Tank_Barrier2_Destroyed);
	OnTrigger("Right Bridge moskee has been constructed.", Map.Right_bridge_Built);
	OnTrigger("Right Bridge moskee has been destroyed.", Map.Right_bridge_Destroyed);
	OnTrigger("Allied team has destroyed the Moskee Doors Whit the Tank!", Map.Mosque_Accessible);
	OnTrigger("Allied team is escaping with the Gold Crates and the Boat and try to re", Map.Escort_Boat);
	OnTrigger("The Boat has been damaged!", Map.Boat_Damaged);
	OnTrigger("The Boat has been repaired!", Map.Boat_Repaired);
	OnTrigger("Truck Barrier #1 has been constructed.", Map.Boat_Barrier1_Constructed);
	OnTrigger("Boat Barrier #1 has been constructed.", Map.Boat_Barrier1_Constructed);
	OnTrigger("Boat Barrier #1 has been destroyed.", Map.Boat_Barrier1_Destroyed);
	OnTrigger("Boat Barrier #2 has been constructed.", Map.Boat_Barrier2_Constructed);
	OnTrigger("Boat Barrier #2 has been destroyed.", Map.Boat_Barrier2_Destroyed);
	OnTrigger("Planted at Boat Barrier #2.", Map.Boat_Barrier2_Planted);

	Util.DisableGoal(".*", true);
	Util.DisableGoal("ROUTE_side_door");
	Util.EnableGoal("AMMO.*");
	Util.EnableGoal("HEALTH.*");
	//SetAvailableMapGoals(TEAM.ALLIES, false, ".*lighthouse.*"); // cs: no goals match this regex

	SetAvailableMapGoals(TEAM.AXIS, true, {
		".*Command_Post",
		"PLANT_Allied_MG42_Construction",
		"BUILD_Tank_Barrier_1",
		".*MG42_mg42_bank_1",
	});
	SetAvailableMapGoals(TEAM.AXIS, true, "CHECKPOINT_rien_du_tout_1"); //port roof
	SetAvailableMapGoals(TEAM.AXIS, true, {
		"DEFEND_beach.*",
		"DEFEND_depot.*",
		"DEFEND_bar.*",
	});

	SetAvailableMapGoals(TEAM.ALLIES, true, {
		"ATTACK_depot.*",
		"SNIPE_depot1",
		"PLANT_Tank_Depot_Door",
		".*MG42_mg42_bank",
	});
	SetAvailableMapGoals(TEAM.ALLIES, true, "CHECKPOINT_rien_du_tout"); //bar
	SetAvailableMapGoals(TEAM.ALLIES, true, "GRENADE_depot_mg");

	SetGoalPriority("DEFEND_beach.*", 0.51, TEAM.AXIS);
	SetGoalPriority("BUILD_Tank_Barrier_1", 0.95, TEAM.AXIS);
	SetGoalPriority("BUILD_Tank_Barrier_2", 0.92, TEAM.AXIS);
	SetGoalPriority("BUILD_Boat_Barrier_1", 0.95, TEAM.AXIS);
	SetGoalPriority("BUILD_Boat_Barrier_2", 0.92, TEAM.AXIS);
	SetGoalPriority("SNIPE_crane", 0.81, TEAM.AXIS);
	SetGoalPriority("SNIPE_port.*", 0.81, TEAM.AXIS);
	SetGoalPriority("PLANT_Allied_MG42_Construction", 0.8, TEAM.AXIS, CLASS.COVERTOPS);

	SetGoalPriority("PLANT_Boat_Barrier_1", 0.95, TEAM.ALLIES);
	SetGoalPriority("PLANT_Command_Post", 0.76, TEAM.ALLIES);
	SetGoalPriority("REPAIRMG42_alliedconstruct1_track", 0.9, TEAM.ALLIES);
	SetGoalPriority("MOUNTMG42_alliedconstruct1_track", 0.75, TEAM.ALLIES);
	SetGoalPriority("MOUNT_tank", 0.74, TEAM.ALLIES);
	SetGoalPriority("ESCORT_tank", 0.69, TEAM.ALLIES);
	SetGoalPriority("GRENADE_depot_mg", 0.69, TEAM.ALLIES);
	SetGoalPriority("DEFEND_a_side_door.*", 0.51, TEAM.ALLIES);
	SetGoalPriority("FLAG_Gold_Bars", 0.73, TEAM.ALLIES);

	SetGoalPriority("CHECKPOINT_rien_du_tout_1", 0.51);

	SetGoalRole("DEFEND_bar.*", ROLE.DEFENDER2);
	SetGoalRole("DEFEND_side_door.*", ROLE.DEFENDER2);

	foreach (goal in { ".*MG42.*", "SNIPE.*", ".*_Command_Post",
		"PLANT_Side_Door__bunker" }){
		Util.SetMaxUsersInProgress(1, goal);
	}
	Util.SetMaxUsersInProgress(4, "ATTACK_tank.*");
	Util.SetMaxUsersInProgress(3, ".*MG42_alliedconstruct1_track");
	Util.SetMaxUsersInProgress(2, "MOUNTMG42_mg42_bank");
	Util.SetMaxUsersInProgress(2, "CHECKPOINT_rien_du_tout");
	Util.SetMaxUsersInProgress(1, "CHECKPOINT_rien_du_tout_1");

	SetMapGoalProperties("DEFEND_.*", {mincamptime=50, maxcamptime=150} );
	SetMapGoalProperties("MOUNTMG42.*", {mincamptime=70, maxcamptime=300} );
	SetMapGoalProperties("MOUNTMG42_alliedconstruct1_track", {mincamptime=999, maxcamptime=999} );
	SetMapGoalProperties("SNIPE_.*", {mincamptime=60, maxcamptime=250} );

	Util.AddUsePoint("PLANT_Tank_Barrier_1", Vector3(6169.978, 86.920, 104.125));
	Wp.SetWaypointFlag("bridge", "closed", true);

	MapRoutes =
	{
		ATTACK_depot1 = {
			ROUTE_helicopter_spawn = {
				ROUTE_beach_left = { ROUTE_town_east_north = {}},
				ROUTE_beach_right = { Weight = 3,
					ROUTE_town_west_south = {
						ROUTE_town_south = {},
						ROUTE_town_yard = {},
					},
				},
			},
			ROUTE_bar_spawn = {
				ROUTE_side_door = {},
				ROUTE_town_east_north = { Weight = 3 },
			}
		},
		DEFEND_depot4 = {
			ROUTE_bunker_spawn = {
				ROUTE_bunker_down = {  Weight = 3 },
				ROUTE_bunker_up = {},
			}
		},
		MOUNTMG42_mg42_bank = {
			ROUTE_helicopter_spawn = {
				ROUTE_town_west_south= {},
			}
		},
		CHECKPOINT_rien_du_tout = {
			ROUTE_bunker_spawn = {
				ROUTE_side_door_axis = {},
				ROUTE_town_east_north = {},
			},
		},
		BUILD_Right_bridge = {
			ROUTE_bar_spawn = {
				ROUTE_side2 = {},
				ROUTE_side3 = {},
			}
		},
		FLAG_Gold_Bars = {
			ROUTE_bar_spawn = {
				ROUTE_side_door = { Weight = 9,
					ROUTE_side1 = {},
					ROUTE_side2 = {},
					//ROUTE_side3 = {},
					ROUTE_side4 = {},
					ROUTE_sewer = {},
				},
				ROUTE_town_east_north = {},
			}
		},
		CAPPOINT_boat = {
			ROUTE_gold = {
				ROUTE_port_entrance = {},
				ROUTE_port_west = { Weight = 3 },
			}
		},
		PLANT_Boat_Barrier_1 = {
			ROUTE_bar_spawn = {
				ROUTE_port_entrance = {},
				ROUTE_port_west = { Weight = 2 },
			},
		},
		DEFEND_mosque1 = {
			ROUTE_axis_spawn = {
				ROUTE_axis_north = { Weight = 2 },
				ROUTE_axis_south = { Weight = 4 },
				ROUTE_tunnel = {},
			}
		},
		BUILD_Boat = {
			ROUTE_bar_spawn = {
				ROUTE_port_entrance = {},
				ROUTE_port_west = { Weight = 3 },
			}
		},
	};
	MapRoutes.PLANT_Tank_Depot_Door = MapRoutes.ATTACK_depot1;
	MapRoutes.BUILD_Tank = MapRoutes.PLANT_Tank_Depot_Door;
	MapRoutes.ATTACK_depot2 = MapRoutes.ATTACK_depot1;
	MapRoutes.ATTACK_depot3 = MapRoutes.ATTACK_depot1;
	MapRoutes.ATTACK_depot4 = MapRoutes.ATTACK_depot1;
	MapRoutes.DEFEND_depot5 = MapRoutes.DEFEND_depot4;
	MapRoutes.DEFEND_depot6 = MapRoutes.DEFEND_depot4;
	MapRoutes.DEFEND_depot7 = MapRoutes.DEFEND_depot4;
	MapRoutes.DEFEND_depot8 = MapRoutes.DEFEND_depot4;
	MapRoutes.MOUNTMG42_mg42_bank_1 = MapRoutes.DEFEND_depot4;
	MapRoutes.REPAIRMG42_mg42_bank_1 = MapRoutes.DEFEND_depot4;
	MapRoutes.GRENADE_depot_mg = MapRoutes.ATTACK_depot1;
	MapRoutes.REPAIRMG42_mg42_bank = MapRoutes.MOUNTMG42_mg42_bank;
	MapRoutes.DEFEND_mosque2 = MapRoutes.DEFEND_mosque1;
	MapRoutes.DEFEND_mosque3 = MapRoutes.DEFEND_mosque1;
	MapRoutes.DEFEND_mosque4 = MapRoutes.DEFEND_mosque1;
	MapRoutes.PLANT_Right_bridge = MapRoutes.DEFEND_mosque1;
	MapRoutes.CHECKPOINT_rien_du_tout_1 = MapRoutes.BUILD_Boat;
	Util.Routes(MapRoutes);

	Util.FixMoverPos("truck", Vec3(9777.500, 281.120, -108.567), Vec3(9775.000, 332.000, -124.000));

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

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 200.0;
	bot.MaxViewDistance = 3600;
	Map.SetSpawn1(bot);

	foreach (ent in {731, 732, 735, 736}){ //bar speakers
		bot.IgnoreTarget(ent, 9999);
	}
};
