//==========================================================================================
//
//	2tanks.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
//	MickyP	21 June 2010	Initial Script
//	palota	21 July 2012	command posts can be built by both teams, enabled health and ammo cabinets, fixed switches and tanks availabilities, ESCORT goals are not disabled if tank is damaged
//
//==========================================================================================
//

global Map =
{
	East_Signal_Box_Door_Dyno = 0,
	East_Tank_Barrier_Dyno = 0,
	West_Signal_Box_Door_Dyno = 0,
	West_Tank_Barrier_Dyno = 0,
	EastOpen = false,
	WestOpen = false,
	EastDoorBuilt = false,
	WestDoorBuilt = false,
	AxisAtTrack = false, // West
	AlliesAtTrack = false, // East
	AxisPastTrack = false, // West
	AlliesPastTrack = false, // East
	EastB2Open = true,
	WestB2Open = true,
	AlliesAtB2 = false,
	AxisAtB2 = false,
	AxisTankBuilt = false,
	AlliesTankBuilt = false,

	Movers =
	{
		"MOVER_tank0",
		"MOVER_tank1",
	},

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

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

	Allied_tank_Built = function()
	{
		SetGoalPriority( "ESCORT_Allied_tank", 0.79);
		SetAvailableMapGoals( TEAM.AXIS, true, "ESCORT_Destroy_Allied_tank" );
		Map.AlliesTankBuilt = true;
		Util.MapDebugPrint( "Allied_tank_Built" );
	},

	Allied_tank_Damaged = function()
	{
		SetGoalPriority( "ESCORT_Allied_tank", 0.5);
		SetAvailableMapGoals( TEAM.AXIS, false, "ESCORT_Destroy_Allied_tank" );
		Map.AlliesTankBuilt = false;
		Util.MapDebugPrint( "Allied_tank_Damaged" );
	},

	Axis_Base_Defence_Built = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Axis_Base_Defence" );
		Util.MapDebugPrint( "Axis_Base_Defence_Built" );
	},

	Axis_Base_Defence_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_Base_Defence" );
		Util.MapDebugPrint( "Axis_Base_Defence_Destroyed" );
	},

	Axis_tank_Built = function()
	{
		SetGoalPriority( "ESCORT_Axis_tank", 0.79);
		SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Destroy_Axis_tank" );
		Map.AxisTankBuilt = true;
		Util.MapDebugPrint( "Axis_tank_Built" );
	},

	Axis_tank_Damaged = function()
	{
		SetGoalPriority( "ESCORT_Axis_tank", 0.5);
		SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Destroy_Axis_tank" );
		Map.AxisTankBuilt = false;
		Util.MapDebugPrint( "Axis_tank_Damaged" );
	},

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

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

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

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

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

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

	East_Signal_Box_Door_Built = function()
	{
		if (!Map.EastOpen)
		{
			SetGoalRole( "SWITCH_East_Track", ROLE.INFILTRATOR );
		}
		Map.EastDoorBuilt = true;
		Util.MapDebugPrint( "East_Signal_Box_Door_Built" );
	},

	East_Signal_Box_Door_Planted = function()
	{
		if ( Map.AlliesPastTrack )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_East_Signal_Box_Door.*" );
		}

		Map.East_Signal_Box_Door_Dyno += 1;
		Util.MapDebugPrint( "East_Signal_Box_Door_Planted" );
	},

	East_Signal_Box_Door_Defused = function()
	{
		Map.East_Signal_Box_Door_Dyno -= 1;
		Util.MapDebugPrint( "East_Signal_Box_Door_Defused" );
	},

	East_Signal_Box_Door_Destroyed = function()
	{
		ClearGoalRole( "SWITCH_East_Track", ROLE.INFILTRATOR );
		Map.EastDoorBuilt = false;
		Util.MapDebugPrint( "East_Signal_Box_Door_Destroyed" );
	},

	Allies_tank_b1 =
	{
		TriggerOnEntity = GetGoal("MOVER_tank1").GetEntity(),
		OnEnter = function(ent)
		{
			SetGoalPriority( "BUILD_East_Signal_Box_Door", 0.92, TEAM.AXIS );
			SetGoalPriority( "PLANT_East_Signal_Box_Door", 0.92, TEAM.ALLIES );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_East_Signal_Box_Door",
				"ATTACK_East_Track.*",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_East_Track.*",
				"BUILD_East_Tank_Barrier",
			});
			if ( !Map.EastOpen )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_East_Track" );
				SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Allied_tank" );
			}
			Map.AlliesAtTrack = true;
			Util.MapDebugPrint( "Allies_tank_at_b1" );
		},
		OnExit = function(ent)
		{
			Map.AlliesPastTrack = true;
			Map.AlliesAtTrack = false;
			Util.DisableGoal( "SWITCH_East_Track" );
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_East_Signal_Box_Door" );
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"CHECKPOINT_v1_base_flag",
				"PLANT_East_Signal_Box_Door",
				"ATTACK_East_Track.*",
			});
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_East_Track.*" );
			Util.MapDebugPrint( "Allies_tank_passed_b1" );
		},
	},

	East_Track_Switch_Raised = function()
	{
		if ( !Map.AlliesPastTrack )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_East_Track" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Allied_tank" );
		}
		ClearGoalRole( "SWITCH_East_Track", ROLE.INFILTRATOR );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_East_Track" );
		Map.EastOpen = true;
		Util.MapDebugPrint( "East_Track_Switch_Raised" );
	},

	East_Track_Switch_Lowered = function()
	{
		if ( Map.EastDoorBuilt )
		{
			SetGoalRole( "SWITCH_East_Track", ROLE.INFILTRATOR );
		}
		if ( Map.AlliesAtTrack )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_East_Track" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Allied_tank" );
		}
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_East_Track" );
		Map.EastOpen = false;
		Util.MapDebugPrint( "East_Track_Switch_Lowered" );
	},

	West_Signal_Box_Door_Built = function()
	{
		if (!Map.WestOpen)
		{
			SetGoalRole( "SWITCH_West_Track", ROLE.INFILTRATOR );
		}
		Map.WestDoorBuilt = true;
		Util.MapDebugPrint( "West_Signal_Box_Door_Built" );
	},

	West_Signal_Box_Door_Planted = function()
	{
		if ( Map.AxisPastTrack )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_West_Signal_Box_Door.*" );
		}

		Map.West_Signal_Box_Door_Dyno += 1;
		Util.MapDebugPrint( "West_Signal_Box_Door_Planted" );
	},

	West_Signal_Box_Door_Defused = function()
	{
		Map.West_Signal_Box_Door_Dyno -= 1;
		Util.MapDebugPrint( "West_Signal_Box_Door_Defused" );
	},

	West_Signal_Box_Door_Destroyed = function()
	{
		ClearGoalRole( "SWITCH_West_Track", ROLE.INFILTRATOR );
		Map.WestDoorBuilt = false;
		Util.MapDebugPrint( "West_Signal_Box_Door_Destroyed" );
	},

	Axis_tank_b1 =
	{
		TriggerOnEntity = GetGoal("MOVER_tank0").GetEntity(),
		OnEnter = function(ent)
		{
			SetGoalPriority( "BUILD_West_Signal_Box_Door", 0.92, TEAM.ALLIES );
			SetGoalPriority( "PLANT_West_Signal_Box_Door", 0.92, TEAM.AXIS );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"PLANT_West_Signal_Box_Door",
				"ATTACK_West_Track.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_West_Track.*",
				"BUILD_West_Tank_Barrier",
			});
			if ( !Map.WestOpen )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_West_Track" );
				SetAvailableMapGoals( TEAM.AXIS, false, "ESCORT_Axis_tank" );
			}
			Map.AxisAtTrack = true;
			Util.MapDebugPrint( "Axis_tank_at_b1" );
		},
		OnExit = function(ent)
		{
			Map.AxisPastTrack = true;
			Map.AxisAtTrack = false;
			Util.DisableGoal( "SWITCH_West_Track" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_West_Signal_Box_Door" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"CHECKPOINT_v1_base_flag",
				"PLANT_West_Signal_Box_Door",
				"ATTACK_West_Track.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_West_Track.*" );
			Util.MapDebugPrint( "Axis_tank_passed_b1" );
		},
	},

	West_Track_Switch_Raised = function()
	{
		if ( !Map.AxisPastTrack )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_West_Track" );
			SetAvailableMapGoals( TEAM.AXIS, true, "ESCORT_Axis_tank" );
		}
		ClearGoalRole( "SWITCH_West_Track", ROLE.INFILTRATOR );
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_West_Track" );
		Map.WestOpen = true;
		Util.MapDebugPrint( "West_Track_Switch_Raised" );
	},

	West_Track_Switch_Lowered = function()
	{
		if ( Map.WestDoorBuilt )
		{
			SetGoalRole( "SWITCH_West_Track", ROLE.INFILTRATOR );
		}
		if ( Map.AxisAtTrack )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_West_Track" );
			SetAvailableMapGoals( TEAM.AXIS, false, "ESCORT_Axis_tank" );
		}
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_West_Track" );
		Map.WestOpen = false;
		Util.MapDebugPrint( "West_Track_Switch_Lowered" );
	},

	East_Tank_Barrier_Built = function()
	{
		if ( Map.AlliesAtB2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_East_Tank_Barrier" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Allied_tank" );
		}

		Map.EastB2Open = false;
		Util.MapDebugPrint( "East_Tank_Barrier_Built" );
	},

	East_Tank_Barrier_Planted = function()
	{
		Map.East_Tank_Barrier_Dyno += 1;
		Util.MapDebugPrint( "East_Tank_Barrier_Planted" );
	},

	East_Tank_Barrier_Defused = function()
	{
		Map.East_Tank_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "East_Tank_Barrier_Defused" );
	},

	East_Tank_Barrier_Destroyed = function()
	{
		if ( Map.AlliesAtB2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Allied_tank" );
		}

		Map.EastB2Open = true;
		Util.MapDebugPrint( "East_Tank_Barrier_Destroyed" );
	},

	Allies_tank_b2 =
	{
		TriggerOnEntity = GetGoal("MOVER_tank1").GetEntity(),
		OnEnter = function(ent)
		{
			Map.AlliesAtB2 = true;
			SetAvailableMapGoals( TEAM.AXIS, true, ".*MG42_Axis" );
			SetGoalPriority( "PLANT_East_Tank_Barrier", 0.92);
			if ( !Map.EastB2Open )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_East_Tank_Barrier" );
				SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Allied_tank" );
			}
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_East_Barrier.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_East_Barrier.*" );
			Util.MapDebugPrint( "Allies_tank_at_b2" );
		},
		OnExit = function(ent)
		{
			Map.AlliesAtB2 = false;
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_East_Barrier.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_East_Barrier.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Final.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Final.*" );
		},
	},

	West_Tank_Barrier_Built = function()
	{
		if ( Map.AxisAtB2 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_West_Tank_Barrier" );
			SetAvailableMapGoals( TEAM.AXIS, false, "ESCORT_Axis_tank" );
		}

		Map.WestB2Open = false;
		Util.MapDebugPrint( "West_Tank_Barrier_Built" );
	},

	West_Tank_Barrier_Planted = function()
	{
		Map.West_Tank_Barrier_Dyno += 1;
		Util.MapDebugPrint( "West_Tank_Barrier_Planted" );
	},

	West_Tank_Barrier_Defused = function()
	{
		Map.West_Tank_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "West_Tank_Barrier_Defused" );
	},

	West_Tank_Barrier_Destroyed = function()
	{
		if ( Map.AxisAtB2 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "ESCORT_Axis_tank" );
		}

		Map.WestB2Open = true;
		Util.MapDebugPrint( "West_Tank_Barrier_Destroyed" );
	},

	Axis_tank_b2 =
	{
		TriggerOnEntity = GetGoal("MOVER_tank0").GetEntity(),
		OnEnter = function(ent)
		{
			Map.AxisAtB2 = true;
			SetAvailableMapGoals( TEAM.ALLIES, true, ".*MG42_Allied" );
			SetGoalPriority( "PLANT_West_Tank_Barrier", 0.92);
			if ( !Map.WestB2Open )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_West_Tank_Barrier" );
				SetAvailableMapGoals( TEAM.AXIS, false, "ESCORT_Axis_tank" );
			}
			SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_West_Barrier.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_West_Barrier.*" );
			Util.MapDebugPrint( "Axis_tank_at_b2" );
		},
		OnExit = function(ent)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_West_Barrier.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_West_Barrier.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Final.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Final.*" );
		},
	},

	Axis_Tank_Past_Barrier = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_West_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_West_Barrier.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_West_Barrier.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Final.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Final.*" );

		Util.MapDebugPrint( "Axis_Tank_Past_Barrier" );
	},

	Allies_Tank_Past_Barrier = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_East_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_East_Barrier.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_East_Barrier.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Final.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Final.*" );

		Util.MapDebugPrint( "Allies_Tank_Past_Barrier" );
	},

	Axis_Tank_At_Fuel_Dump = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, false, ".*" );
		ETUtil.WinningChat( TEAM.AXIS );
		ETUtil.LosingChat( TEAM.ALLIES );

		Util.MapDebugPrint( "Axis_Tank_At_Fuel_Dump" );
	},

	Allies_Tank_At_Fuel_Dump = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );
		ETUtil.WinningChat( TEAM.ALLIES );
		ETUtil.LosingChat( TEAM.AXIS );

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

