//==========================================================================================
//
//	tiger_dump.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	^4Tardis	30 December 2010	Converted from fuledump
//	AXIS ATTACK MAP
// 	^4Tardis	05 September 2011 	NOTE: Use with tiger_dump_b7.pk3
//	^4Tardis 	22 December 2011	Fixed some bugs
//==========================================================================================
//

global Map =
{
	DispenseHealthTime = 10.0,
	DispenseAmmoTime = 1.0,
	DefendingTeam = TEAM.ALLIES,

	Tunnel_Doors = true,
	Depot_Gates = true,
	Tank_Over_Bridge = false,
	Tank_Near_Bridge = false,
	Front_Dump = false,
	Rear_Dump = false,
	FuelDumpDyno = 0,

	tbdoorOne = false, //closed
	tbdoorTwo = false,

	TankStatus = 1, //tank is repaired by default
	BridgeStatus = 0, //not built
	FootBridgeStatus = 0,

	// AXIS covert op on depot roof will always be detected
	// key = position, value = radius
	CovertDetectionSpots =
	{
		{ Vector3(-10829, -6607, 640), 500 },
	},

	Switches =
	{
		tbdoorOne =
		{
			WaypointName = "tbdoor1",
			LimitTeam = 0,
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},

		tbdoorTwo =
		{
			WaypointName = "tbdoor2",
			LimitTeam = 0,
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
	},

	// some dedicated defenders for tunnel grate breach
	Roles =
	{
		ALLIES =
		{
			DEFENDER1 =
			{
				numbots = 3,
			},
		},
	},

	// spawn a few AXIS bots back when a disguised covert op gets through the tunnel grate
	FallbackTriggered = false,
	AlliesFallBack =
	{
		Name = "AlliesFallBack",
		TriggerOnClass = CLASS.COVERTOPS,
		OnEnter = function(ent)
		{
			// only for allied covert ops in disguise
			if ( Map.FallbackTriggered || !GetEntFlags(ent, ENTFLAG.DISGUISED) || GetEntTeam(ent) != TEAM.AXIS ) {
				return;
			}

			Map.FallbackTriggered = true;

			// NOTE: they will not shift forward after they do this since it's highly likely
			// that humans will keep trying to exploit it. the special camps will be disabled
			// on tunnel door breach.

			// spawn the AXIS engineers back to defend
			ETUtil.SuicideSpawn( TEAM.ALLIES, 2, -1, CLASS.ENGINEER );

			// disable the bridge plant for them
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Bridge" );

			// and defend the depot
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"BUILD_West_Axis_Base_Fortification",
				"PLANTMINE_rGate.*",
				"DEFEND_rTeamDoor.*",
			});
		},
	},

	DepotRoofCounter = 0,
	DepotRoof =
	{
		Name = "DepotRoof",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			// only for allied players
			if ( GetEntTeam(ent) != TEAM.AXIS ) {
				return;
			}

			Map.DepotRoofCounter += 1;

			// don't do anything if depot hasn't been breached
			if ( Map.Depot_Gates ) {
				return;
			}

			// some goals to clear out the roof
			Util.EnableGroup( "depotroof", TEAM.ALLIES );
		},
		OnExit = function(ent)
		{
			// only for allied players
			if ( GetEntTeam(ent) != TEAM.AXIS ) {
				return;
			}

			Map.DepotRoofCounter -= 1;

			// is the roof clear?
			if ( Map.DepotRoofCounter < 1 ) {
				Util.DisableGroup( "depotroof", TEAM.ALLIES );
			}
		},
	},

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

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

	Axis_Command_Post_Built = function( trigger )
	{
		Util.SetMaxUsersInProgress( 9, "PLANT_Fuel_Dump");
		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		Util.SetMaxUsersInProgress( 1, "PLANT_Fuel_Dump");
		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

	Bridge_Built = function( trigger )
	{
		Map.BridgeStatus = 1;

		// Axis goals
		if ( Map.Tunnel_Doors )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Bridge_.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Tunnel_Doors.*" );
		}

		// engineers should focus on bridge first
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"BUILD_Tank",
			"ROUTE_mainbridgeRoute3",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "SMOKEBOMB_allies_bridge.*" );

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"CALLARTILLERY_arty_bridge_cons1",
			"CALLARTILLERY_arty_bridge_cons2",
			"MOBILEMORTAR_rBridge.*",
		});

		Util.MapDebugPrint( "Bridge_Built" );
	},

	Bridge_Damaged = function( trigger )
	{
		Map.BridgeStatus = 0;

		// Axis goals
		if ( Map.Tunnel_Doors )
		{
			if ( Map.FootBridgeStatus == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Tunnel_Doors.*" );
			}

			SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Bridge_.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank" );

			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Tunnel_Doors.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_Bridge_.*",
				"CALLARTILLERY_arty_bridge_cons1",
				"CALLARTILLERY_arty_bridge_cons2",
			});
		}

		if ( Map.FootBridgeStatus == 1 )
		{
			//turn this off so there is still a balanced attack
			SetAvailableMapGoals( TEAM.AXIS, false, "ROUTE_footbridgeRoute" );
		}

		if ( !Map.Tank_Over_Bridge )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "SMOKEBOMB_allies_bridge.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMORTAR_rBridge.*" );
		}

		SetAvailableMapGoals( TEAM.AXIS, false, "ROUTE_mainbridgeRoute3" );

		Util.MapDebugPrint( "Bridge_Damaged" );
	},

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

	East_Axis_Base_Fortification_Built = function( trigger )
	{
		Map.Front_Dump = true;

		//  ALLIES goals
		// cs: allied bots shouldn't worry about this as it hurts ALLIES chances of defusing // no need as use side door
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_East_Axis_Base_Fortification" );

		if ( Map.Rear_Dump && !Map.Depot_Gates )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Fuel_Dump" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_FD_patrol" );
		}

		// AXIS goals
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_East_Axis_Base_Fortification" );

		Util.MapDebugPrint( "East_Axis_Base_Fortification_Built" );
	},

	East_Axis_Base_Fortification_Damaged = function( trigger )
	{
		Map.Front_Dump = false;

		// AXIS goals
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_East_Axis_Base_Fortification" );

		if ( !Map.Depot_Gates )
		{ SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Fuel_Dump" ); }

		// Allied goals
		// cs: Allies bots shouldn't build this. makes it harder to defuse // no need use side door
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_East_Axis_Base_Fortification",
			"ROUTE_FD_patrol",
		});

		Util.MapDebugPrint( "East_Axis_Base_Fortification_Damaged" );
	},

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

	West_Axis_Base_Fortification_Built = function( trigger )
	{
		Map.Rear_Dump = true;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_West_Axis_Base_Fortification" );

		if ( Map.Front_Dump && !Map.Depot_Gates )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Fuel_Dump" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_FD_patrol" );
		}

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_West_Axis_Base_Fortification" );

		Util.MapDebugPrint( "West_Axis_Base_Fortification_Built" );
	},

	West_Axis_Base_Fortification_Damaged = function( trigger )
	{
		Map.Rear_Dump = false;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_West_Axis_Base_Fortification" );

		if ( !Map.Depot_Gates )
		{ SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Fuel_Dump" ); }

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_West_Axis_Base_Fortification",
			"ROUTE_FD_patrol",
		});

		Util.MapDebugPrint( "West_Axis_Base_Fortification_Damaged" );
	},

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

	Foot_Bridge_Built = function( trigger )
	{
		Map.FootBridgeStatus = 1;

		if ( Map.Tunnel_Doors )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Tunnel_Doors.*" );
		}

		SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_footbridgeRoute2" );

		Util.MapDebugPrint( "Foot_Bridge_Built" );
	},

	Foot_Bridge_Destroyed = function( trigger )
	{
		Map.FootBridgeStatus = 0;

		//route some AXIS by the footbridge to provide some cover for engineers
		SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_footbridgeRoute" );

		//make sure tunnel attack goals are off if both bridges aren't built
		if ( Map.BridgeStatus == 0 && !Map.Tunnel_Doors )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Tunnel_Doors.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Bridge_.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank" );

			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Tunnel_Doors.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Bridge_.*" );
		}

		if ( Map.Tunnel_Doors )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Road_MG" );
		}

		SetAvailableMapGoals( TEAM.AXIS, false, "ROUTE_footbridgeRoute2" );

		Util.MapDebugPrint( "Foot_Bridge_Destroyed" );
	},

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

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

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

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

	Tank_Built = function( trigger )
	{
		Map.TankStatus = 1;

		if ( !Map.Tunnel_Doors )
		{ SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Allied_Command_Post" ); }

		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Destroyed = function( trigger )
	{
		Map.TankStatus = 0;

		//keep them focused on the tank
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Allied_Command_Post" );

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

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

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

	Fuel_Dump_Planted = function( trigger )
	{
		// don't have everyone shift if cov ops assisted an eng through the door
		if ( TestMap || Map.Depot_Gates )
			{ return; }

		Map.FuelDumpDyno += 1;

		// focus on the defuse
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_.*" );

		// and have teammates help
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAMP_fueldump.*" );
		Map.FuelDumpShifted = true;

		//toggle these for immediate shift
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Fuel_Dump.*" );
		Util.DisableGroup( "depotwall", TEAM.ALLIES );
		sleep(0.5);
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Fuel_Dump.*" );
		Util.EnableGroup( "depotwall", TEAM.ALLIES );

		Util.MapDebugPrint( "Fuel_Dump_Planted" );
	},

	Fuel_Dump_Defused = function( trigger )
	{
		Map.FuelDumpDyno -= 1;

		// no more dyno. allow building of west gate. and don't worry about any other build goals
		if ( Map.FuelDumpDyno < 1 ) {
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_West_Axis_Base_Fortification" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAMP_fueldump.*" );
			Map.FuelDumpShifted = false;
		}
	},

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

	tunnelgrate_Destroyed = function( trigger )
	{
		// Allied goals
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_Tunnel_MG",
			"REPAIRMG42_Tunnel_MG",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Tunnel_Grate.*" );

		Util.MapDebugPrint( "tunnelgrate_Destroyed" );
	},

	tunneldoors_Destroyed = function( trigger )
	{
		Map.Tunnel_Doors = false;

		// delete the cov ops trigger region
		DeleteTriggerRegion("AlliesFallBack");

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Bridge",
			"BUILD_Foot_Bridge",
			"SNIPE_bTowerMg.*",
			"GRENADE_tunnel_mg",
			"MOBILEMORTAR_bBridge.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"GRENADE_axis_base_mg",
			"ATTACK_Depot_Gates.*",
			"ATTACK_Tank_Bay.*",
			"BUILD_Side_MG",
			"MOUNTMG42_Side_MG_1",
			"REPAIRMG42_Side_MG_1",
			"BUILD_Axis_Command_Post",
			"PLANT_Tunnel_MG",
		});
		SetGoalPriority( "DEFUSE_Bridge.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );
		SetGoalPriority( "DEFUSE_Foot_Bridge.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );

		// Allied goals
		Util.DisableGroup( "tdoor", TEAM.ALLIES );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_rTeamDoor.*",
			"DEFEND_Tunnel_Grate.*",
			"MOBILEMORTAR_rBridge.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Depot_Gates.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"BUILD_Tunnel_MG",
			"BUILD_Allied_Command_Post",
			"PLANT_Foot_Bridge",
			"PLANT_Bridge",
			"MOUNTMG42_Tunnel_MG",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNTMG42_axisbase_mg42" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "REPAIRMG42_Tunnel_MG" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"REPAIRMG42_axisbase_mg42",
			"BUILD_Side_MG",
			"BUILD_East_Axis_Base_Fortification",
			"BUILD_West_Axis_Base_Fortification",
			"PLANT_Side_MG",
			"PLANT_Axis_Command_Post",
			"MOUNTMG42_Side_MG",
			"REPAIRMG42_Side_MG",
		});
		SetGoalPriority( "DEFUSE_Axis_Command_Post.*", 0.0, TEAM.ALLIES, CLASS.ENGINEER, true );
		SetGoalPriority( "DEFUSE_Axis_Tunnel_MG.*", 0.0, TEAM.ALLIES, CLASS.ENGINEER, true );

		if ( Map.tbdoorOne )
		{ Map.Switches.tbdoorOne.LimitTeam = (1<<TEAM.ALLIES); }
		else
		{ Map.Switches.tbdoorOne.LimitTeam = (1<<TEAM.AXIS); }

		if ( Map.tbdoorTwo )
		{ Map.Switches.tbdoorTwo.LimitTeam = (1<<TEAM.ALLIES); }
		else
		{ Map.Switches.tbdoorTwo.LimitTeam = (1<<TEAM.AXIS); }

		Util.MapDebugPrint( "tunneldoors_Destroyed" );
	},

	depotgates_Destroyed = function( trigger )
	{
		Map.Depot_Gates = false;

		// Axis goals
		sleep( 2 );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"ATTACK_Depot_Gates.*",
			"ATTACK_Tank_Bay.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ATTACK_Fuel_Dump_[123]",
			"ATTACK_Depot_Side_Wall.*",
		});

		if ( !Map.Front_Dump )
		{ SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Fuel_Dump" ); }

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Depot_Gates.*",
			"BUILD_Side_MG",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Fuel_Dump_.*" );
		Util.EnableGroup( "depotwall", TEAM.ALLIES );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_rGate.*" );
		SetGoalPriority( "DEFUSE_Side_MG.*", 0.0, TEAM.ALLIES, CLASS.ENGINEER, true );

		// did a cov ops sneak through and up on the roof early?
		if ( Map.DepotRoofCounter > 0 ) {
			Util.EnableGroup( "depotroof", TEAM.ALLIES );
		}

		// call arty from further back now
		Util.DisableGroup( "depotwallarty", TEAM.ALLIES );
		Util.EnableGroup( "depotarty", TEAM.ALLIES );

		// set up some bot chat warnings about incoming enemies based on region triggers
		iw1 = OnTriggerRegion( AABB(-11668,-5740,161, -11469,-5512,393), RegionTrigger.IntrusionWarning );
		iw2 = OnTriggerRegion( AABB(-9952,-5522,180, -9628,-5333,364), RegionTrigger.IntrusionWarning );
		iw3 = OnTriggerRegion( AABB(-10136,-6699,146, -9994,-6608,367), RegionTrigger.IntrusionWarning );
		iw4 = OnTriggerRegion( AABB(-11369,-7391,160, -11206,-6991,433), RegionTrigger.IntrusionWarning );
		io1 = OnTriggerRegion( AABB(-11184,-7426,178, -11106,-7005,410), RegionTrigger.IntrusionWarningEngObj );
		io2 = OnTriggerRegion( AABB(-11064,-7099,158, -10926,-6968,339), RegionTrigger.IntrusionWarningEngObj );
		io3 = OnTriggerRegion( AABB(-10580,-7450,158, -10445,-7011,397), RegionTrigger.IntrusionWarningEngObj );
		ac1 = OnTriggerRegion( AABB(-10861,-7124,165, -10641,-6995,351), RegionTrigger.AllClear );

		Util.MapDebugPrint( "depotgates_Destroyed" );
	},

	depotsidewall_Destroyed = function( trigger )
	{
		// Axis goals
		sleep( 2 );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"ATTACK_Depot_Side_Wall.*",
			"MOUNT_tank",
			"ESCORT_tank",
			"BUILD_Tank",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ATTACK_Fuel_Dump_[45]",
			"PLANT_West_Axis_Base_Fortification",
		});

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_rWall.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Side_MG" );

		Util.MapDebugPrint( "depotsidewall_Destroyed" );
	},

	tbdoorone = function( trigger )
	{
		if ( !Map.Tunnel_Doors )
		{
			vel = ToVector(trigger.Action);

			if ( vel[2] < 0 )
			{
				Map.Switches.tbdoorOne.LimitTeam = (1<<TEAM.AXIS);
				Util.LimitToTeam( TEAM.AXIS, "SWITCH_tbdoor1" );
				Util.MapDebugPrint("tbdoor1 closing", true);
			}
			else if ( vel[2] > 0 )
			{
				if ( Map.Depot_Gates )
				{
					Map.Switches.tbdoorOne.LimitTeam = (1<<TEAM.ALLIES);
					Util.LimitToTeam( TEAM.ALLIES, "SWITCH_tbdoor1" );
				}
				else
				{
					Map.Switches.tbdoorOne.LimitTeam = 0;
					Util.DisableGoal( "SWITCH_tbdoor1" );
				}

				Util.MapDebugPrint("tbdoor1 opening", true);
			}
		}

		Util.MapDebugPrint("tbdoor1");
	},

	tbdoortwo = function( trigger )
	{
		if ( !Map.Tunnel_Doors )
		{
			vel = ToVector(trigger.Action);

			if ( vel[2] < 0 )
			{
				Map.Switches.tbdoorTwo.LimitTeam = (1<<TEAM.AXIS);
				Util.LimitToTeam( TEAM.AXIS, "SWITCH_tbdoor2" );
				Util.MapDebugPrint("tbdoor2 closing", true);
			}
			else if ( vel[2] > 0 )
			{
				if ( Map.Depot_Gates )
				{
					Map.Switches.tbdoorTwo.LimitTeam = (1<<TEAM.ALLIES);
					Util.LimitToTeam( TEAM.ALLIES, "SWITCH_tbdoor2" );
				}
				else
				{
					Map.Switches.tbdoorTwo.LimitTeam = 0;
					Util.DisableGoal( "SWITCH_tbdoor2" );
				}

				Util.MapDebugPrint("tbdoor2 opening", true);
			}
		}

		Util.MapDebugPrint("tbdoor2");
	},

	tank_near_bridge = function()
	{
		Map.Tank_Near_Bridge = true;

		Util.MapDebugPrint( "tank_near_bridge" );
	},

	tank_over_bridge = function()
	{
		Map.Tank_Over_Bridge = true;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"SMOKEBOMB_allies_bridge.*",
			"AMMOCAB_alliedhut_ammocabinet",
			"ATTACK_Bridge_.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Tunnel_Doors.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"HEALTHCAB_alliedhut_healthcabinet",
			"CALLARTILLERY_bTowerHill.*",
			"ARTILLERY_S_bTowerHill2.*",
		});
		Util.DisableGroup( "roadmg", TEAM.AXIS );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Bridge_.*" );
		Util.EnableGroup( "tdoor", TEAM.ALLIES );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"PLANTMINE_rFootbridge.*",
			"MOBILEMORTAR_rBridge.*",
		});

		Util.MapDebugPrint( "tank_over_bridge" );
	},

	tank_in_tunnel = function()
	{
		// keep these active until it's in tunnel so humans cant just hang back and keep
		// tank from moving
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"ATTACK_Tunnel_Doors.*",
			"PLANT_Tunnel_MG",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Side_MG" );
		Util.EnableGroup( "tunnelexitarty", TEAM.ALLIES );

		Util.MapDebugPrint( "tank_in_tunnel" );
	},

	tank_past_tunnel = function()
	{
		Util.DisableGroup( "tunnelexitarty", TEAM.ALLIES );
		Util.EnableGroup( "depotwallarty", TEAM.ALLIES );
		Util.DisableGroup( "forwarddepot", TEAM.ALLIES ); // disable camps inside tunnel
		Util.MapDebugPrint( "tank_past_tunnel" );
	},

	tank_at_location = function( trigger )
	{
		switch(Map.VehicleLocation)
		{
		case 1:
			{
				Map.tank_near_bridge();
			}
		case 2:
			{
				Map.tank_over_bridge();
			}
		case 3:
			{
				Map.tank_in_tunnel();
			}
		case 4:
			{
				Map.tank_past_tunnel();
			}
		}
		Util.MapDebugPrint("vehicle at location " + Map.VehicleLocation, true);
	},
	water = function()
	{
		Wp.SetWaypointFlag("water","closed",true);
		Util.MapDebugPrint( "Axis team has destroyed the Water Tower!" );
	},
};

