//==========================================================================================
//
//	fueldump_revenge.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	^4Tardis	05 February 2012	Initial Script
//	^4Tardis	05 February 2012 	Convered From fueldump
//==========================================================================================
//
global Map =
{
	Ammo_Cabinet_lms_ammocabinet = "AMMOCAB_lms_ammocabinet",
	Ammo_Cabinet_tankbay_ammocabinet = "AMMOCAB_tankbay_ammocabinet",
	Ammo_Cabinet_alliedhut_ammocabinet = "AMMOCAB_alliedhut_ammocabinet",
	Health_Cabinet_alliedhut_healthcabinet = "HEALTHCAB_alliedhut_healthcabinet",
	Health_Cabinet_lms_healthcabinet = "HEALTHCAB_lms_healthcabinet",
	Health_Cabinet_tankbay_healthcabinet = "HEALTHCAB_tankbay_healthcabinet",
	Build_Allied_Command_Post = "BUILD_Allied_Command_Post",
	Build_Axis_Command_Post = "BUILD_Axis_Command_Post",
	Build_Bridge = "BUILD_Bridge",
	Build_East_Axis_Base_Fortification = "BUILD_East_Allies_Base_Fortification",
	Build_Foot_Bridge = "BUILD_Foot_Bridge",
	Build_Tower_MG = "BUILD_Tower_MG",
	Build_Side_MG = "BUILD_Side_MG",
	Build_Tank = "BUILD_Tank",
	Build_Tunnel_MG = "BUILD_Tunnel_MG",
	Build_West_Axis_Base_Fortification = "BUILD_West_Allies_Base_Fortification",
	Plant_Allied_Command_Post = "PLANT_Allied_Command_Post",
	Plant_Axis_Command_Post = "PLANT_Axis_Command_Post",
	Plant_Bridge = "PLANT_Bridge",
	Plant_East_Axis_Base_Fortification = "PLANT_East_Allies_Base_Fortification",
	Plant_Foot_Bridge = "PLANT_Foot_Bridge",
	Plant_Fuel_Dump = "PLANT_Fuel_Dump",
	Plant_Tower_MG = "PLANT_Tower_MG",
	Plant_Side_MG = "PLANT_Side_MG",
	Plant_Tunnel_MG = "PLANT_Tunnel_MG",
	Plant_West_Axis_Base_Fortification = "PLANT_West_Allies_Base_Fortification",
	Mount_Tower_MG = "MOUNTMG42_Tower_MG",
	Mount_Side_MG = "MOUNTMG42_Side_MG",
	Mount_Tunnel_MG = "MOUNTMG42_Tunnel_MG",
	Mount_alliedtunnel_mg42 = "MOUNTMG42_alliedtunnel_mg42",
	Mount_axisbase_mg42 = "MOUNTMG42_axisbase_mg42",
	Repair_Tower_MG = "REPAIRMG42_Tower_MG",
	Repair_Side_MG = "REPAIRMG42_Side_MG",
	Repair_Tunnel_MG = "REPAIRMG42_Tunnel_MG",
	Repair_alliedtunnel_mg42 = "REPAIRMG42_alliedtunnel_mg42",
	Repair_axisbase_mg42 = "REPAIRMG42_axisbase_mg42",
	Mover_tank = "MOVER_tank",

	DispenseHealthTime = 10.0,
	DispenseAmmoTime = 1.0,
	DefendingTeam = TEAM.AXIS,

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

	tbdoorOne = true, //open
	tbdoorTwo = true,

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

	// allied 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.ALLIES ) {
				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, Map.Build_West_Axis_Base_Fortification );
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_rGate.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_rTeamDoor.*" );
		},
		OnExit = function(ent)
		{
		},
	},

	DepotRoofCount = 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 )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	Axis_Command_Post_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

	Bridge_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.BridgeStatus = 1;

		// Allied 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, Map.Build_Tank );

		SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_mainbridgeRoute3" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SMOKEBOMB_allies_bridge.*" );

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

		Util.MapDebugPrint( "Bridge_Built" );
	},

	Bridge_Damaged = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.BridgeStatus = 0;

		// Allied 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, Map.Build_Tank );

			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Tunnel_Doors.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Bridge_.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "CALLARTILLERY_arty_bridge_cons1" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "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 )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Bridge_Destroyed" );
	},

	East_Axis_Base_Fortification_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Front_Dump = true;

		// Allied goals
		// cs: allied bots shouldn't worry about this as it hurts axis chances of defusing
		// SetAvailableMapGoals( TEAM.AXIS, true, Map.Plant_East_Axis_Base_Fortification );

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

		// Axis goals
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_East_Axis_Base_Fortification );

		Util.MapDebugPrint( "East_Axis_Base_Fortification_Built" );
	},

	East_Axis_Base_Fortification_Damaged = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Front_Dump = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Plant_East_Axis_Base_Fortification );

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

		// Axis goals
		// cs: axis bots shouldn't build this. makes it harder to defuse
		//SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_East_Axis_Base_Fortification );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_FD_patrol" );

		Util.MapDebugPrint( "East_Axis_Base_Fortification_Damaged" );
	},

	East_Axis_Base_Fortification_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "East_Axis_Base_Fortification_Destroyed" );
	},

	West_Axis_Base_Fortification_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Rear_Dump = true;

		// Allied goals
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Plant_West_Axis_Base_Fortification );

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

		// Axis goals
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_West_Axis_Base_Fortification );

		Util.MapDebugPrint( "West_Axis_Base_Fortification_Built" );
	},

	West_Axis_Base_Fortification_Damaged = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Rear_Dump = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Plant_West_Axis_Base_Fortification );

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

		// Axis goals
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_West_Axis_Base_Fortification );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_FD_patrol" );

		Util.MapDebugPrint( "West_Axis_Base_Fortification_Damaged" );
	},

	West_Axis_Base_Fortification_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "West_Axis_Base_Fortification_Destroyed" );
	},

	Foot_Bridge_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		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 )
	{
		if ( TestMap )
			{ return; }

		Map.FootBridgeStatus = 0;

		//route some allies 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, Map.Build_Tank );

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

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

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

		Util.MapDebugPrint( "Foot_Bridge_Destroyed" );
	},

	Tower_MG_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Tower_MG_Built" );
	},

	Tower_MG_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Tower_MG_Destroyed" );
	},

	Side_MG_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Side_MG_Built" );
	},

	Side_MG_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Side_MG_Destroyed" );
	},

	Tank_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.TankStatus = 1;

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

		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.TankStatus = 0;

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

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

	Tunnel_MG_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Tunnel_MG_Built" );
	},

	Tunnel_MG_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		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, Map.Build_West_Axis_Base_Fortification );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAMP_fueldump.*" );
			Map.FuelDumpShifted = false;
		}
	},

	Fuel_Dump_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Fuel_Dump_Destroyed" );
	},

	tunnelgrate_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		// Allied goals
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Mount_Tunnel_MG );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Repair_Tunnel_MG );

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

		Util.MapDebugPrint( "tunnelgrate_Destroyed" );
	},

	tunneldoors_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Tunnel_Doors = false;

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

		// Axis goals
		sleep( 2 );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_Bridge );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Foot_Bridge" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SNIPE_bTowerMg.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "GRENADE_tunnel_mg" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_bBridge.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_axis_base_mg" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Depot_Gates.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Tank_Bay.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Side_MG );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Mount_Side_MG_1 );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Repair_Side_MG_1 );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Axis_Command_Post );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Plant_Tunnel_MG );
		SetGoalPriority( "DEFUSE_Bridge.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );
		SetGoalPriority( "DEFUSE_Foot_Bridge.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );

		// Allies goals
		Util.DisableGroup( "tdoor", TEAM.ALLIES );
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_rTeamDoor.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Tunnel_Grate.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOBILEMORTAR_rBridge.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Depot_Gates.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tunnel_MG );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Allies_Command_Post );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Foot_Bridge );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Bridge );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Mount_Tunnel_MG );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Mount_axisbase_mg42 );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Repair_Tunnel_MG );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Repair_axisbase_mg42 );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Side_MG );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_East_Axis_Base_Fortification );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_West_Axis_Base_Fortification );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Plant_Side_MG );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Plant_Allied_Command_Post );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Mount_Side_MG );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Repair_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 )
	{
		if ( TestMap )
			{ return; }

		Map.Depot_Gates = false;

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


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

		Util.SetGoalRange( "BUILD_Axis_Command_Post", 1600);

		// Axis goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Depot_Gates.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.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 )
	{
		if ( TestMap )
			{ return; }

		// Allied goals
		sleep( 2 );
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Depot_Side_Wall.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_tank" );
		SetAvailableMapGoals( TEAM.AXIS, false, "ESCORT_tank" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Fuel_Dump_[45]" );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Plant_West_Axis_Base_Fortification );

		// Axis goals
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_rWall.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Side_MG );

		Util.MapDebugPrint( "depotsidewall_Destroyed" );
	},

	tbdoorone = function( trigger )
	{
		if ( TestMap )
			{ return; }

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

			if ( vel[2] < 0 )
			{
				Map.Switches.tbdoorOne.LimitTeam = (1<<TEAM.AXIS);
				Util.LimitGoal( 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.LimitGoal( TEAM.ALLIES, "SWITCH_tbdoor1" );
				}
				else
				{
					Map.Switches.tbdoorOne.LimitTeam = 0;
					SetAvailableMapGoals( 0, false, "SWITCH_tbdoor1" );
				}

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

		Util.MapDebugPrint("tbdoor1");
	},

	tbdoortwo = function( trigger )
	{
		if ( TestMap )
			{ return; }

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

			if ( vel[2] < 0 )
			{
				Map.Switches.tbdoorTwo.LimitTeam = (1<<TEAM.AXIS);
				Util.LimitGoal( 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.LimitGoal( TEAM.ALLIES, "SWITCH_tbdoor2" );
				}
				else
				{
					Map.Switches.tbdoorTwo.LimitTeam = 0;
					SetAvailableMapGoals( 0, false, "SWITCH_tbdoor2" );
				}

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

		Util.MapDebugPrint("tbdoor2");
	},

	tank_near_bridge = function()
	{
		if ( TestMap )
			{ return; }

		Map.Tank_Near_Bridge = true;

		Util.MapDebugPrint( "tank_near_bridge" );
	},

	tank_over_bridge = function()
	{
		if ( TestMap )
			{ return; }

		Map.Tank_Over_Bridge = true;

		// Allied goals
		SetAvailableMapGoals( TEAM.AXIS, false, "SMOKEBOMB_allies_bridge.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Ammo_Cabinet_alliedhut_ammocabinet );
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Bridge_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Tunnel_Doors.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Health_Cabinet_alliedhut_healthcabinet );
		SetAvailableMapGoals( TEAM.AXIS, false, "CALLARTILLERY_bTowerHill.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "ARTILLERY_S_bTowerHill2.*" );
		Util.DisableGroup( "towermg", TEAM.AXIS );

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

		Util.MapDebugPrint( "tank_over_bridge" );
	},

	tank_in_tunnel = function()
	{
		if ( TestMap )
			{ return; }

		// 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.*" );

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Tunnel_MG" );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Side_MG );
		Util.EnableGroup( "tunnelexitarty", TEAM.ALLIES );

		Util.MapDebugPrint( "tank_in_tunnel" );
	},

	tank_past_tunnel = function()
	{
		if ( TestMap )
			{ return; }

		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);
	},
};

global OnMapLoad = function()
{
	Util.SetGoalPosition( -10850.705,-7440.844,264.125, Map.Plant_Fuel_Dump );
	Util.SetGoalPosition( -3712.607,-4382.545,248.125, Map.Plant_Bridge );
	Util.SetGoalPosition( -1218.925,-3095.991,408.092, Map.Plant_Foot_Bridge );

	if ( TestMapOn )
		{ Util.AutoTestMap(); }

	OnTrigger( "^3Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "^3Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "^3Axis team has reinforced the Bridge!", Map.Bridge_Built );
	OnTrigger( "^3Allied team has constructed the East Allied Base Fortification!", Map.East_Axis_Base_Fortification_Built );
	OnTrigger( "^3Axis team has constructed the Foot Bridge!", Map.Foot_Bridge_Built );
	OnTrigger( "^3Axis team has constructed the Tower MG!", Map.Tower_MG_Built );
	OnTrigger( "^3Axis team has constructed the Side MG Nest!", Map.Side_MG_Built );
	OnTrigger( "^3The Tank has been repaired", Map.Tank_Built );
	OnTrigger( "^3Allied team has constructed the Tunnel MG!", Map.Tunnel_MG_Built );
	OnTrigger( "^3Allied team has constructed the West Allied Base Fortification!", Map.West_Axis_Base_Fortification_Built );
	OnTrigger( "^3Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "^3Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "^3Allied team has damaged the Bridge!",  Map.Bridge_Damaged );
	OnTrigger( "^3Allied team has destroyed the Bridge!", Map.Bridge_Destroyed );
	OnTrigger( "^3Axis team has damaged the East Allied Base Fortification!", Map.East_Axis_Base_Fortification_Damaged );
	OnTrigger( "^3Axis team has destroyed the East Allied Base Fortification!", Map.East_Axis_Base_Fortification_Destroyed );
	OnTrigger( "^3Allied team has destroyed the Foot Bridge!", Map.Foot_Bridge_Destroyed );
	OnTrigger( "Planted at the Fuel Dump.", Map.Fuel_Dump_Planted );
	OnTrigger( "Defused at the Fuel Dump.", Map.Fuel_Dump_Defused );
	OnTrigger( "^3Axis team has destroyed the Allied Fuel Dump!", Map.Fuel_Dump_Destroyed );
	OnTrigger( "^3Allied team has destroyed the Tower MG!", Map.Tower_MG_Destroyed );
	OnTrigger( "^3Allied team has destroyed the Side MG Nest!", Map.Side_MG_Destroyed );
	OnTrigger( "^3Axis team has destroyed the Tunnel MG!", Map.Tunnel_MG_Destroyed );
	OnTrigger( "^3Axis team has damaged the West Allied Base Fortification!", Map.West_Axis_Base_Fortification_Damaged );
	OnTrigger( "^3Axis team has destroyed the West Allied Base Fortification!", Map.West_Axis_Base_Fortification_Destroyed );
	OnTrigger( "^3The Tank has been damaged", Map.Tank_Destroyed );
	OnTrigger( "^3Axis team has breached the Tunnel Grate!", Map.tunnelgrate_Destroyed );
	OnTrigger( "^3Axis team has breached the Tunnel Doors!", Map.tunneldoors_Destroyed );
	OnTrigger( "^3Axis team has breached the Depot Gates!", Map.depotgates_Destroyed );
	OnTrigger( "^3Axis 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 );

	// 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, "CALLARTILLERY.*" );
	Util.SetMaxUsers( 1, "AIRSTRIKE.*" );
	Util.SetMaxUsers( 1, "SMOKEBOMB_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "BUILD_Tower_MG" );
	Util.SetMaxUsers( 1, "REPAIRMG.*" );

	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( Map.Plant_Side_MG, 0.0, 0, CLASS.ENGINEER );

	// Axis goals
	SetGoalPriority( Map.Plant_Allied_Command_Post, 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Tunnel_MG, 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Fuel_Dump, 0.85, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Tower_MG", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFUSE_Tower_MG.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );

	// Allies goals
	SetGoalPriority( Map.Plant_Axis_Command_Post, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Foot_Bridge, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Tower_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 );
	ETUtil.LimitToClass( "DEFEND_rTeamDoor.*", TEAM.ALLIES, CLASS.ENGINEER );

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

	SetAvailableMapGoals( TEAM.AXIS, true, "SMOKEBOMB_allies_bridge.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_tunnel_mg" );
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Bridge" );
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Foot_Bridge" );
	SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_tank" );
	SetAvailableMapGoals( TEAM.AXIS, true, "ESCORT_tank" );
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Axis_Command_Post" );
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Tunnel_MG" );
	SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Bridge_.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "CALLARTILLERY_bTowerHill.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "ARTILLERY_S_bTowerHill2.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "SNIPE_bTowerMg.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_bBridge.*" );
	Util.EnableGroup( "towermg", TEAM.AXIS ); // build, mountmg, repair for Tower_MG

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

	Util.SetMaxUsersInProgress( 1, "BUILD_Axis_Command_Post");
	Util.SetGoalRange( "BUILD_Axis_Command_Post", 0);
	SetGoalPriority("BUILD_Axis_Command_Post", 0.86);

	// randomize plant goal position
	Util.AddUsePoint( Map.Plant_Fuel_Dump, { Vec3(-10840,-7310,450), Vec3(-10830,-7570,250), Vec3(-10890,-7430,250),  Vec3(-10750,-7423,250) });

	//set up some routing
	MapRoutes =
	{
		ATTACK_Bridge_1 =
		{
			ROUTE_AllySpawn =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AllySpawn3 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
		},
		BUILD_Bridge =
		{
			ROUTE_AllySpawn =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AllySpawn3 =
			{
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
		},
		ATTACK_Tunnel_Doors_1 =
		{
			ROUTE_AllySpawn =
			{
				ROUTE_footbridgeRoute2 = {Weight = 2,},
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_footbridgeRoute2 = {Weight = 2,},
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
			ROUTE_AllySpawn3 =
			{
				ROUTE_footbridgeRoute2 = {Weight = 2,},
				ROUTE_mainbridgeRoute1 = {},
				ROUTE_mainbridge4 =
				{
					ROUTE_mainbridge5 =
					{
						ROUTE_mainbridgeRoute2 = {}
					},
				},
			},
		},
		BUILD_Allied_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_Allied_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;

	// default spawn
	bot.ChangeSpawnPoint(0);
};

