/******************************************************************
UPDATED BY: BubbaG1 & **DRC**Stunner
UPDATED: July 16, 2012
- Disabled CP, Old City Water Pump, and Oasis Water Pump Defuse
  goals so bots will focus on main objectives.  Regular players
  can focus on the CP, if they want to.
UPDATED: May 31, 2015
- ROUTE_tunnel1 and ROUTE_oc_tunnel are disabled until water pumps are built
- removed map goal string variables
- removed duplicated routes
- removed unnecessary jumplow flags from some waypoints
*******************************************************************/
global Map =
{
	//set this to true if you want axis to try and dynamite water pump2
	//after old city wall is destroyed.
	DestroyWaterPumpAfterWall = false,
	DispenseAmmoTime = 15,

	//dyno counters
	NorthDyno = 0,
	SouthDyno = 0,

	WallStatus = true, //intact
	PumpOasis = false,
	PumpCity = false,

	// aggressive defenders will be split into north and south 'teams'
	// this will keep them from wandering across the map
	Roles =
	{
		AXIS =
		{
			DEFENDER1 =
			{
				numbots = 2,
			},
			DEFENDER2 =
			{
				numbots = 2,
			},
		},
	},

	// path through for axis throwing a/s over the wall when attempting to reclaim
	Airstrike =
	{
		wall =
		{
			Enabled = true,
			Team = (1<<TEAM.AXIS),
			Facing = Vector3(-0.601,-0.392,0.696),
			NoPause = true,
		},
	},

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

	Allied_Command_Post_Planted = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Allied_Command_Post_.*" );

		Util.MapDebugPrint( "Allied_Command_Post_Planted" );
	},

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

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

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

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

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

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

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

	Oasis_Water_Pump_Built = function()
	{
		Map.PumpOasis = true;
		if(Map.WallStatus){
			SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_p1axis_west_courtyard" );
			SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_waterpump" );
		}
		Util.MapDebugPrint( "Oasis_Water_Pump_Built" );

		sleep(100); //wait until water is pumped out
		if(Map.PumpOasis){
			Util.EnableGoal("ROUTE_tunnel1");
			Util.MapDebugPrint( "ROUTE_tunnel1 enabled" );
		}
	},

	Oasis_Water_Pump_Planted = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Oasis_Water_Pump_.*" );

		Util.MapDebugPrint( "Oasis_Water_Pump_Planted" );
	},

	Oasis_Water_Pump_Destroyed = function()
	{
		Map.PumpOasis = false;
		Util.DisableGoal("ROUTE_tunnel1");
		Util.MapDebugPrint( "Oasis_Water_Pump_Destroyed" );
	},

	Old_City_Water_Pump_Built = function()
	{
		Map.PumpCity = true;

		Util.MapDebugPrint( "Old_City_Water_Pump_Built" );
		sleep(97); //wait until water is pumped out
		if(Map.PumpCity){
			Util.EnableGoal("ROUTE_oc_tunnel");
			Util.MapDebugPrint( "ROUTE_oc_tunnel enabled" );
		}
	},

	Old_City_Water_Pump_Planted = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Old_City_Water_Pump_.*" );

		Util.MapDebugPrint( "Old_City_Water_Pump_Planted" );
	},

	Old_City_Water_Pump_Destroyed = function()
	{
		Map.PumpCity = false;
		Util.DisableGoal("ROUTE_oc_tunnel");

		Util.MapDebugPrint( "Old_City_Water_Pump_Destroyed" );
	},

	North_No_Dyno = function()
	{
		Map.NorthDyno = 0;

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_north_clear.*" );

		if ( Map.SouthDyno < 1 ) {
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gun_flex.*" );
		}
	},

	North_Anti_Tank_Gun_Destroyed = function()
	{
		//don't worry about additional dynos at this point
		Map.North_No_Dyno();

		//focus on south defense
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFUSE_North_Anti_Tank_Gun.*",
			"DEFEND_North_Gun.*",
			"TRIPMINE_NorthGun.*",
		});

		Util.MapDebugPrint( "North_Anti_Tank_Gun_Destroyed" );
	},

	North_Plant = function()
	{
		++Map.NorthDyno;

		//shift defense to support defuse
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_gun_flex.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_north_clear.*" );

		Util.MapDebugPrint( "North_Plant" );

		Map.NorthDynoThreadId = threadId();
		sleep(31);
		if (Map.NorthDyno > 0 && Map.NorthDynoThreadId == threadId())
		{
			Map.North_No_Dyno();
			Util.MapDebugPrint( "North_Defuse was not called !" );
		}
	},

	North_Defuse = function()
	{
		--Map.NorthDyno;

		if ( Map.NorthDyno < 1  )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_north_clear.*" );

			if ( Map.SouthDyno < 1 ) {
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gun_flex.*" );
			}
		}

		Util.MapDebugPrint( "North_Defuse" );
	},

	South_No_Dyno = function()
	{
		Map.SouthDyno = 0;

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_south_clear.*" );

		if ( Map.NorthDyno < 1 ) {
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gun_flex.*" );
		}
	},

	South_Anti_Tank_Gun_Destroyed = function()
	{
		//don't worry about additional dynos at this point
		Map.South_No_Dyno();

		//focus on north defense
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFUSE_South_Anti_Tank_Gun.*",
			"DEFEND_South_Gun.*",
			"TRIPMINE_SouthGun.*",
		});

		Util.MapDebugPrint( "South_Anti_Tank_Gun_Destroyed" );
	},

	South_Plant = function()
	{
		++Map.SouthDyno;

		//shift defense to support defuse
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_gun_flex.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_south_clear.*" );

		Util.MapDebugPrint( "South_Plant" );

		Map.SouthDynoThreadId = threadId();
		sleep(31);
		if (Map.SouthDyno > 0 && Map.SouthDynoThreadId == threadId())
		{
			Map.South_No_Dyno();
			Util.MapDebugPrint( "South_Defuse was not called !" );
		}
	},

	South_Defuse = function()
	{
		--Map.SouthDyno;

		if ( Map.SouthDyno < 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_south_clear.*" );

			if ( Map.NorthDyno < 1 ) {
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gun_flex.*" );
			}
		}

		Util.MapDebugPrint( "South_Defuse" );
	},

	Old_City_Wall_Destroyed = function()
	{
		// this region trigger isn't needed anymore
		DeleteTriggerRegion("snuckpast");

		// and kill the thread watching players that snuck through
		if ( Map.WatchPlayerThreadId ) {
			threadKill(Map.WatchPlayerThreadId);
		}

		Map.DispenseAmmoTime = 5;
		Map.WallStatus = false;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"REPAIRMG42_Garrison_MG_Nest",
			"MOUNTMG42_Garrison_MG_Nest",
			"DEFEND_South_Gun_.*",
			"DEFEND_North_Gun_.*",
			"DEFEND_middle_patrol.*",
			".*_p2axis_.*",
			"MOBILEMG42_rGuns.*",
			"BUILD_Garrison_MG_Nest",
			"BUILD_Axis_Command_Post",
			"DEFEND_gun_flex.*",
			"PLANTMINE_rGuns.*",
			"CALLARTILLERY_rTunnel.*",
			"CALLARTILLERY_rSouthEntrance.*",
			"ARTILLERY_S_rTunnel.*",
			"ARTILLERY_S_rSouthEntrance.*",
			"TRIPMINE_NorthGun.*",
			"TRIPMINE_SouthGun.*",
		});

		// all classes now
		SetGoalPriority( "DEFEND_north_clear.*", 0.92 );
		SetGoalPriority( "DEFEND_south_clear.*", 0.92 );

		// and turn em off if no dyno
		if ( Map.NorthDyno < 1 ) {
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_north_clear.*" );
		}

		if ( Map.SouthDyno < 1 ) {
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_south_clear.*" );
		}

		// disable the pathrough airstrike at the wall
		Map.Airstrike.wall.Enabled = false;

		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_p1axis_.*",
			"AMMOCAB_cabinet_ammo",
			"HEALTHCAB_cabinet_health",
			"PLANT_Oasis_Water_Pump",
			"PLANT_Old_City_MG_Nest",
			"PLANT_Allied_Command_Post",
			"DEFUSE_Old_City_Wall.*",
			"DEFEND_Flag_.*",
			"CALLARTILLERY_rFirstTunnel.*",
			"ARTILLERY_S_rFirstTunnel.*",
			"MOBILEMORTAR_waterpump",
			"PLANTMINE_rFlag.*",
			"TRIPMINE_Flag.*",
			"SNIPE_p2axis_garrison_canopy",
		});

		// this one can be enabled sooner
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMORTAR_bGuns.*" );

		//optionally keep the waterpump2 dynamite action. problem is, meds will
		//leave defensive spots to go revive engineers as they inevitably get killed
		//because its so close to allied spawn
		if ( !Map.DestroyWaterPumpAfterWall )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Old_City_Water_Pump" );
		}

		sleep(0.1);
		Wp.CheckBlockable();

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Guns_.*",
			"SMOKEBOMB_bGuns.*",
			"PLANT_North_Anti_Tank_Gun",
			"PLANT_South_Anti_Tank_Gun",
			"PLANT_Garrison_MG_Nest",
			"PLANT_Axis_Command_Post",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNTMG42_Old_City_MG_Nest",
			"REPAIRMG42_Old_City_MG_Nest",
			"HEALTHCAB_cabinet_health",
			"AMMOCAB_cabinet_ammo",
			"ATTACK_Wall_.*",
			"BUILD_Oasis_Water_Pump",
			"BUILD_Old_City_MG_Nest",
			"AIRSTRIKE_bWall.*",
		});

		Util.MapDebugPrint( "Old_City_Wall_Destroyed" );
	},

	oldcityflag_Axis_Captured = function()
	{
		SetGoalPriority( "PLANT_Old_City_Wall", 0.91, TEAM.ALLIES, CLASS.ENGINEER );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Wall_.*",
			"AMMOCAB_cabinet_ammo",
			"HEALTHCAB_cabinet_health",
			"AIRSTRIKE_bWall.*",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Flag_.*",
			".*_p1axis_.*",
			"CALLARTILLERY_rFirstTunnel.*",
			"ARTILLERY_S_rFirstTunnel.*",
		});

		Util.MapDebugPrint( "oldcityflag_Axis_Captured" );
	},

	oldcityflag_Allies_Captured = function()
	{
		SetGoalPriority( "PLANT_Old_City_Wall", 0.95, TEAM.ALLIES, CLASS.ENGINEER );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Wall_.*",
			"AMMOCAB_cabinet_ammo",
			"HEALTHCAB_cabinet_health",
			"AIRSTRIKE_bWall.*",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Flag_.*",
			".*_p1axis_.*",
			"CALLARTILLERY_rFirstTunnel.*",
			"ARTILLERY_S_rFirstTunnel.*",
		});

		Util.MapDebugPrint( "oldcityflag_Allies_Captured" );
	},

	WatchPlayerLimbo = function()
	{
		while(Map.WatchPlayer && !GetEntFlags(Map.WatchPlayer, ENTFLAG.LIMBO)) {
			sleep(0.5);
		}

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_north_clear.*",
			"DEFEND_south_clear.*",
		});
		Util.MapDebugPrint( "Sneaky player died" );
	},

	SnuckPast =
	{
		Name = "snuckpast",
		TriggerOnClass = CLASS.ENGINEER,
		OnEnter = function(ent)
		{
			team = GetEntTeam(ent);
			if ( team != TEAM.ALLIES ) { return; }

			// spawn the engineers back (only do this once)
			if ( !Map.SpawnedBack ) {
				ETUtil.SuicideSpawn( TEAM.AXIS, 1, -1, CLASS.ENGINEER );
				Map.SpawnedBack = true;
			}

			// have the engineers defend the guns
			Util.LimitToClass( "DEFEND_north_clear.*", TEAM.AXIS, CLASS.ENGINEER );
			Util.LimitToClass( "DEFEND_south_clear.*", TEAM.AXIS, CLASS.ENGINEER );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_north_clear.*",
				"DEFEND_south_clear.*",
			});

			// and do it until the sneaky player dies
			Map.WatchPlayer = ent;

			if ( Map.WatchPlayerThreadId ) {
				threadKill(Map.WatchPlayerThreadId);
			}
			Map.WatchPlayerThreadId = thread(Map.WatchPlayerLimbo);

		},
	},
};

