/********************************************************
Script and waypoints made by  >WES< P!NNAN & >WES< GRANNY
********************************************************/

global Map =
{
	Quiet = true,
	Talk = true, //set this to false if you wont bots talking ingame
	Fence = false,

	Ammo_Cabinet_supplycabinetaxis = "AMMOCAB_supplycabinetaxis",
	Ammo_Cabinet_supplycabinetaxis_1 = "AMMOCAB_supplycabinetaxis_1",
	Ammo_Cabinet_supplycabinetaxis_2 = "AMMOCAB_supplycabinetaxis_2",
	Health_Cabinet_healthcabinetaxis = "HEALTHCAB_healthcabinetaxis",
	Health_Cabinet_healthcabinetaxis_1 = "HEALTHCAB_healthcabinetaxis_1",
	Health_Cabinet_healthcabinetaxis_2 = "HEALTHCAB_healthcabinetaxis_2",
	Call_Artillery_ar_ax_1 = "CALLARTILLERY_ar_ax_1",
	Flag_docs_scriptname = "FLAG_docs_scriptname",
	Cappoint_Dropoff = "CAPPOINT_Dropoff",
	Build_Allied_Fence = "BUILD_Allied_Fence",
	Build_Allied_MG = "BUILD_Allied_MG",
	Build_Axis_MG = "BUILD_Axis_MG",
	Build_Axis_Pump = "BUILD_Axis_Pump",
	Build_Axis_Sniper_Stairs = "BUILD_Axis_Sniper_Stairs",
	Build_Centre_Ramp = "BUILD_Centre_Ramp",
	Build_Command_Post = "BUILD_Command_Post",
	Build_East_Ramp = "BUILD_East_Ramp",
	Plant_Allied_Fence = "PLANT_Allied_Fence",
	Plant_Allied_MG = "PLANT_Allied_MG",
	Plant_Axis_MG = "PLANT_Axis_MG",
	Plant_Axis_Pump = "PLANT_Axis_Pump",
	Plant_Axis_Sniper_Stairs = "PLANT_Axis_Sniper_Stairs",
	Plant_Centre_Ramp = "PLANT_Centre_Ramp",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_East_Ramp = "PLANT_East_Ramp",
	Plant_Old_City_Wall = "PLANT_Old_City_Wall",
	Mount_Allied_MG = "MOUNTMG42_Allied_MG",
	Mount_Axis_MG = "MOUNTMG42_Axis_MG",
	Mount_Axis_Sniper_Stairs = "MOUNTMG42_Axis_Sniper_Stairs",
	Repair_Allied_MG = "REPAIRMG42_Allied_MG",
	Repair_Axis_MG = "REPAIRMG42_Axis_MG",
	Repair_Axis_Sniper_Stairs = "REPAIRMG42_Axis_Sniper_Stairs",
	Mobile_MG42_mg_al_1 = "MOBILEMG42_mg_al_1",
	Mobile_MG42_mg_al_2 = "MOBILEMG42_mg_al_2",
	Mobile_MG42_mg_al_3 = "MOBILEMG42_mg_al_3",
	Mobile_MG42_mg_al_4 = "MOBILEMG42_mg_al_4",
	Mobile_MG42_mg_al_5 = "MOBILEMG42_mg_al_5",
	Mobile_MG42_mg_ax_1 = "MOBILEMG42_mg_ax_1",
	Mobile_MG42_mg_ax_2 = "MOBILEMG42_mg_ax_2",
	Mobile_MG42_mg_ax_3 = "MOBILEMG42_mg_ax_3",
	Mobile_Mortar_mo_al = "MOBILEMORTAR_mo_al",
	Mobile_Mortar_mo_ax = "MOBILEMORTAR_mo_ax",
	Snipe_s_al_1 = "SNIPE_s_al_1",
	Snipe_s_al_2 = "SNIPE_s_al_2",
	Snipe_s_al_3 = "SNIPE_s_al_3",
	Snipe_s_ax_1 = "SNIPE_s_ax_1",
	Snipe_s_ax_2 = "SNIPE_s_ax_2",
	Snipe_s_ax_3 = "SNIPE_s_ax_3",
	Snipe_s_ax_4 = "SNIPE_s_ax_4",
	Snipe_s_ax_5 = "SNIPE_s_ax_5",
	Snipe_s_ax_6 = "SNIPE_s_ax_6",
	Plant_Mine_m_1 = "PLANTMINE_m_1",
	Plant_Mine_m_2 = "PLANTMINE_m_2",
	Plant_Mine_m_3 = "PLANTMINE_m_3",
	Plant_Mine_m_4 = "PLANTMINE_m_4",
	Plant_Mine_m_5 = "PLANTMINE_m_5",
	Plant_Mine_m_5_1 = "PLANTMINE_m_5_1",
	Plant_Mine_m_6 = "PLANTMINE_m_6",
	Plant_Mine_m_7 = "PLANTMINE_m_7",
	Plant_Mine_m_8 = "PLANTMINE_m_8",
	Plant_Mine_m_9 = "PLANTMINE_m_9",

	Navigation =
	{
		mgladderpt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 3);
				sleep(3);
			},
		},
		pumpladderpt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 3);
				sleep(3);
			},
		},
		pumpexitpt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 4);
				sleep(4);
			},
		},
	},

	//MG stuff
	Allied_MG_Built = function()
	{
		Util.MapDebugPrint( "Allied_MG_Built" );
	},

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

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

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

	//Waterpump
	Axis_Pump_Built = function()
	{

		Util.DisableGoal("BUILD_Allied_Fence");

		Groups.DisableAllies(Groups.group3);
		Groups.EnableAllies(Groups.group5);
		Groups.DisableAxis(Groups.group4);
		Groups.EnableAxis(Groups.group6);

		Util.MapDebugPrint( "Axis_Pump_Built" );
	},

	Axis_Pump_Destroyed = function()
	{

		Util.DisableGoal("BUILD_Allied_Fence");

		Groups.DisableAllies(Groups.group5);
		Groups.EnableAllies(Groups.group3);
		Groups.DisableAxis(Groups.group6);
		Groups.EnableAxis(Groups.group4);

		Util.MapDebugPrint( "Axis_Pump_Destroyed" );
	},

	//CP stuff
	Allied_Command_Post_Built = function()
	{
		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Axis_Command_Post_Built = function()
	{

		Groups.DisableAllies(Groups.group5);
		Groups.EnableAllies(Groups.group7);
		Groups.DisableAxis(Groups.group4);
		Groups.EnableAxis(Groups.group6);

		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

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

	Axis_Command_Post_Destroyed = function()
	{
		Groups.DisableAxis(Groups.group6);
		Groups.EnableAxis(Groups.group4);

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

	//Ramps and Fence
	Axis_Sniper_Stairs_Built = function()
	{
		Util.MapDebugPrint( "Axis_Sniper_Stairs_Built" );
	},

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

	Allied_Fence_Built = function()
	{

		Map.Fence = true;

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

		if ( Map.Talk && MAP_TALK )
		{
			foreach ( id and bot in BotTable )
			{
				if ( bot.GetTeam() == TEAM.AXIS )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.DESTROY_CONST);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.ExecCommand("vsay_team FTAttack");
					}
				}
				if ( bot.GetTeam() == TEAM.ALLIES )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.ALL_CLEAR);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.SayVoice(VOICE.DEFEND_OBJECTIVE);
					}
				}
			}
		}

		Util.MapDebugPrint( "Allied_Fence_Built" );
	},

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

	Allied_Fence_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Fence" );

		if ( Map.Talk && MAP_TALK )
		{
			foreach ( id and bot in BotTable )
			{
				if ( bot.GetTeam() == TEAM.AXIS )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.PATH_CLEARED);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.ExecCommand("vsay_team FTAttack");
					}
				}
				if ( bot.GetTeam() == TEAM.ALLIES )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.REINFORCE_DEF);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.ExecCommand("vsay_team FTFallBack");
					}
				}
			}
		}

		Util.MapDebugPrint( "Allied_Fence_Destroyed" );
	},

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

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

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

	//Obj stuff and Old City Wall
	Old_City_Wall_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Fence" );

		Groups.DisableAllies(Groups.group1);
		Groups.EnableAllies(Groups.group3);
		Groups.DisableAxis(Groups.group2);
		Groups.EnableAxis(Groups.group4);

		if ( Map.Talk && MAP_TALK )
		{
			foreach ( id and bot in BotTable )
			{
				if ( bot.GetTeam() == TEAM.AXIS )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.LETS_GO);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.ExecCommand("vsay_team FTAttack");
					}
				}
				if ( bot.GetTeam() == TEAM.ALLIES )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.INCOMING);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.ExecCommand("vsay_team FTFallBack");
					}
				}
			}
		}

		Util.MapDebugPrint( "Old_City_Wall_Destroyed" );
	},

	docs_scriptname_Taken = function()
	{

		Groups.DisableAllies(Groups.group7);
		Groups.EnableAllies(Groups.group9);
		Groups.DisableAxis(Groups.group6);
		Groups.EnableAxis(Groups.group8);

		// half the axis should spawn at first spawn now
		foreach ( id and bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.AXIS )
			{
				if ( RandInt(0,1) < 1)
				{
					bot.ChangeSpawnPoint( 1 );
				}
				else
				{
					bot.ChangeSpawnPoint( 2 );
				}
			}
		}

		if ( Map.Talk && MAP_TALK )
		{
			foreach ( id and bot in BotTable )
			{
				if ( bot.GetTeam() == TEAM.ALLIES )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.LETS_GO);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.ExecCommand("vsay_team FTAttack");
					}
				}
				if ( bot.GetTeam() == TEAM.AXIS )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.HOLD_FIRE);
					}
					else if( r > 8 )
					{
						sleep(1.2);
						bot.ExecCommand("vsay_team FTFallBack");
					}
				}
			}
		}

		Util.MapDebugPrint( "docs_scriptname_Taken" );
	},

	docs_scriptname_trigger_Returned = function()
	{

		Groups.DisableAllies(Groups.group9);
		Groups.EnableAllies(Groups.group7);

		Util.MapDebugPrint( "docs_scriptname_trigger_Returned" );
	},

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

};