global OnMapLoad = function()
{
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10848,-7432,264) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10840,-7376,440) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10710,-7324,264) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10953,-7319,264) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10762,-7422,264) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10896,-7421,264) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10937,-7602,248) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10743,-7602,248) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-11010,-7507,248) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10970,-7300,264) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10734,-7602,248) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10884,-7372,440) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10760,-7478,419) );
	Util.AddUsePoint( "PLANT_Fuel_Dump", Vec3(-10931,-7510,431) );

	Util.SetGoalPosition( -3712.607,-4382.545,248.125, "PLANT_Bridge" );
	Util.SetGoalPosition( -1218.925,-3095.991,408.092, "PLANT_Foot_Bridge" );

	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( "Axis team has reinforced the Bridge!", Map.Bridge_Built );
	OnTrigger( "Allied team has constructed the East Allied Base Fortification!", Map.East_Axis_Base_Fortification_Built );
	OnTrigger( "Axis team has constructed the Foot Bridge!", Map.Foot_Bridge_Built );
	OnTrigger( "Axis team has constructed the Road MG Nest!", Map.Road_MG_Built );
	OnTrigger( "Axis team has constructed the Side MG Nest!", Map.Side_MG_Built );
	OnTrigger( "The Tank has been repaired", Map.Tank_Built );
	OnTrigger( "Axis team has constructed the Tunnel MG!", Map.Tunnel_MG_Built );
	OnTrigger( "Allied team has constructed the West Allied Base Fortification!", Map.West_Axis_Base_Fortification_Built );
	OnTrigger( "Allied team has damaged the Bridge!",  Map.Bridge_Damaged );
	OnTrigger( "Axis team has destroyed the Bridge!", Map.Bridge_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( "Allied team has damaged the Bridge!", Map.Bridge_Destroyed );
	OnTrigger( "Axis team has destroyed the East Allied Base Fortification!", Map.East_Axis_Base_Fortification_Destroyed );
	OnTrigger( "Axis team has damaged the East Allied Base Fortification!", Map.East_Axis_Base_Fortification_Damaged );
	OnTrigger( "Axis team has destroyed the West Allied Base Fortification!", Map.West_Axis_Base_Fortification_Destroyed );
	OnTrigger( "Axis team has damaged the West Allied Base Fortification!", Map.West_Axis_Base_Fortification_Damaged );
	OnTrigger( "Allied team has destroyed the Foot Bridge!", Map.Foot_Bridge_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Fuel Dump!", Map.Fuel_Dump_Destroyed );
	OnTrigger( "Allied team has destroyed the Road MG Nest!", Map.Road_MG_Destroyed );
	OnTrigger( "Axis team has destroyed the Side MG Nest!", Map.Side_MG_Destroyed );
	OnTrigger( "Axis team has destroyed the Tunnel MG!", Map.Tunnel_MG_Destroyed );
	OnTrigger( "Planted at the Fuel Dump.", Map.Fuel_Dump_Planted );
	OnTrigger( "Defused at the Fuel Dump.", Map.Fuel_Dump_Defused );
	OnTrigger( "The Tank has been damaged", Map.Tank_Destroyed );
	OnTrigger( "Axis team has breached the Tunnel Grate!", Map.tunnelgrate_Destroyed );
	OnTrigger( "Axis team has breached the Tunnel Doors!", Map.tunneldoors_Destroyed );
	OnTrigger( "Axis team has breached the Depot Gates!", Map.depotgates_Destroyed );
	OnTrigger( "Axis team has breached the Depot Side Wall!", Map.depotsidewall_Destroyed );
	OnTrigger( "tbdoor1_lever1_goto", Map.tbdoorone );
	OnTrigger( "tbdoor2_lever1_goto", Map.tbdoortwo );
	OnTrigger( "tank at location", Map.tank_at_location );
	OnTrigger( "Axis team has destroyed the Water Tower!", Map.water );
	// tank positions
	nearbridge = OnTriggerRegion(AABB(-3337.337,-6550.084,207.125,-3016.404,-6386.294,284.880), RegionTrigger.VehicleTrigger);
	overbridge = OnTriggerRegion(AABB(-3810.875,-4750.004,211.125,-3611.125,-4491.826,291.954), RegionTrigger.VehicleTrigger);
	intunnel = OnTriggerRegion(AABB(-5693.422,-2970.203,209.125,-5602.288,-2678.854,291.125), RegionTrigger.VehicleTrigger);
	exittunnel = OnTriggerRegion(AABB(-7926.541,-2944.875,209.125,-7809.442,-2687.126,283.125), RegionTrigger.VehicleTrigger);

	// disable push and combat movement around the first tower mg, fuel tank ladder and depot wall for better pathing
	cm = OnTriggerRegion(AABB(-3733.483,-2051.376,652.817,-3449.874,-1751.765,1083.265), RegionTrigger.DisableBotPush);
	wall = OnTriggerRegion(AABB(-10136.874,-5462.146,441.125,-8755.125,-5162.832,523.125), RegionTrigger.DisableBotPush);
	fueltankladder = OnTriggerRegion(AABB(-10908.676,-7287.709,182.167,-10720.402,-7071.353,566.530), RegionTrigger.DisableBotPush);

	// detect covert ops sneaking through tunnel grate
	fallback = OnTriggerRegion(AABB(-6720.574,-1895.911,321.125,-6626.926,-1558.944,403.125), Map.AlliesFallBack);

	// detect ALLIES on the depot roof
	depotroof = OnTriggerRegion(AABB(-11424.124,-6971.128,537.125,-10310.962,-6210.208,944.180), Map.DepotRoof);

	// Max users per goal
	Util.SetMaxUsersInProgress( 2, "ATTACK_.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "CAMP_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42.*" );
	Util.SetMaxUsersInProgress( 2, "MOUNT_tank" );
	Util.SetMaxUsersInUse( 1, "ESCORT_tank" );
	Util.SetMaxUsersInProgress( 2, "ESCORT_tank" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "BUILD_Road_MG" );

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=10, MaxCampTime=30} );
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=10, MaxCampTime=15} );
	SetMapGoalProperties( "CAMP_.*", {MinCampTime=15, MaxCampTime=30} );
	SetMapGoalProperties( "BUILD_.*", {ignoretarget=true} );
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=45, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=120, MaxCampTime=180} );
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=120, MaxCampTime=180} );

	// set some preferred positions to start from for vehicle goals
	ETUtil.SetStartIndex("MOUNT_tank", 0);
	ETUtil.SetStartIndex("ESCORT_tank", 0);
	ETUtil.SetStartIndex("BUILD_Tank", 0);

	SetGoalPriority( "GRENADE_.*", 0.7 );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.MEDIC );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.ENGINEER );
	SetGoalPriority( "SMOKEBOMB_allies_bridge.*", 0.8, 0, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Side_MG", 0.0, 0, CLASS.ENGINEER );

	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.MEDIC, true  );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.ENGINEER, true );

	// Axis goals
	SetGoalPriority( "PLANT_Allied_Command_Post", 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Tunnel_MG", 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Fuel_Dump", 0.85, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Road_MG", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFUSE_Road_MG.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );

	// Allied goals
	SetGoalPriority( "PLANT_Axis_Command_Post", 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Foot_Bridge", 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Road_MG", 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "HEALTHCAB_.*", 0.0, TEAM.ALLIES );
	SetGoalPriority( "CAMP_fueldump.*", 0.75, TEAM.ALLIES );
	SetGoalPriority( "CAMP_roofclear.*", 0.76, TEAM.ALLIES );
	SetGoalPriority( "AIRSTRIKE_roofclear.*", 0.85, TEAM.ALLIES, CLASS.FIELDOPS );
	SetGoalPriority( "DEFEND_rTeamDoor.*", 0.75, TEAM.ALLIES );
	Util.LimitToClass( "DEFEND_rTeamDoor.*", TEAM.ALLIES, CLASS.ENGINEER );

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

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"SMOKEBOMB_allies_bridge.*",
		"GRENADE_tunnel_mg",
		"BUILD_Bridge",
		"BUILD_Foot_Bridge",
		"MOUNT_tank",
		"ESCORT_tank",
		"PLANT_Allied_Command_Post",
	});
	//SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Side_MG" );
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"PLANT_Tunnel_MG",
		"ATTACK_Bridge_.*",
		"CALLARTILLERY_bTowerHill.*",
		"ARTILLERY_S_bTowerHill2.*",
		"SNIPE_bTowerMg.*",
		"MOBILEMORTAR_bBridge.*",
	});
	Util.EnableGroup( "roadmg", TEAM.AXIS ); // build, mountmg, repair for Road_MG

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ARTILLERY_S_bridge_cons",
		"REPAIRMG42_Tunnel_MG",
		"BUILD_Tunnel_MG",
		"BUILD_Allied_Command_Post",
		"PLANT_Foot_Bridge",
		"CALLARTILLERY_arty_bridge_cons.*",
		"PLANT_Bridge",
		"MOUNTMG42_Tunnel_MG",
		"DEFEND_Bridge_.*",
		"MOBILEMORTAR_rBridge.*",
		"PLANTMINE_rFootbridge.*",
	});

	Util.SetMaxUsersInProgress( 1, "BUILD_Allied_Command_Post");
	Util.SetMaxUsersInProgress( 1, "PLANT_Fuel_Dump");
	SetGoalPriority("BUILD_Allied_Command_Post", 0.85);

	//set up some routing
	MapRoutes =
	{
		ATTACK_Bridge_1 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AxisSpawn2 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AxisSpawn3 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
		},
		BUILD_Bridge =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AxisSpawn2 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AxisSpawn3 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
		},
		ATTACK_Tunnel_Doors_1 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_footbridgeRoute2 = {Weight = 2,},
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AxisSpawn2 =
			{
				ROUTE_footbridgeRoute2 = {Weight = 2,},
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AxisSpawn3 =
			{
				ROUTE_footbridgeRoute2 = {Weight = 2,},
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
		},
		BUILD_Axis_Command_Post =
		{
			ROUTE_TunnelSpawn1 =
			{
				ROUTE_northtunnel =
				{
					ROUTE_cphill = {},
					ROUTE_cpflank = {},
				},
			},
			ROUTE_TunnelSpawn2 =
			{
				ROUTE_northtunnel =
				{
					ROUTE_cphill = {},
					ROUTE_cpflank = {},
				},
			},
		},
		ATTACK_Depot_Gates_1 =
		{
			ROUTE_TunnelSpawn1 =
			{
				ROUTE_maintunnel =
				{
					ROUTE_eTankPath1 = { ROUTE_eTankPath2 = {}, },
					ROUTE_wTankPath1 = { ROUTE_wTankPath2 = {}, },
				},
				ROUTE_northtunnel =
				{
					ROUTE_cphill = {},
					ROUTE_cpflank = {},
				},
				ROUTE_southtunnel =
				{
					Weight = 2,
					ROUTE_southtunnel2 = {},
				},
			},
			ROUTE_TunnelSpawn2 =
			{
				ROUTE_maintunnel =
				{
					ROUTE_eTankPath1 = { ROUTE_eTankPath2 = {}, },
					ROUTE_wTankPath1 = { ROUTE_wTankPath2 = {}, },
				},
				ROUTE_northtunnel =
				{
					ROUTE_cphill = {},
					ROUTE_cpflank = {},
				},
				ROUTE_southtunnel =
				{
					Weight = 2,
					ROUTE_southtunnel2 = {},
				},
			},
		},
		ATTACK_Fuel_Dump_1 =
		{
			ROUTE_TunnelSpawn1 =
			{
				ROUTE_maintunnel =
				{
					ROUTE_eTankPath1 = { ROUTE_eTankPath2 = {}, },
					ROUTE_wTankPath1 = { ROUTE_wTankPath2 = {}, },
					ROUTE_cphill =
					{
						ROUTE_depotgate = {},
						ROUTE_sidewall = { ROUTE_sidewall2 = {}, },
					},
				},
				ROUTE_northtunnel =
				{
					ROUTE_cphill = {},
					ROUTE_cpflank =
					{
						ROUTE_sidewall = { ROUTE_sidewall2 = {}, },
					},
				},
				ROUTE_southtunnel =
				{
					Weight = 2,
					ROUTE_southtunnel2 = {},
				},
			},
			ROUTE_TunnelSpawn2 =
			{
				ROUTE_maintunnel =
				{
					ROUTE_eTankPath1 = { ROUTE_eTankPath2 = {}, },
					ROUTE_wTankPath1 = { ROUTE_wTankPath2 = {}, },
					ROUTE_cphill =
					{
						ROUTE_depotgate = {},
						ROUTE_sidewall = { ROUTE_sidewall2 = {}, },
					},
				},
				ROUTE_northtunnel =
				{
					ROUTE_cphill = {},
					ROUTE_cpflank =
					{
						ROUTE_sidewall = { ROUTE_sidewall2 = {}, },
					},
				},
				ROUTE_southtunnel =
				{
					Weight = 2,
					ROUTE_southtunnel2 = {},
				},
			},
			//add route support for et pro scripted cp spawns
			ROUTE_CpSpawn =
			{
				ROUTE_depotgate = {},
				ROUTE_sidewall2 = {},
			},
		},
		DEFEND_Depot_Gates_6 =
		{
			ROUTE_FuelDumpSpawn1 =
			{
				ROUTE_cphill2 = { Weight = 2, },
				ROUTE_sidewall2 = { ROUTE_sidewall = {}, }
			},
			ROUTE_FuelDumpSpawn2 =
			{
				ROUTE_cphill2 = { Weight = 2, },
				ROUTE_sidewall2 = { ROUTE_sidewall = {}, }
			},
		},
		DEFEND_Fuel_Dump_6 =
		{
			ROUTE_FuelDumpSpawn1 =
			{
				ROUTE_FD_stairs = {},
				ROUTE_FD_back =
				{
					ROUTE_FD_weststairs = {},
					ROUTE_FD_opengate = {},
				},
				ROUTE_FD_patrol = { Weight = 2, },
			},
			ROUTE_FuelDumpSpawn2 =
			{
				ROUTE_FD_stairs = {},
				ROUTE_FD_back =
				{
					ROUTE_FD_weststairs = {},
					ROUTE_FD_opengate = {},
				},
				ROUTE_FD_patrol = { Weight = 2, },
			},
		},
		PLANTMINE_rGate1 =
		{
			ROUTE_FuelDumpSpawn1 =
			{
				ROUTE_FD_back = {},
				ROUTE_FD_patrol = { Weight = 2, },
			},
			ROUTE_FuelDumpSpawn2 =
			{
				ROUTE_FD_back = {},
				ROUTE_FD_patrol = { Weight = 2, },
			},
		},
		GRENADE_axis_base_mg =
		{
			ROUTE_TunnelSpawn1 =
			{
				ROUTE_southtunnel =
				{
					Weight = 2,
					ROUTE_southtunnel2 = {},
				},
			},
			ROUTE_TunnelSpawn2 =
			{
				ROUTE_southtunnel =
				{
					Weight = 2,
					ROUTE_southtunnel2 = {},
				},
			},
		},
	};

	//copy some routes
	MapRoutes.ATTACK_Bridge_2 = MapRoutes.ATTACK_Bridge_1;
	MapRoutes.ATTACK_Bridge_3 = MapRoutes.ATTACK_Bridge_1;
	MapRoutes.ATTACK_Bridge_5 = MapRoutes.ATTACK_Bridge_1;
	MapRoutes.ATTACK_Tunnel_Doors_2 = MapRoutes.ATTACK_Tunnel_Doors_1;
	MapRoutes.ATTACK_Tunnel_Doors_3 = MapRoutes.ATTACK_Tunnel_Doors_1;
	MapRoutes.ATTACK_Tunnel_Doors_4 = MapRoutes.ATTACK_Tunnel_Doors_1;
	MapRoutes.ATTACK_Tunnel_Doors_5 = MapRoutes.ATTACK_Tunnel_Doors_1;
	MapRoutes.ATTACK_Depot_Gates_2 = MapRoutes.ATTACK_Depot_Gates_1;
	MapRoutes.ATTACK_Depot_Gates_3 = MapRoutes.ATTACK_Depot_Gates_1;
	MapRoutes.ATTACK_Tank_Bay_1 = MapRoutes.ATTACK_Depot_Gates_1;
	MapRoutes.ATTACK_Tank_Bay_2 = MapRoutes.ATTACK_Depot_Gates_1;
	MapRoutes.PLANT_Tunnel_MG = MapRoutes.BUILD_Axis_Command_Post;
	MapRoutes.MOUNTMG42_alliedtunnel_mg42 = MapRoutes.BUILD_Axis_Command_Post;
	MapRoutes.REPAIRMG42_alliedtunnel_mg42 = MapRoutes.BUILD_Axis_Command_Post;
	MapRoutes.ATTACK_Fuel_Dump_2 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.ATTACK_Fuel_Dump_3 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.ATTACK_Fuel_Dump_4 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.ATTACK_Fuel_Dump_5 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.ATTACK_Fuel_Dump_6 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.ATTACK_Fuel_Dump_7 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.ATTACK_Fuel_Dump_8 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.ATTACK_Fuel_Dump_9 = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.PLANT_Fuel_Dump = MapRoutes.ATTACK_Fuel_Dump_1;
	MapRoutes.DEFEND_Depot_Gates_7 = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.DEFEND_Depot_Gates_8 = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.DEFEND_Depot_Gates_9 = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.DEFEND_Depot_Gates_10 = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.DEFEND_Depot_Gates_11 = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.DEFEND_Depot_Gates_12 = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.DEFEND_Depot_Gates_13 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Depot_Gates_14 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Depot_Gates_15 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.REPAIRMG42_Side_MG = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.MOUNTMG42_Side_MG = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.PLANT_Axis_Command_Post = MapRoutes.DEFEND_Depot_Gates_6;
	MapRoutes.DEFEND_Fuel_Dump_7 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Fuel_Dump_8 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Fuel_Dump_9 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Fuel_Dump_10 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Fuel_Dump_11 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Fuel_Dump_12 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Fuel_Dump_13 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.DEFEND_Fuel_Dump_14 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.CALLARTILLERY_rDepotWall1 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.CALLARTILLERY_rDepotWall2 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.CALLARTILLERY_rTunnelExit1 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.CALLARTILLERY_rTunnelExit2 = MapRoutes.DEFEND_Fuel_Dump_6;
	MapRoutes.PLANTMINE_rGate2 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rGate3 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rGate4 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rGate5 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rGate6 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rWall1 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rWall2 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rWall3 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.PLANTMINE_rWall4 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.CAMP_fueldump1 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.CAMP_fueldump2 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.CAMP_fueldump3 = MapRoutes.PLANTMINE_rGate1;
	MapRoutes.CAMP_fueldump4 = MapRoutes.PLANTMINE_rGate1;

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

global OnBotJoin = function( bot )
{
	bot.MaxViewDistance = 4000;
};
