global Map =
{
	Ammo_Cabinet_north_ammocabinet = "AMMOCAB_north_ammocabinet",
	Ammo_Cabinet_north_ammocabinet_1 = "AMMOCAB_north_ammocabinet_1",
	Health_Cabinet_north_healthcabinet = "HEALTHCAB_north_healthcabinet",
	Health_Cabinet_north_healthcabinet_1 = "HEALTHCAB_north_healthcabinet_1",
	Call_Artillery_902 = "CALLARTILLERY_902",
	Call_Artillery_903 = "CALLARTILLERY_903",
	Artillery_D_162 = "ARTILLERY_D_162",
	Artillery_D_244 = "ARTILLERY_D_244",
	Artillery_D_284 = "ARTILLERY_D_284",
	Artillery_S_244 = "ARTILLERY_S_244",
	Checkpoint_flag = "CHECKPOINT_flag",
	Flag_gold = "FLAG_gold",
	Cappoint_371 = "CAPPOINT_371",
	Build_Barricade = "BUILD_Barricade",
	Build_Command_Post = "BUILD_Command_Post",
	Plant_Barricade = "PLANT_Barricade",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_village_Gate = "PLANT_village_Gate",
	Mobile_MG42_573 = "MOBILEMG42_573",
	Mobile_MG42_579 = "MOBILEMG42_579",
	Mobile_MG42_643 = "MOBILEMG42_643",
	Mobile_MG42_657 = "MOBILEMG42_657",
	Mobile_MG42_676 = "MOBILEMG42_676",
	Plant_Mine_579 = "PLANTMINE_579",
	Plant_Mine_709 = "PLANTMINE_709",
	Plant_Mine_710 = "PLANTMINE_710",
	Plant_Mine_967 = "PLANTMINE_967",

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

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

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

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

	village_Gate_Destroyed = function()
	{
		Util.DisableGroup( "1", TEAM.ALLIES);
		Util.DisableGroup( "2", TEAM.AXIS);
		Util.EnableGroup( "4", 0);
		Util.DisableGroup( "3", 0);
		Util.EnableGroup( "5", 0);
		Util.DisableGroup( "7", 0);
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"FLAG_gold",
			"CAPPOINT_371",
			"PLANT_Barricade",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_ar.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_parts.*",
			"MOBILEMG42_radar1",
			"MOBILEMG42_axis99",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "SMOKEBOMB_al1" );

		Util.MapDebugPrint( "gate gone" );
	},

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

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

	flag_Allies_Captured = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );

		Util.MapDebugPrint( "flag_Allies_Captured" );
	},

	obj_taken = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_parts.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_obj.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOBILEMG42_axis99",
			"MOBILEMG42_radar1",
		});
		//~	SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_ar.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_ao.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Command_Post",
			"PLANT_Command_Post",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_axis1" );

		SetAvailableMapGoals( TEAM.ALLIES, false, "SMOKEBOMB_al1" );
		Util.DisableGroup( "5", 0);

		foreach ( id and bot in BotTable )
		{
			if ( ( bot.GetTeam() == TEAM.AXIS ) && ( bot.GetClass() == CLASS.SOLDIER ) )
			{
				bot.ExecCommand( "kill" );
			}
		}

		Util.MapDebugPrint( "obj taken" );
	},

	obj_secure = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_parts.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_obj.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT_flag" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_ar.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_ao.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_radar1" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SMOKEBOMB_al1" );
		SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_axis99" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_axis1" );
		Util.EnableGroup( "5", 0);

		Util.MapDebugPrint( "obj sec" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "^6The barricade has been built", Map.Barricade_Built );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Built );
	OnTrigger( "^6The barricade has been destroyed", Map.Barricade_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Destroyed );
	OnTrigger( "^6The Town gate has been breached!", Map.village_Gate_Destroyed );
//~	OnTrigger( "MISSING_STRING", Map.gold_Taken );
	OnTrigger( "MISSING_STRING", Map.CAPPOINT_371_Captured );
	OnTrigger( "^6The Town flag has been reclaimed!", Map.flag_Axis_Captured );
	OnTrigger( "^6The Town flag has been captured!", Map.flag_Allies_Captured );
	OnTrigger( "Axis have returned The Transmitter!", Map.obj_secure );
	OnTrigger( "Allies have stolen The Transmitter!", Map.obj_taken );
