global Map =
{
	Ammo_Cabinet_south_ammocabinet = "AMMOCAB_south_ammocabinet",
	Health_Cabinet_south_healthcabinet = "HEALTHCAB_south_healthcabinet",
	Checkpoint_forward_spawn = "CHECKPOINT_forward_spawn",
	Flag_War_Documents = "FLAG_War_Documents",
	Cappoint_Transmitter = "CAPPOINT_Transmitter",
	Build_Allied_Command_Post = "BUILD_Allied_Command_Post",
	Build_Axis_Command_Post = "BUILD_Axis_Command_Post",
	Build_Field_MG42 = "BUILD_Field_MG42",
	Build_Fortress_Ladder = "BUILD_Fortress_Ladder",
	Build_Spawn_MG42 = "BUILD_Spawn_MG42",
	Plant_Allied_Command_Post = "PLANT_Allied_Command_Post",
	Plant_Axis_Command_Post = "PLANT_Axis_Command_Post",
	Plant_Base_Wall = "PLANT_Base_Wall",
	Plant_Field_MG42 = "PLANT_Field_MG42",
	Plant_Fortress_Ladder = "PLANT_Fortress_Ladder",
	Plant_Spawn_MG42 = "PLANT_Spawn_MG42",
	Plant_Storage_Wall = "PLANT_Storage_Wall",
	Mount_266 = "MOUNTMG42_266",
	Mount_267 = "MOUNTMG42_267",
	Mount_Field_MG42 = "MOUNTMG42_Field_MG42",
	Mount_Spawn_MG42 = "MOUNTMG42_Spawn_MG42",
	Repair_266 = "REPAIRMG42_266",
	Repair_267 = "REPAIRMG42_267",
	Repair_Field_MG42 = "REPAIRMG42_Field_MG42",
	Repair_Spawn_MG42 = "REPAIRMG42_Spawn_MG42",


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

	construction_script_Built = function()
	{
		Wp.SetWaypointFlag("Ladder2","closed",false);

		Util.MapDebugPrint( "construction_script_Built" );
	},

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

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

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

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

	basewall_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNTMG42_Spawn_MG42",
			"BUILD_Spawn_MG42",
			"REPAIRMG42_Spawn_MG42",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "SNIPE_documents.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SNIPE_start.*" );
		SetGoalPriority( "DEFEND_start.*", 0.0 );
		SetGoalPriority( "DEFEND_sidewall", 0.58 );
		SetGoalPriority( "DEFEND_document.*", 0.6 );
		SetGoalPriority( "DEFEND_documents1", 0.7 );
		SetGoalPriority( "DEFEND_documents2", 0.65 );
		SetGoalPriority( "DEFEND_documents3", 0.7 );
		Util.MapDebugPrint( "basewall_Destroyed" );
	},

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

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

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

	construction_script_Destroyed = function()
	{
		Wp.SetWaypointFlag("Ladder2","closed",true);

		Util.MapDebugPrint( "construction_script_Destroyed" );
	},

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

	docs_Stolen = function()
	{
		SetGoalPriority( "DEFEND_drop_point.*", 0.7 );
		SetGoalPriority( "ATTACK_drop_point.*", 0.7 );

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_drop_point.*",
			"SNIPE_drop_point.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_drop_point.*" );

		Util.MapDebugPrint( "docs stolen" );
	},

	docs_Returned = function()
	{
		SetGoalPriority( "DEFEND_drop_point.*", 0.0 );
		SetGoalPriority( "ATTACK_drop_point.*", 0.0 );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"SNIPE_drop_point.*",
			"DEFEND_drop_point.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_drop_point.*" );

		Util.MapDebugPrint( "docs returned" );
	},

	Allies_Capture_Flag = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNTMG42_Spawn_MG42",
			"BUILD_Spawn_MG42",
			"REPAIRMG42_Spawn_MG42",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOBILEMORTAR_axis_mortar1",
			"DEFEND_start.*",
		});
		Util.MapDebugPrint( "Allies_Capture_Flag" );
	},

	Axis_Capture_Flag = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_start.*",
			"MOBILEMORTAR_axis_mortar1",
		});

		Util.MapDebugPrint( "Axis_Capture_Flag" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.axis_radio_built_Built );
	OnTrigger( "The Field MG42 has been constructed.", Map.allied_mg2_Built );
	OnTrigger( "The Field MG42 has been destroyed.", Map.allied_mg2_Destroyed );
	OnTrigger( "Allied team has constructed the Spawn MG42!", Map.allied_mg1_Built );
	OnTrigger( "Axis team has destroyed the Spawn MG42!", Map.allied_mg1_Destroyed );
	OnTrigger( "The fortress Ladder has been constructed.", Map.construction_script_Built );
	OnTrigger( "The fortress Ladder has been destroyed.", Map.construction_script_Destroyed );
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.allied_radio_built_Built );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.axis_radio_built_Destroyed );
	OnTrigger( "Allies have destroyed the Base Wall!", Map.basewall_Destroyed );
	OnTrigger( "Allies have destroyed the Storage Wall!", Map.storagewall_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.allied_radio_built_Destroyed );
	OnTrigger( "Allies captures the Tower!", Map.Allies_Capture_Flag );
	OnTrigger( "Axis captures the Tower!", Map.Axis_Capture_Flag );
	OnTrigger( "Allies have stolen the War Documents!", Map.docs_Stolen );
	OnTrigger( "Flag returned War Documents!", Map.docs_Returned );

	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"PLANTMINE_.*",
		"MOBILEMORTAR_axis_mortar.*",
		"DEFEND_.*",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"DEFEND_.*",
		"SNIPE_.*",
	});
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"SNIPE_.*",
		"MOBILEMG42_.*",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"MOBILEMG42_.*",
		"MOUNTMG42_Spawn_MG42",
		"MOUNTMG42_Field_MG42",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"MOBILEMORTAR_axis_mortar1",
		"MOBILEMG42_docs.*",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"MOBILEMG42_docs3",
		"MOBILEMG42_docs4",
	});
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"DEFEND_documents.*",
		"DEFEND_start.*",
		"SNIPE_start.*",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_documents.*" );

	SetGoalPriority( "DEFEND_start.*", 0.6 );
	SetGoalPriority( "DEFEND_documents1", 0.59 );
	SetGoalPriority( "DEFEND_documents2", 0.59 );
	SetGoalPriority( "DEFEND_documents3", 0.6 );
	SetGoalPriority( "ATTACK_documents.*", 0.55 );
	SetGoalPriority("PLANT_Base_Wall", 0.9, TEAM.ALLIES, CLASS.ENGINEER);

	Util.SetGoalPosition( -243.496, -63.046, 56.125, "PLANT_Base_Wall" );
	Wp.SetWaypointFlag("Ladder2","closed",true);

	Util.SetMaxUsersInProgress( 1, "DEFEND_.*" );

	// *** Routing ***
	MapRoutes =
	{
		ATTACK_documents18 =
		{
			ROUTE_allied_spawn =
			{
				ROUTE_tunnel1 = {},
				ROUTE_main_gate =
				{
					ROUTE_tunnel1 = {},
				},
			},
			ROUTE_tower_spawn =
			{
				ROUTE_tunnel1 = {},
			},
		},
		FLAG_War_Documents =
		{
			ROUTE_tower_spawn =
			{
				ROUTE_tunnel1 = {},
				ROUTE_documents_24 = {},
			},
			ROUTE_allied_spawn =
			{
				ROUTE_main_gate =
				{
					ROUTE_tunnel1 =
					{
						ROUTE_documents17 = {},
					},
				},
				ROUTE_ladder_route1 =
				{
					ROUTE_ladder_route2 = {},
				},
				ROUTE_tunnel1 =
				{
					ROUTE_documents17 = {},
				},
			},
		}
	};

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