global OnMapLoad = function()
{
	Util.SetGoalPosition( 4576.686, 6586.125, -468.781, "PLANT_Old_City_Water_Pump" );

	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( "The Garrison MG Nest has been constructed!", Map.Garrison_MG_Nest_Built );
	OnTrigger( "Allies have built the Oasis Water Pump!", Map.Oasis_Water_Pump_Built );
	OnTrigger( "The Old City MG Nest has been constructed!", Map.Old_City_MG_Nest_Built );
	OnTrigger( "Allies have built the Old City Water Pump!", Map.Old_City_Water_Pump_Built );
	OnTrigger( "Planted at the Allied Command Post.", Map.Allied_Command_Post_Planted );
	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( "The Garrison MG Nest has been damaged!", Map.Garrison_MG_Nest_Destroyed );
	OnTrigger( "Allies have destroyed the North Anti-Tank Gun!", Map.North_Anti_Tank_Gun_Destroyed );
	OnTrigger( "Planted at the Oasis Water Pump.", Map.Oasis_Water_Pump_Planted );
	OnTrigger( "Axis have damaged the Oasis Water Pump!", Map.Oasis_Water_Pump_Destroyed );
	OnTrigger( "The Old City MG Nest has been damaged!", Map.Old_City_MG_Nest_Destroyed );
	OnTrigger( "Allies have breached the Old City wall", Map.Old_City_Wall_Destroyed );
	OnTrigger( "Planted at the Old City Water Pump.", Map.Old_City_Water_Pump_Planted );
	OnTrigger( "Axis have damaged the Old City Water Pump!", Map.Old_City_Water_Pump_Destroyed );
	OnTrigger( "Allied team has destroyed the South Anti-Tank Gun!", Map.South_Anti_Tank_Gun_Destroyed );
	OnTrigger( "Axis reclaim the Old City!", Map.oldcityflag_Axis_Captured );
	OnTrigger( "Allies capture the Old City!", Map.oldcityflag_Allies_Captured );
	OnTrigger( "Planted at the North Anti-Tank Gun.", Map.North_Plant );
	OnTrigger( "Planted at the South Anti-Tank Gun.", Map.South_Plant );
	OnTrigger( "Defused at the North Anti-Tank Gun.", Map.North_Defuse );
	OnTrigger( "Defused at the South Anti-Tank Gun.", Map.South_Defuse );

	// detect engineers getting through when wall is still intact
	OnTriggerRegion(AABB(5731.727,4805.139,-869.945,5983.292,4945.652,-771.262),Map.SnuckPast);
	OnTriggerRegion(AABB(5536.597,6820.100,-565.253,5700.429,7872.364,-367.812),Map.SnuckPast);

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=15, MaxCampTime=30});
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=10, MaxCampTime=15});
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=45, MaxCampTime=90});
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=30, MaxCampTime=60});
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=120, MaxCampTime=120});
	SetMapGoalProperties( "DEFEND_north_clear.*", {MinCampTime=30, MaxCampTime=35});
	SetMapGoalProperties( "DEFEND_south_clear.*", {MinCampTime=30, MaxCampTime=35});
	SetMapGoalProperties( "DEFEND_middle_patrol.*", {MinCampTime=1, MaxCampTime=2});

	Util.ExcludeClass( "MOUNTMG42_.*", 0,  CLASS.MEDIC, CLASS.ENGINEER );

	// don't backtrack to defuse these unless camping
	SetGoalPriority( "DEFUSE_Oasis_Water_Pump.*", 0.7, TEAM.ALLIES, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_Allied_Command_Post.*", 0.7, TEAM.ALLIES, CLASS.ENGINEER, true );

	// Max users per goal
	Util.SetMaxUsersInProgress( 15, "CHECKPOINT.*" );
	Util.SetMaxUsers( 1, {"DEFEND.*", "MOUNTMG42.*"} );
	Util.SetMaxUsersInProgress( 5, {"DEFEND_north_clear.*", "DEFEND_south_clear.*"} );

	// Allied goals
	SetGoalPriority( "BUILD_Oasis_Water_Pump", 0.94, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Allied_Command_Post", 0.93, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "CHECKPOINT_oldcityflag", 0.92, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Old_City_Wall", 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Old_City_Water_Pump", 0.90, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Old_City_MG_Nest", 0.89, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_North_Anti_Tank_Gun", 0.81, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_South_Anti_Tank_Gun", 0.81, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Garrison_MG_Nest", 0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Axis_Command_Post", 0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Garrison_MG_Nest", 0.81, TEAM.ALLIES, CLASS.COVERTOPS );

	// Axis goals
	SetGoalPriority( "PLANTMINE_rFlag.*", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Old_City_Water_Pump", 0.83, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Oasis_Water_Pump", 0.83, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Old_City_MG_Nest", 0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Allied_Command_Post", 0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Old_City_MG_Nest", 0.82, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Allied_Command_Post", 0.81, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "DEFEND_north_clear.*", 0.92 );
	SetGoalPriority( "DEFEND_south_clear.*", 0.92 );
	SetGoalPriority( "DEFEND_middle_patrol.*", 0.49 );
	SetGoalPriority( "DEFEND_middle_patrol5", 0.55 ); // peak out the back for campers
	SetGoalPriority( "DEFUSE_Old_City_Wall_.*", 1.10, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_North_Anti_Tank_Gun_.*", 1.15, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_South_Anti_Tank_Gun_.*", 1.15, TEAM.AXIS, CLASS.ENGINEER, true );

	Util.DisableGoal( ".*", true );
	Util.DisableGoal({ "ROUTE_tunnel1", "ROUTE_oc_tunnel" });

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"REPAIRMG42_Old_City_MG_Nest",
		"BUILD_Oasis_Water_Pump",
		"PLANT_Old_City_Wall",
		"PLANT_Garrison_MG_Nest",
		"MOUNTMG42_Old_City_MG_Nest",
		"CHECKPOINT_oldcityflag",
		"BUILD_Old_City_Water_Pump",
		"BUILD_Allied_Command_Post",
		"BUILD_Old_City_MG_Nest",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"PLANTMINE_rFlag.*",
		"AMMOCAB_cabinet_ammo",
		"HEALTHCAB_cabinet_health",
		"PLANT_Allied_Command_Post",
		"PLANT_Old_City_MG_Nest",
		"PLANT_Old_City_Water_Pump",
		"SNIPE_p1axis_valleyledge_2",
		"SNIPE_p1axis_behindflagroom",
		"SNIPE_p1axis_supplyroom",
		"SNIPE_p1axis_valleyledge_1",
		"CHECKPOINT_oldcityflag",
		"DEFEND_Flag_.*",
		"TRIPMINE_Flag.*",
		"MOBILEMORTAR_waterpump",
		"CALLARTILLERY_rFirstTunnel.*",
		"ARTILLERY_S_rFirstTunnel.*",
	});

	// randomize plant goal position
	Util.AddUsePoint( "PLANT_North_Anti_Tank_Gun", { Vec3(9662, 4696, -103), Vec3(9649, 4773, -200) });
	Util.AddUsePoint( "PLANT_South_Anti_Tank_Gun", { Vec3(9658, 3935, -103), Vec3(9644, 3869, -200) });

	Util.MapDebugPrint( "OnMapLoad" );
};