//~	OnTrigger( "^6The Town flag has been reclaimed!", Axis_Capture_Flag );

	SetAvailableMapGoals( TEAM.AXIS, false, ".*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );
	SetGoalGroup( "PLANT_village_Gate", "1");
//	SetGoalGroup( "CHECKPOINT_flag", "1");
	SetGoalGroup( "ATTACK_attack.*", "1");
	SetGoalGroup( "SMOKEBOMB_al2", "1");
	SetGoalGroup( "SMOKEBOMB_ax1", "2");
	SetGoalGroup( "DEFEND_gate.*", "2");
	SetGoalGroup( "AIRSTRIKE_axis", "2");

	SetGoalGroup( "HEALTHCAB_north_healthcabinet_1", "3");
	SetGoalGroup( "AMMOCAB_north_ammocabinet_1", "3");
	SetGoalGroup( "HEALTHCAB_north_healthcabinet", "4");
	SetGoalGroup( "AMMOCAB_north_ammocabinet", "4");
	SetGoalGroup( "BUILD_Command_Post", "5");
	SetGoalGroup( "PLANT_Command_Post", "5");
	SetGoalGroup( "ROUTE_.*", "6");
	SetGoalGroup( "CHECKPOINT_flag", "7");

	Util.EnableGroup( "1", TEAM.ALLIES);
	Util.EnableGroup( "2", TEAM.AXIS);
	Util.EnableGroup( "3", 0);
	Util.EnableGroup( "6", 0);
	Util.EnableGroup( "7", 0);

	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "CAMP_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 3, "CHECKPOINT_flag" );
	Util.SetMaxUsers( 1, "PLANT_village_Gate" );
	Util.SetMaxUsers( 1, "PLANT_Barricade" );
	Util.SetMaxUsers( 1, "BUILD_Barricade" );
	Util.SetMaxUsers( 1, "BUILD_Command_Post" );
	Util.SetMaxUsers( 1, "PLANT_Command_Post" );
	Util.AddUseWp( "PLANT_Barricade", "planthere" );

	SetMapGoalProperties( "DEFEND_.*", {mincamptime=15, maxcamptime=40} );
	SetMapGoalProperties( "MOUNT_.*", {mincamptime=15, maxcamptime=40} );
	SetMapGoalProperties( "ATTACK_.*", {mincamptime=15, maxcamptime=55} );
	SetGoalPriority( "PLANT_Barricade", 1.0, TEAM.ALLIES, CLASS.COVERTOPS, true );

	MapRoutes =
	{
		PLANT_village_Gate =
		{
			ROUTE_ally_spawn  =
			{
				ROUTE_lr  =
				{
					ROUTE_lr1  =
					{
						ROUTE_right1  =
						{
							ROUTE_gate2  =
							{
							},
						},
						ROUTE_left  =
						{
							ROUTE_left3  =
							{
							},
						},
					},
					ROUTE_right  =
					{
						ROUTE_right2  =
						{
						},
					},
				},
			},
		},
		CHECKPOINT_flag =
		{
			ROUTE_ally_spawn  =
			{
				ROUTE_lr  =
				{
					ROUTE_lr1  =
					{
						ROUTE_left  =
						{
							ROUTE_left3  =
							{
							},
						},
						ROUTE_right1  =
						{
							ROUTE_gate2  =
							{
								ROUTE_right4  =
								{
									ROUTE_right4a  = {},
									ROUTE_right4b  = {},
								},
							},
						},
					},
				},
			},
		},
		FLAG_gold =
		{
			ROUTE_ally_spawn3  =
			{
				ROUTE_g1  =
				{
					ROUTE_gold5  =
					{
						ROUTE_g2  =
						{
							ROUTE_gold3  =
							{
								ROUTE_g3  =
								{
									ROUTE_g4  =
									{
										ROUTE_gold2  =
										{
											ROUTE_g6  =
											{
											},
										},
									},
								},
							},
						},
					},
					ROUTE_gg2  =
					{
						ROUTE_gg3  =
						{
							ROUTE_gg4  =
							{
								ROUTE_gold1  =
								{
									ROUTE_gg5  =
									{
										ROUTE_gg6  =
										{
											ROUTE_gold4  =
											{
												ROUTE_gg7  =
												{
												},
											},
										},
									},
								},
							},
						},
					},
				},
				ROUTE_gg1  =
				{
					ROUTE_gg2  =
					{
						ROUTE_gg12  =
						{
							ROUTE_obj3  =
							{
								ROUTE_gg13  =
								{
									ROUTE_gg6  =
									{
									},
								},
							},
						},
					},
				},
			},
		},
		DEFEND_parts1 =
		{
			ROUTE_axis2 =
			{
				ROUTE_axis3 =
				{
					ROUTE_defparts1 = {},
					ROUTE_defparts2 = {},
				},
			},
		},
		CAPPOINT_371 =
		{
			ROUTE_objective  =
			{
				ROUTE_objective2  =
				{
					ROUTE_objective3  =
					{
						ROUTE_objective4  =
						{
							ROUTE_objective5  =
							{
								ROUTE_objective6  =
								{
									ROUTE_gg5  =
									{
										ROUTE_gold1  =
										{
											ROUTE_gg4  =
											{
												ROUTE_gg3  =
												{
													ROUTE_gg2  =
													{
													},
												},
											},
										},
									},
								},
							},
						},
					},
				},
				ROUTE_g6  =
				{
					ROUTE_gg13  =
					{
						ROUTE_obj3  =
						{
							ROUTE_gg12  =
							{
								ROUTE_gg2  =
								{
								},
							},
						},
					},
				},
				ROUTE_gg7  =
				{
					ROUTE_gg6  =
					{
						ROUTE_objective7  =
						{
							ROUTE_gold2  =
							{
								ROUTE_g3  =
								{
									ROUTE_gold3  =
									{
										ROUTE_g2  =
										{
											ROUTE_gold5  =
											{
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
	};

	MapRoutes.DEFEND_parts2 = MapRoutes.DEFEND_parts1;
	MapRoutes.DEFEND_parts3 = MapRoutes.DEFEND_parts1;
	MapRoutes.DEFEND_parts4 = MapRoutes.DEFEND_parts1;
	MapRoutes.DEFEND_parts5 = MapRoutes.DEFEND_parts1;
	MapRoutes.DEFEND_parts6 = MapRoutes.DEFEND_parts1;
	MapRoutes.DEFEND_parts7 = MapRoutes.DEFEND_parts1;
	MapRoutes.ATTACK_attack1 = PLANT_village_Gate;
	MapRoutes.ATTACK_attack2 = PLANT_village_Gate;
	MapRoutes.ATTACK_attack3 = PLANT_village_Gate;
	MapRoutes.ATTACK_attack4 = PLANT_village_Gate;
	MapRoutes.ATTACK_attack5 = PLANT_village_Gate;
	MapRoutes.ATTACK_ar1 = FLAG_gold;
	MapRoutes.ATTACK_ar2 = FLAG_gold;
	MapRoutes.ATTACK_ar3 = FLAG_gold;
	Util.Routes(MapRoutes);

	Util.MapDebugPrint( "OnMapLoad" );
};