global OnMapLoad = function()
{
	// Register callback functions

	OnTrigger( "^3The Allies have built their Base Defence!", Map.Allied_Base_Defence_Built );
	OnTrigger( "^3Axis have destroyed the Allied Base Defence!", Map.Allied_Base_Defence_Destroyed );

	OnTrigger( "The Allied tank has been repaired!", Map.Allied_tank_Built );
	OnTrigger( "The Allied tank has been damaged!", Map.Allied_tank_Damaged );

	OnTrigger( "^3The Axis have built their Base Defence!", Map.Axis_Base_Defence_Built );
	OnTrigger( "^3The Allies have destroyed the Axis Base Defence!", Map.Axis_Base_Defence_Destroyed );

	OnTrigger( "The Axis tank has been repaired!", Map.Axis_tank_Built );
	OnTrigger( "The Axis tank has been damaged!", Map.Axis_tank_Damaged );

	OnTrigger( "^1Axis ^7are in control of the V-1 Base!", Map.v1_base_flag_Axis_Captured );
	OnTrigger( "^dAllies ^7are in control of the V-1 Base!", Map.v1_base_flag_Allies_Captured );

	OnTrigger( "East Command Post constructed by ^dAllies ^7: Charge speed increased!", Map.East_Command_Post_Built );
	OnTrigger( "East Command Post constructed by ^1Axis ^7: Charge speed increased!", Map.East_Command_Post_Built );
	OnTrigger( "Allies have destroyed the Axis East Command Post!", Map.East_Command_Post_Destroyed );
	OnTrigger( "Axis have destroyed the Allied East Command Post!", Map.East_Command_Post_Destroyed );

	OnTrigger( "West Command Post constructed by ^dAllies ^7: Charge speed increased!", Map.West_Command_Post_Built );
	OnTrigger( "West Command Post constructed by ^1Axis ^7: Charge speed increased!", Map.West_Command_Post_Built );
	OnTrigger( "Allies have destroyed the Axis West Command Post!", Map.West_Command_Post_Destroyed );
	OnTrigger( "Axis have destroyed the Allied West Command Post!", Map.West_Command_Post_Destroyed );

	OnTrigger( "Axis have built the east signal box door!!", Map.East_Signal_Box_Door_Built );
	OnTrigger( "Planted at the East Signal Box Door.", Map.East_Signal_Box_Door_Planted );
	OnTrigger( "Defused at the East Signal Box Door.", Map.East_Signal_Box_Door_Defused );
	OnTrigger( "Allies have destroyed the east signal box door!!", Map.East_Signal_Box_Door_Destroyed );

	OnTrigger( "Allies have built the west signal box door!!", Map.West_Signal_Box_Door_Built );
	OnTrigger( "Planted at the West Signal Box Door.", Map.West_Signal_Box_Door_Planted );
	OnTrigger( "Defused at the West Signal Box Door.", Map.West_Signal_Box_Door_Defused );
	OnTrigger( "Axis have destroyed the west signal box door!!", Map.West_Signal_Box_Door_Destroyed );

	OnTrigger( "The ^dAllies ^7have constructed the West Tank Barrier!", Map.West_Tank_Barrier_Built );
	OnTrigger( "Planted at the West Tank Barrier.", Map.West_Tank_Barrier_Planted );
	OnTrigger( "Defused at the West Tank Barrier.", Map.West_Tank_Barrier_Defused );
	OnTrigger( "^1Axis ^7have destroyed the West Tank Barrier!", Map.West_Tank_Barrier_Destroyed );
	OnTrigger( "axis_we_passed_barrier2", Map.Axis_Tank_Past_Barrier );

	OnTrigger( "^1Axis ^7have constructed the East Tank Barrier!", Map.East_Tank_Barrier_Built );
	OnTrigger( "Planted at the East Tank Barrier.", Map.East_Tank_Barrier_Planted );
	OnTrigger( "Defused at the East Tank Barrier.", Map.East_Tank_Barrier_Defused );
	OnTrigger( "The ^dAllies ^7have destroyed the East Tank Barrier!", Map.East_Tank_Barrier_Destroyed );
	OnTrigger( "allies_we_passed_barrier2", Map.Allies_Tank_Past_Barrier );

	OnTrigger( "^dEast ^7track switch raised", Map.East_Track_Switch_Raised );
	OnTrigger( "^dEast ^7track switch lowered", Map.East_Track_Switch_Lowered );
	OnTrigger( "^1West ^7track switch raised", Map.West_Track_Switch_Raised );
	OnTrigger( "^1West ^7track switch lowered", Map.West_Track_Switch_Lowered );

	OnTrigger( "The ^1Axis ^7got their tank to the Fuel Dump!", Map.Axis_Tank_At_Fuel_Dump );
	OnTrigger( "The ^dAllies ^7got their tank to the Fuel Dump!", Map.Allies_Tank_At_Fuel_Dump );

	OnTriggerRegion(AABB(663.555,6734.264,177.125,885.929,6876.560,263.049),Map.Axis_tank_b1);
	OnTriggerRegion(AABB(5427.208,6811.568,177.125,5557.020,7013.329,251.688),Map.Allies_tank_b1);
	OnTriggerRegion(AABB(1933.874,3633.363,17.125,2164.083,3729.411,91.125),Map.Axis_tank_b2);
	OnTriggerRegion(AABB(4283.820,3723.101,17.125,4539.782,3978.472,96.046),Map.Allies_tank_b2);

	Util.DisableGoal( ".*", true ); // all but routes
	Util.EnableGoal( "AMMOCAB.*" );
	Util.EnableGoal( "HEALTHCAB.*" );

	Util.SetGoalPosition( 2097, 3250, 40, "PLANT_West_Tank_Barrier" );
	Util.SetGoalPosition( 4400, 3250, 40, "PLANT_East_Tank_Barrier" );


	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ESCORT_Allied_tank",
		"BUILD_Allied_tank",
		"BUILD_West_Signal_Box_Door",
		".*_Command_Post",
		"BUILD_Allied_Base_Defence",
		"CHECKPOINT_v1_base_flag",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"ESCORT_Axis_tank",
		"BUILD_Axis_tank",
		"BUILD_East_Signal_Box_Door",
		".*_Command_Post",
		"BUILD_Axis_Base_Defence",
		"CHECKPOINT_v1_base_flag",
	});

	// Priorities

	SetGoalPriority( "BUILD_Allied_tank", 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Allied_Base_Defence", 0.85, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Axis_tank", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Axis_Base_Defence", 0.85, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "SWITCH.*", 0.8 );

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "BUILD_.*" );
	Util.SetMaxUsers( 4, "CHECKPOINT_.*" );

	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );

	MapRoutes =
	{
		CHECKPOINT_v1_base_flag =
		{
			ROUTE_Allied_Main_Spawn  =
			{
				ROUTE_Allies_Spawn_E1  =
				{
					ROUTE_EF6  =
					{
					},
					ROUTE_E6  =
					{
					},
				},
				ROUTE_Allies_Spawn_E2  =
				{
					ROUTE_D7  =
					{
					},
				},
			},
			ROUTE_Axis_Main_Spawn  =
			{
				ROUTE_Axis_Spawn_E1  =
				{
					ROUTE_F7  =
					{
					},
					ROUTE_EF6  =
					{
					},
					ROUTE_F6  =
					{
					},
				},
				ROUTE_Axis_Spawn_E2  =
				{
					ROUTE_G8  =
					{
					},
				},
			},
		},
		ATTACK_West_Barrier_1 =
		{
			ROUTE_EastCP_Spawn  =
			{
				ROUTE_EastCP_Door  =
				{
				},
				ROUTE_EastCP_Bal  =
				{
				},
			},
			ROUTE_WestCP_Spawn  =
			{
				ROUTE_WestCP_Door  =
				{
				},
				ROUTE_West_CP_Bal  =
				{
				},
			},
			ROUTE_Allied_Main_Spawn  =
			{
				ROUTE_Allies_Spawn_E1  =
				{
				},
				ROUTE_Allies_Spawn_E2  =
				{
				},
			},
			ROUTE_Axis_Main_Spawn  =
			{
				ROUTE_Axis_Spawn_E1  =
				{
				},
				ROUTE_Axis_Spawn_E2  =
				{
				},
			},
		},
	};
	MapRoutes.ATTACK_West_Track_1 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_West_Track_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_West_Track_3 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_East_Barrier_1 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_East_Barrier_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_East_Barrier_3 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_East_Track_1 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_East_Track_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_East_Track_3 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_West_Barrier_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.ATTACK_West_Barrier_3 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_Final_1 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_Final_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_Final_3 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_Final_4 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_Final_5 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_Final_6 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_Final_7 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_West_Barrier_1 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_West_Barrier_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_West_Barrier_3 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_West_Track_1 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_West_Track_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_West_Track_3 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_East_Barrier_1 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_East_Barrier_2 = MapRoutes.ATTACK_West_Barrier_1;
	MapRoutes.DEFEND_East_Barrier_3 = MapRoutes.ATTACK_West_Barrier_1;

	Util.Routes(MapRoutes);

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

global OnBotJoin = function( bot )
{
	//hack airstrikes for this map
	as = bot.GetWeapon(WEAPON.SMOKE_MARKER);
	as.PrimaryFire.RequiresTargetOutside = false;
};