global InitializeRoutes = function()
{
	rAxis =
	{
		ROUTE_overwall =
		{
			ROUTE_walltop = {},
			ROUTE_wallfar = {},
		},
		ROUTE_walldoor = {},
	};

	MapRoutes =
	{
		CHECKPOINT_oldcityflag =
		{
			ROUTE_allyspawn =
			{
				ROUTE_frontdoor_l = {},
				ROUTE_frontdoor_r = {},
				ROUTE_leftdoor =
				{
					Weight = 2,
					ROUTE_toproute_a =
					{
						ROUTE_toproute_b = {},
						ROUTE_toproute_c = {},
					},
					ROUTE_ruins_l =
					{
						ROUTE_ruins_stairs =
						{
							ROUTE_flag_l = {},
							ROUTE_flag_t = {},
						},
					},
				},
				ROUTE_tunnel1 =
				{
					Weight = 2,
					ROUTE_tunnel2 = {},
				},
			},
			ROUTE_cp =
			{
				ROUTE_ruins_l = {},
			},
			ROUTE_AxisSpawn1 = rAxis,
			ROUTE_AxisSpawn2 = rAxis,
		},
		PLANT_North_Anti_Tank_Gun =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_oc_tunnel =
				{
					Weight = 3,
					ROUTE_southentrance = {},
					ROUTE_se_corner = { ROUTE_eastentrance = {}, },
				},
				ROUTE_upper_connection =
				{
					ROUTE_northentrance1 =
					{
						ROUTE_cp_split =
						{
							ROUTE_cp_route = {},
							ROUTE_halls = {},
						},
					},
					ROUTE_northentrance2 = {},
					ROUTE_ne_corner = { ROUTE_eastentrance = {}, },
					ROUTE_westside =
					{
						ROUTE_sw_corner =
						{
							ROUTE_southentrance = {},
							ROUTE_se_corner = {},
						},
					},
				},
			},
		},
		PLANT_South_Anti_Tank_Gun =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_oc_tunnel =
				{
					Weight = 3,
					ROUTE_southentrance = {},
					ROUTE_se_corner = { ROUTE_eastentrance = {}, },
				},
				ROUTE_upper_connection =
				{
					ROUTE_northentrance1 =
					{
						ROUTE_cp_split =
						{
							ROUTE_halls =
							{
								ROUTE_uppersouth = {},
							},
						},
						ROUTE_lowermg1 = { ROUTE_lowermg2 = {}, },
					},
					ROUTE_northentrance2 = {},
					ROUTE_ne_corner = { ROUTE_eastentrance = {}, },
					ROUTE_westside =
					{
						ROUTE_sw_corner =
						{
							ROUTE_southentrance = {},
							ROUTE_se_corner = {},
						},
					},
				},
			},
		},
		PLANT_Oasis_Water_Pump =
		{
			ROUTE_FlagSpawn =
				{ ROUTE_tunnel2 = { ROUTE_tunnel1 = {}, }, },
		},
		DEFEND_gun_flex_4 =
		{
			ROUTE_AxisSpawn1 =
			{
				ROUTE_gunpatrol2 = { ROUTE_northentrance2 = {}, },
			},
			ROUTE_AxisSpawn2 =
			{
				ROUTE_gunpatrol2 = {},
			},
		},
		//most of the time they should check gun area before taking tunnel to the pump
		PLANT_Old_City_Water_Pump =
		{
			ROUTE_AxisSpawn1 =
			{
				ROUTE_oc_tunnel = {},
				ROUTE_gunpatrol = { ROUTE_oc_tunnel = {}, },
				ROUTE_gunpatrol2 =
				{
					ROUTE_gunpatrol = {},
				},
			},
			ROUTE_AxisSpawn2 =
			{
				ROUTE_oc_tunnel = {},
				ROUTE_gunpatrol = {},
				ROUTE_gunpatrol2 = {},
			},
		},
		MOBILEMG42_rGuns1 =
		{
			// send them this way so they don't have their back to enemy when heading to them
			ROUTE_AxisSpawn1 =
			{
				ROUTE_nTruck = {},
			},
			ROUTE_AxisSpawn2 =
			{
				ROUTE_nTruck = {},
			},
		},
		SMOKEBOMB_bGuns_south =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_oc_tunnel =
				{
					ROUTE_southentrance = {},
				},
			},
		},
		SMOKEBOMB_bGuns_north =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_upper_connection = {},
				ROUTE_lower_connection = {},
			},
		},
	};
	MapRoutes["DEFEND_Flag_.*"] =
		{
			ROUTE_AxisSpawn1 = rAxis,
			ROUTE_AxisSpawn2 = rAxis,
		};

	//copy some routes
	MapRoutes.PLANT_North_Anti_Tank_Gun.ROUTE_FlagSpawn.ROUTE_lower_connection = MapRoutes.PLANT_North_Anti_Tank_Gun.ROUTE_FlagSpawn.ROUTE_upper_connection;
	MapRoutes.PLANT_South_Anti_Tank_Gun.ROUTE_FlagSpawn.ROUTE_lower_connection = MapRoutes.PLANT_South_Anti_Tank_Gun.ROUTE_FlagSpawn.ROUTE_upper_connection;
	MapRoutes.PLANT_Garrison_MG_Nest = MapRoutes.PLANT_North_Anti_Tank_Gun;
	MapRoutes.PLANT_Axis_Command_Post = MapRoutes.PLANT_North_Anti_Tank_Gun;
	MapRoutes["ATTACK_Guns_.*"] = MapRoutes.PLANT_North_Anti_Tank_Gun;
	MapRoutes["DEFEND_gun_flex_[56]"] = MapRoutes.DEFEND_gun_flex_4;
	MapRoutes.MOBILEMG42_rGuns2 = MapRoutes.MOBILEMG42_rGuns1;

	Util.Routes(MapRoutes);
};