global OnMapLoad = function()
{
	OnTrigger( "Allied Fence constructed!", Map.Allied_Fence_Built );
	OnTrigger( "Allied MG42 is constructed!", Map.Allied_MG_Built );
	OnTrigger( "Axis MG42 is constructed!", Map.Axis_MG_Built );
	OnTrigger( "Axis Pump constructed!", Map.Axis_Pump_Built );
	OnTrigger( "Axis Sniper Stairs constructed!", Map.Axis_Sniper_Stairs_Built );
	OnTrigger( "Center Ramp constructed!", Map.Centre_Ramp_Built );
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "East Ramp constructed!", Map.East_Ramp_Built );
	OnTrigger( "Allied Fence destroyed!", Map.Allied_Fence_Destroyed );
	OnTrigger( "Allied MG42 is destroyed!", Map.Allied_MG_Destroyed );
	OnTrigger( "Axis MG42 is destroyed!", Map.Axis_MG_Destroyed );
	OnTrigger( "Axis Pump destroyed!", Map.Axis_Pump_Destroyed );
	OnTrigger( "Axis Sniper Stairs destroyed!", Map.Axis_Sniper_Stairs_Destroyed );
	OnTrigger( "Center Ramp destroyed!", Map.Centre_Ramp_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "East Ramp destroyed!", Map.East_Ramp_Destroyed );
	OnTrigger( "Old City Wall is destroyed!", Map.Old_City_Wall_Destroyed );
	OnTrigger( "Axis have stolen the Documents!", Map.docs_scriptname_Taken );
	OnTrigger( "Allies have returned the Documents!", Map.docs_scriptname_trigger_Returned );
	OnTrigger( "Dropoff_Captured", Map.Dropoff_Captured );

	//Priority Main goals
	SetGoalPriority( "BUILD_Axis_MG", 0.7 );
	SetGoalPriority( "BUILD_Axis_Pump", 0.7 );
	SetGoalPriority( "BUILD_Axis_Sniper_Stairs", 0.7 );
	SetGoalPriority( "BUILD_Allied_Fence", 0.7 );
	SetGoalPriority( "PLANT_Old_City_Wall", 0.9 );
	SetGoalPriority( "PLANT_Allied_Fence", 0.9 );

	//moving goals for better reaching
	Util.SetGoalOffset( 0, -40, -40, "PLANT_Allied_Fence" );

	//set max users for goals
	Util.SetMaxUsersInProgress( 2, "BUILD.*" );
	Util.SetMaxUsersInProgress( 2, "PLANT.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_.*" );
	Util.SetMaxUsersInProgress( 1, "MOUNT_.*" );

	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=120, MaxCampTime=120});
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=60, MaxCampTime=120});
	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=30, MaxCampTime=60});
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=60, MaxCampTime=120});

	//clear all goals
	SetAvailableMapGoals( TEAM.AXIS, false, ".*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );

	Util.EnableGoal("ROUTE.*"); //enable routing for both teams
	Util.DisableGoal("BUILD_Allied_Fence");

	//enable part 1 goals
	Groups.EnableAllies(Groups.group1);
	Groups.EnableAxis(Groups.group2);

	//Routes
	MapRoutes =
	{
		PLANT_Command_Post =
		{
			ROUTE_r_axisspawn_1 =
			{
				ROUTE_r_footbridge =
				{
					ROUTE_r_waterpump_entrance =
					{
						ROUTE_r_waterpump =
						{
							ROUTE_r_waterpump_exit = { ROUTE_r_main_entrance = {}, },
						},
					},
				},
				ROUTE_r_main_street =
				{
					ROUTE_r_main_entrance = {},
				},
				ROUTE_r_axis_exit_2 =
				{
					ROUTE_r_axis_leftwall =
					{
						ROUTE_r_left_street = { ROUTE_r_main_entrance = {}, },
					},
				},
			},
		},
		FLAG_docs_scriptname =
		{
			ROUTE_r_axisspawn_1 =
			{
				ROUTE_r_footbridge =
				{
					ROUTE_r_waterpump_entrance =
					{
						ROUTE_r_waterpump =
						{
							ROUTE_r_waterpump_exit =
							{
								ROUTE_r_main_entrance =
								{
									ROUTE_r_right_side =
									{
										ROUTE_r_eastramp = { ROUTE_r_behind_table = {}, },
									},
									ROUTE_r_left_side =
									{
										ROUTE_r_left_side_1 = { ROUTE_r_left_side_2 = {}, },
									},
									ROUTE_r_side_entrance =
									{
										ROUTE_r_left_way =
										{
											ROUTE_r_split_2 = {},
											ROUTE_r_inner_stairs =
											{
												ROUTE_r_little_tunnel = { ROUTE_r_little_tunnel_1 = {}, },
											},
										},
									},
								},
							},
						},
					},
				},
				ROUTE_r_main_street =
				{
					ROUTE_r_main_entrance =
					{
						ROUTE_r_right_side = { ROUTE_r_centerramp = {}, },
					},
				},
				ROUTE_r_axis_exit_2 =
				{
					ROUTE_r_axis_leftwall =
					{
						ROUTE_r_left_street =
						{
							ROUTE_r_main_entrance = { ROUTE_r_centerramp = {}, },
						},
					},
				},
				ROUTE_r_split_1 =
				{
					ROUTE_r_axis_exit_4 =
					{
						ROUTE_r_axis_tunnel =
						{
							ROUTE_r_left_street =
							{
								ROUTE_r_main_entrance = { ROUTE_r_centerramp = {}, },
							},
						},
					},
				},
			},
			ROUTE_r_axisspawn_2 =
			{
				ROUTE_r_main_entrance =
				{
					ROUTE_r_right_side =
					{
						ROUTE_r_eastramp = { ROUTE_r_behind_table = {}, },
					},
					ROUTE_r_left_side =
					{
						ROUTE_r_left_side_1 = { ROUTE_r_left_side_2 = {}, },
					},
					ROUTE_r_side_entrance =
					{
						ROUTE_r_left_way =
						{
							ROUTE_r_split_2 = {},
							ROUTE_r_inner_stairs =
							{
								ROUTE_r_little_tunnel = { ROUTE_r_little_tunnel_1 = {}, },
							},
						},
						ROUTE_r_alliedspawn_2 =
						{
							ROUTE_r_topway =
							{
								ROUTE_r_wooden_boxes = { ROUTE_r_behind_table = {}, },
							},
							ROUTE_r_inner_stairs_1 =
							{
								ROUTE_r_behind_table = {},
							},
						},
					},
				},
			},
		},
		CAPPOINT_Dropoff =
		{
			ROUTE_r_docs =
			{
				ROUTE_r_behind_table =
				{
					ROUTE_r_eastramp =
					{
						ROUTE_r_right_side =
						{
							ROUTE_r_main_entrance = { ROUTE_r_main_street = {}, },
						},
					},
				},
				ROUTE_r_split_2 =
				{
					ROUTE_r_left_way =
					{
						ROUTE_r_right_hole =
						{
							ROUTE_r_left_side =
							{
								ROUTE_r_main_entrance = { ROUTE_r_main_street = {}, },
								ROUTE_r_pump_allied_entrance =
								{
									ROUTE_r_waterpump_exit_1 =
									{
										ROUTE_r_waterpump =
										{
											ROUTE_r_waterpump_entrance = { ROUTE_r_main_street = {}, },
										},
									},
								},
							},
						},
						ROUTE_r_left_hole =
						{
							ROUTE_r_right_side =
							{
								ROUTE_r_main_entrance =
								{
									ROUTE_r_main_street = {},
								},
								ROUTE_r_pump_allied_entrance =
								{
									ROUTE_r_waterpump_exit =
									{
										ROUTE_r_waterpump =
										{
											ROUTE_r_waterpump_entrance = { ROUTE_r_main_street = {}, },
										},
									},
								},
							},
						},
						ROUTE_r_side_entrance =
						{
							ROUTE_r_outer_stairs =
							{
								ROUTE_r_alliedwall_2 =
								{
									ROUTE_r_left_street = { ROUTE_r_main_street = {}, },
								},
							},
						},
					},
				},
			},
		},
		PLANT_Axis_Pump =
		{
			ROUTE_r_alliedspawn_1 =
			{
				ROUTE_r_pump_allied_entrance =
				{
					ROUTE_r_waterpump_exit_1 = { ROUTE_r_waterpump = {}, },
				},
			},
			ROUTE_r_alliedspawn_2 =
			{
				ROUTE_r_side_entrance =
				{
					ROUTE_r_alliedwall_2 = { ROUTE_r_main_street = {}, },
				},
			},
		},
		PLANT_Old_City_Wall =
		{
			ROUTE_r_axisspawn_1 =
			{
				ROUTE_r_axis_exit_2 =
				{
					ROUTE_r_axis_leftwall =
					{
						ROUTE_r_left_street = { ROUTE_r_allied_door_1 = {}, },
					},
				},
				Weight = 0.9,
				ROUTE_r_split_1 =
				{
					ROUTE_r_axis_exit_3 =
					{
						ROUTE_r_axis_leftwall =
						{
							ROUTE_r_left_street = { ROUTE_r_allied_door_1 = {}, },
						},
					},
					ROUTE_r_axis_exit_4 =
					{
						ROUTE_r_axis_tunnel =
						{
							ROUTE_r_left_street = { ROUTE_r_allied_door_1 = {}, },
						},
					},
				},
			},
		},
	};

	//copy some routes
	MapRoutes.BUILD_Command_Post = MapRoutes.PLANT_Command_Post;
	MapRoutes.BUILD_East_Ramp = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.BUILD_Centre_Ramp = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.PLANT_Allied_Fence = MapRoutes.PLANT_Old_City_Wall;
	MapRoutes.ATTACK_a_docs_1 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_2 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_3 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_4 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_5 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_6 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_7 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_8 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_docs_9 = MapRoutes.FLAG_docs_scriptname;
	MapRoutes.ATTACK_a_truck_1 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_2 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_3 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_4 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_5 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_6 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_7 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_8 = MapRoutes.PLANT_Axis_Pump;
	MapRoutes.ATTACK_a_truck_9 = MapRoutes.PLANT_Axis_Pump;

	Util.Routes(MapRoutes);
	Util.MapDebugPrint( "OnMapLoad" );
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 100.0;
	bot.MaxViewDistance = 2500;
};

global Groups =
{
	//Allies part 1
	group1 =
	{
		Map.Build_Allied_MG,
		Map.Build_Command_Post,
		Map.Mount_Allied_MG,
		Map.Plant_Axis_MG,
		Map.Plant_Axis_Pump,
		Map.Plant_Axis_Sniper_Stairs,
		Map.Plant_Mine_m_1,
		Map.Plant_Mine_m_2,
		Map.Plant_Mine_m_3,
		Map.Plant_Mine_m_4,
		Map.Plant_Mine_m_5,
		Map.Plant_Mine_m_5_1,
		Map.Plant_Mine_m_6,
		Map.Plant_Mine_m_7,
		Map.Plant_Mine_m_8,
		Map.Plant_Mine_m_9,
		Map.Repair_Allied_MG,
		"MOBILEMORTAR_mo_al.*",
		"DEFEND_d_start.*",
		"SNIPE_s_al.*",
	},

	//Axis part 1
	group2 =
	{
		Map.Build_Axis_MG,
		Map.Build_Axis_Pump,
		Map.Build_Axis_Sniper_Stairs,
		Map.Mobile_MG42_mg_ax_1,
		Map.Mobile_MG42_mg_ax_2,
		Map.Mobile_MG42_mg_ax_3,
		Map.Mount_Axis_MG,
		Map.Mount_Axis_Sniper_Stairs,
		Map.Plant_Old_City_Wall,
		Map.Repair_Axis_MG,
		Map.Repair_Axis_Sniper_Stairs,
		Map.Cappoint_Dropoff,
		"MOBILEMORTAR_mo_ax.*",
		"DEFEND_d_truck.*",
		"SNIPE_s_ax.*",
	},

	//Allies part 2
	group3 =
	{
		Map.Build_Allied_MG,
		Map.Build_Command_Post,
		Map.Mobile_MG42_mg_al_1,
		Map.Mobile_MG42_mg_al_2,
		Map.Mount_Allied_MG,
		Map.Plant_Axis_MG,
		Map.Plant_Axis_Pump,
		Map.Plant_Axis_Sniper_Stairs,
		Map.Repair_Allied_MG,
		"MOBILEMORTAR_mo_al.*",
		"DEFEND_d_start.*",
		"SNIPE_s_al.*",
	},

	//Axis part 2
	group4 =
	{
		Map.Build_Axis_MG,
		Map.Build_Axis_Pump,
		Map.Build_Axis_Sniper_Stairs,
		Map.Build_Command_Post,
		Map.Mobile_MG42_mg_ax_1,
		Map.Mobile_MG42_mg_ax_2,
		Map.Mobile_MG42_mg_ax_3,
		Map.Mount_Axis_MG,
		Map.Mount_Axis_Sniper_Stairs,
		Map.Plant_Command_Post,
		Map.Plant_Old_City_Wall,
		Map.Repair_Axis_MG,
		Map.Repair_Axis_Sniper_Stairs,
		Map.Cappoint_Dropoff,
		"MOBILEMORTAR_mo_ax.*",
		"DEFEND_d_truck.*",
		"SNIPE_s_ax.*",
	},

	//Allies part 3
	group5 =
	{
		Map.Build_Allied_MG,
		Map.Build_Command_Post,
		Map.Mobile_MG42_mg_al_1,
		Map.Mobile_MG42_mg_al_2,
		Map.Mount_Allied_MG,
		Map.Plant_Axis_MG,
		Map.Plant_Axis_Pump,
		Map.Plant_Axis_Sniper_Stairs,
		Map.Repair_Allied_MG,
		"MOBILEMORTAR_mo_al.*",
		"DEFEND_d_start.*",
		"DEFEND_d_pump.*",
		"SNIPE_s_al.*",
	},

	//Axis part 3
	group6 =
	{
		Map.Build_Centre_Ramp,
		Map.Build_Command_Post,
		Map.Build_East_Ramp,
		Map.Plant_Command_Post,
		Map.Plant_Old_City_Wall,
		Map.Flag_docs_scriptname,
		Map.Cappoint_Dropoff,
		"ATTACK_a_docs.*",
	},

	//Allies part 4
	group7 =
	{
		Map.Build_Command_Post,
		Map.Plant_Centre_Ramp,
		Map.Plant_Command_Post,
		Map.Plant_East_Ramp,
		Map.Mobile_MG42_mg_al_3,
		Map.Mobile_MG42_mg_al_4,
		Map.Mobile_MG42_mg_al_5,
		"DEFEND_d_docs.*",
	},

	//Axis part 4
	group8 =
	{
		Map.Build_Centre_Ramp,
		Map.Build_Command_Post,
		Map.Build_East_Ramp,
		Map.Plant_Command_Post,
		Map.Flag_docs_scriptname,
		Map.Cappoint_Dropoff,
		"DEFEND_d_truck.*",
	},

	//Allies part 5
	group9 =
	{
		"ATTACK_a_truck.*",
	},

	EnableAllies = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, goal );
			Util.MapDebugPrint("EnableAllies: enabling " + goal, true);
		}
	},

	EnableAxis = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.AXIS, true, goal );
			Util.MapDebugPrint("EnableAxis: enabling " + goal, true);
		}
	},

	DisableAllies = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, goal );
			Util.MapDebugPrint("DisableAllies: disabling " + goal, true);
		}
	},

	DisableAxis = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, goal );
			Util.MapDebugPrint("DisableAxis: disabling " + goal, true);
		}
	},
};
