//==========================================================================================
//
//	supply.gm
//
//	Who            	When		What
//------------------------------------------------------------------------------------------
//	crapshoot	29 April 2010	Initial Script
//
//==========================================================================================

global Map =
{
	Debug = 0,
	ShowMovers = false,

	// Dyno counters
	Crane_Controls_Dyno = 0,
	Depot_Fence_Dyno = 0,
	Depot_Gate_Dyno = 0,
	East_Depot_Wall_Dyno = 0,
	Forward_Bunker_Gate_Dyno = 0,
	Forward_spawn_rear_exit_Dyno = 0,
	West_Depot_Wall_Dyno = 0,

	// Objective status
	FlagStatus = 0, // nobody owns it. 1 = axis, 2 = allied
	BunkerGateStatus = false, // intact
	RearExitStatus = false, // intact
	CPStatus = 0, // nobody owns it. 1 = axis, 2 = allied
	DepotGateStatus = false, // intact
	WestWallStatus = false, // intact
	EastWallStatus = false, // intact
	TruckInPosition = false, // truck is not ready for gold loading
	ControlsBuilt = false, // crane controls are not built
	CraneActivated = false, // crane has not been activated

	// Shift status
	ShiftedToCraneControls = false, // axis have not shifted to crane control defense

	// delay dispense ammo a bit so they will use arty goals right away
	DispenseAmmoTime = 12,

	// Paththrough Navigation for special instructions at specific waypoints
	Navigation =
	{
		// some quick jumping for rails and gaps
		quickjump =
		{
			navigate = function(_this)
			{
				_this.Bot.PressButton(BTN.JUMP);
				sleep(0.25);
			},
		},
	},

	// Region trigger for alerting the axis bots when enemies are getting close to the controls
	AxisFallback =
	{
		Name = "AxisFallback",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			// don't do anything if the depot hasn't been breached
			if ( !Map.DepotBreached() ) {
				return;
			}

			// only trigger it on the first allied player through
			if ( !Map.ShiftedToCraneControls && GetEntTeam(ent) == TEAM.ALLIES ) {
				// mark it as triggered
				Map.ShiftedToCraneControls = true;

				// and shift the defense
				Util.DisableGroup( "rinnerdepot", TEAM.AXIS );
				SetAvailableMapGoals( TEAM.AXIS, false, "PLANTMINE_.*" );
				Util.EnableGroup( "rcranecontrols", TEAM.AXIS ); // defend, callartillery

				Util.MapDebugPrint("AxisFallback");
			}
		},
		OnExit = function(ent)
		{
		},
	},

	// is the forward gate or door breached?
	BunkerBreached = function()
	{
		if ( Map.RearExitStatus || Map.BunkerGateStatus ) {
			return true;
		}

		return false;
	},

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

		// mark the cp as owned by allies
		Map.CPStatus = 2;

		// don't shift if bunker hasn't been breached ( humans snuck through and built )
		if ( !Map.BunkerBreached() ) {
			return;
		}

		// and shift everyone to the outer depot goals
		Map.ShiftToOuterDepot();

		// Allies should get the truck now
		SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );

		// and spawn at the cp
		Util.ChangeSpawn( TEAM.ALLIES, 4 );

		Util.MapDebugPrint( "Command_Post_Built" );
	},

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

		// mark the cp as owned by axis
		Map.CPStatus = 1;

		Util.MapDebugPrint( "Command_Post_Built" );
	},

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

		// nobody owns the cp when it's not constructed
		Map.CPStatus = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

		// nobody owns the cp when it's not constructed
		Map.CPStatus = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

		// mark the crane as activated
		Map.CraneActivated = true;

		// and shift focus to truck
		Util.DisableGroup( "rcranecontrols", TEAM.AXIS );
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Crane_Controls" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Depot_Fence" );
		Util.DisableGroup( "binnerdepot", TEAM.ALLIES );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_crane" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Depot_Fence" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Crane_Controls.*" );
		SetGoalPriority( "DEFUSE_Crane_Controls.*", 0.0, TEAM.ALLIES, CLASS.ENGINEER, true );

		// re-use some of the axis inner depot defense
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rInnerDepot[123456]" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rCrateLoad.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CALLARTILLERY_rInnerDepot.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ARTILLERY_S_rInnerDepot.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANTMINE_rEastWall.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_bTruckAssist.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_bEscape.*" );

		Util.MapDebugPrint( "Crane_Activated" );
	},

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

		// mark the controls as built
		Map.ControlsBuilt = true;

		// always enable the plant, no matter when it's built
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Crane_Controls" );

		// enable the switch if truck is in postion
		if ( Map.TruckInPosition && !Map.CraneActivated ) {
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_crane" );
		}

		Util.MapDebugPrint( "Crane_Controls_Built" );
	},

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

		// one less dyno at the crane controls
		Map.Crane_Controls_Dyno -= 1;

		Util.MapDebugPrint( "Crane_Controls_Defused" );
	},

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

		// reset the dyno counter
		Map.Crane_Controls_Dyno = 0;

		// mark the controls as not built
		Map.ControlsBuilt = false;

		// always disable the switch
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_crane" );

		Util.MapDebugPrint( "Crane_Controls_Destroyed" );
	},

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

		// one more dyno at the crane controls
		Map.Crane_Controls_Dyno += 1;

		Util.MapDebugPrint( "Crane_Controls_Planted" );
	},

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

		// escort the truck
		SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );

		// and shift to rear depot
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rCrateLoad.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_bTruckAssist.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rRearDepot.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_bRearDepot.*" );

		Util.MapDebugPrint( "Crate_Loaded" );
	},

	// is the depot breached?
	DepotBreached = function()
	{
		if ( Map.DepotGateStatus || Map.WestWallStatus || Map.EastWallStatus ) {
			return true;
		}

		return false;
	},

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

		Util.MapDebugPrint( "Depot_Fence_Built" );
	},

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

		// one less dyno at the depot fence
		Map.Depot_Fence_Dyno -= 1;

		Util.MapDebugPrint( "Depot_Fence_Defused" );
	},

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

		// reset the dyno counter
		Map.Depot_Fence_Dyno = 0;

		Util.MapDebugPrint( "Depot_Fence_Destroyed" );
	},

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

		// one more dyno at the depot fence
		Map.Depot_Fence_Dyno += 1;

		Util.MapDebugPrint( "Depot_Fence_Planted" );
	},

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

		// one less dyno at the depot gate
		Map.Depot_Gate_Dyno -= 1;

		Util.MapDebugPrint( "Depot_Gate_Defused" );
	},

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

		// reset the dyno counter
		Map.Depot_Gate_Dyno = 0;

		// mark the depot gate as destroyed
		Map.DepotGateStatus = true;

		// shift everyone to inside the depot
		Map.ShiftToInnerDepot();

		Util.MapDebugPrint( "Depot_Gate_Destroyed" );
	},

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

		// one more dyno at the depot gate
		Map.Depot_Gate_Dyno += 1;

		Util.MapDebugPrint( "Depot_Gate_Planted" );
	},

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

		// one less dyno at the east depot wall
		Map.East_Depot_Wall_Dyno -= 1;

		Util.MapDebugPrint( "East_Depot_Wall_Defused" );
	},

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

		// reset the dyno counter
		Map.East_Depot_Wall_Dyno = 0;

		// mark the east wall as destroyed
		Map.EastWallStatus = true;

		// and shift the defense a bit
		Map.ShiftToInnerDepot();

		Util.MapDebugPrint( "East_Depot_Wall_Destroyed" );
	},

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

		// one more dyno at the east depot wall
		Map.East_Depot_Wall_Dyno += 1;

		// only defuse sides if main isn't destroyed
		SetAvailableMapGoals( TEAM.AXIS, !Map.DepotGateStatus, "DEFUSE_East_Depot.*" );

		Util.MapDebugPrint( "East_Depot_Wall_Planted" );
	},

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

		// one less dyno at the forward bunker gate
		Map.Forward_Bunker_Gate_Dyno -= 1;

		Util.MapDebugPrint( "Forward_Bunker_Gate_Defused" );
	},

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

		// reset the dyno counter
		Map.Forward_Bunker_Gate_Dyno = 0;

		// mark the forward bunker gate as destroyed
		Map.BunkerGateStatus = true;

		// Axis goals
		Map.ShiftToCP();

		Util.MapDebugPrint( "Forward_Bunker_Gate_Destroyed" );
	},

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

		// one more dyno at the forward bunker gate
		Map.Forward_Bunker_Gate_Dyno += 1;

		// axis should not try and defuse if they have already shifted
		if ( Map.BunkerBreached() ) {
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Forward_Bunker.*" );
		}

		Util.MapDebugPrint( "Forward_Bunker_Gate_Planted" );
	},

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

		// one less dyno at the rear spawn exit
		Map.Forward_spawn_rear_exit_Dyno -= 1;

		Util.MapDebugPrint( "Forward_spawn_rear_exit_Defused" );
	},

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

		// reset the dyno counter
		Map.Forward_spawn_rear_exit_Dyno = 0;

		// mark the rear spawn exit as destroyed
		Map.RearExitStatus = true;

		// shift everyone to the command post
		Map.ShiftToCP();
		Util.MapDebugPrint( "Forward_spawn_rear_exit_Destroyed" );
	},

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

		// one more dyno at the rear spawn exit
		Map.Forward_spawn_rear_exit_Dyno += 1;

		// axis should not try and defuse if they have already shifted
		if ( Map.BunkerBreached() ) {
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Forward_spawn.*" );
		}

		Util.MapDebugPrint( "Forward_spawn_rear_exit_Planted" );
	},

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

		// mark the checkpoint as owned by allies
		Map.FlagStatus = 2;

		Util.MapDebugPrint( "forwardflag_Allies_Captured" );
	},

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

		// mark the checkpoint as owned by axis
		Map.FlagStatus = 1;

		Util.MapDebugPrint( "forwardflag_Axis_Captured" );
	},

	ShiftToCP = function()
	{
		// clean up any phase 1 goals that may be active
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Forward_spawn.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Forward_Bunker.*" );
		Util.DisableGroup( "rbunker", TEAM.AXIS );
		Util.DisableGroup( "bbunker", TEAM.ALLIES );

		// make sure allies destroy both bunker plants
		if ( !Map.BunkerGateStatus ) {
			SetGoalPriority( "PLANT_Forward_Bunker_Gate", 0.9 );
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Forward_Bunker_Gate" );
		}

		if ( !Map.RearExitStatus ) {
			SetGoalPriority( "PLANT_Forward_spawn_rear_exit", 0.9 );
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Forward_spawn_rear_exit" );
		}

		// increase users for the command post
		Util.SetMaxUsers( 2, "BUILD_Command_Post" );

		// remove the role so anyone can plant it now
		Util.ClearRoleForGoals( "PLANT_Command_Post", ROLE.INFILTRATOR );

		// make sure the cp goals are always active for allies
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );

		// if the cp is already built by allies, shift to the depot
		if ( Map.CPStatus == 2 ) {
			Map.ShiftToOuterDepot();
			return;
		}

		// enable the cp offense and defense
		Util.EnableGroup( "rcp", TEAM.AXIS ); // defend, artillery, plantmine
		Util.EnableGroup( "bcp", TEAM.ALLIES );	// attack, airstrike

		Util.MapDebugPrint( "ShiftToCP" );
	},

	ShiftToInnerDepot = function()
	{
		// if the truck is already in place, this function is useless.
		// so early return to avoid any conflicting logic
		if ( Map.TruckInPosition ) {
			return;
		}

		// remove the role so anyone can plant it now
		Util.ClearRoleForGoals( "PLANT_Depot_Fence", ROLE.INFILTRATOR );

		// make sure axis build the fence on any breach.
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Depot_Fence" );

		// shift based on which walls are destroyed
		if ( Map.DepotGateStatus ) {
			// full shift to inside the depot walls
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_bTruckAssist.*" );
			Util.DisableGroup( "routerdepot", TEAM.AXIS );
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
			Util.DisableGroup( "bouterdepot", TEAM.ALLIES );
			Util.EnableGroup( "rinnerdepot", TEAM.AXIS ); // defend, callartillery
			Util.EnableGroup( "binnerdepot", TEAM.ALLIES ); // attack, build

			// make sure the cp offense and defense is disabled in case
			// this happens before allies build the cp
			Util.DisableGroup( "rcp", TEAM.AXIS );
			Util.DisableGroup( "bcp", TEAM.ALLIES );
		}

		if ( Map.WestWallStatus ) {
			// bots should use these routes now
			Util.EnableGoal( "ROUTE_westwall.*" );

			// axis will plant some mines at the west wall
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANTMINE_rWestWall.*" );
		}

		if ( Map.EastWallStatus ) {
			// bots should use these routes now
			Util.EnableGoal( "ROUTE_eastwall.*" );

			// axis will plant some mines at the east wall
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANTMINE_rEastWall.*" );
		}

		Util.MapDebugPrint( "ShiftToInnerDepot" );
	},

	ShiftToOuterDepot = function()
	{
		// disable the cp offense and defense
		Util.DisableGroup( "rcp", TEAM.AXIS );
		Util.DisableGroup( "bcp", TEAM.ALLIES );

		// make sure the plant goals are active no matter what
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Depot_Gate" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_West_Depot_Wall" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_East_Depot_Wall" );

		// if the depot gate is already breached, shift to inner depot
		if ( Map.DepotGateStatus ) {
			Map.ShiftToInnerDepot();
			return;
		}

		// enable the outer depot offense and defense
		Util.EnableGroup( "routerdepot", TEAM.AXIS );
		Util.EnableGroup( "bouterdepot", TEAM.ALLIES );

		Util.MapDebugPrint( "ShiftToOuterDepot" );
	},

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

		// mark the truck as in position
		Map.TruckInPosition = true;

		// disable escort until gold is loaded
		SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_bTruckAssist.*" );

		// enable the switch if the controls are built
		if ( Map.ControlsBuilt ) {
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_crane" );
		}

		Util.MapDebugPrint( "Truck_In_Position" );
	},

	// this map does wierd stuff to the truck after passing first gate
	// adding sanity checks for all of them just in case. could just delete
	// the region triggers as they are first triggered, but i'm going to leave
	// this as an example for other maps that may not have that as an option
	CurrentTriggerBounds = null,
	forwardGateBounds = AABB(-397.000,2155.000,-126.000,-175.000,2540.000,-52.000),
	depotGateBounds = AABB(953.000,244.000,1.000,991.000,282.000,75.000),
	backDepotBounds = AABB(687.000,-2274.000,1.000,725.000,-2236.000,75.000),
	eastDepotBounds = AABB(1482.000,-1576.000,1.000,1520.000,-1538.000,75.000),
	truckEscapeBounds = AABB(686.000,-273.000,1.000,724.000,-235.000,75.000),

	Truck_Location = function(trigger)
	{
		// we need to sanity check the location because the map script
		// appears to do some funky things with the truck entity which causes
		// multiple triggers at the same region
		entBounds = GetEntWorldAABB(trigger.Entity);

		if ( Map.CurrentTriggerBounds && entBounds.Intersects(Map.CurrentTriggerBounds) ) {
			if ( Map.Debug ) {
				DrawAABB(entBounds, COLOR.BLUE, 60);
				DrawAABB(Map.CurrentTriggerBounds, COLOR.RED, 60);
				Util.MapDebugPrint( "double TriggerRegion trigger detected!" );
			}

			// one was erroneously added, subtract it.
			Map.VehicleLocation -= 1;
			return;
		}

		// ok, valid trigger. proceed as normal.
		switch(Map.VehicleLocation)
		{
			case 1: // truck at the first gate
			{
				Map.CurrentTriggerBounds = Map.forwardGateBounds;
				if ( !Map.BunkerGateStatus ) {
					SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );
				}
			}
			case 2: // truck at depot gate
			{
				Map.CurrentTriggerBounds = Map.depotGateBounds;
				if ( !Map.DepotGateStatus ) {
					SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );
				}
			}
			case 3: // truck at back depot
			{
				Map.CurrentTriggerBounds = Map.backDepotBounds;

				// shift to east depot
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rRearDepot.*" );
				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_bRearDepot.*" );
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rEastDepot.*" );
				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_bEastDepot.*" );
			}
			case 4: // truck at east depot
			{
				Map.CurrentTriggerBounds = Map.eastDepotBounds;

				// shift to northeast depot
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rEastDepot.*" );
				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_bEastDepot.*" );
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rNEDepot.*" );
				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_bNEDepot.*" );

				// add a region trigger for the gate. added dynamically since
				// we only want the truck to trigger it on the way out
				dg = OnTriggerRegion(Map.truckEscapeBounds,RegionTrigger.VehicleTrigger);
			}
			case 5: // truck at gate
			{
				Map.CurrentTriggerBounds = Map.eastDepotBounds;

				// increase number of users headed for the truck
				Util.SetMaxUsersInProgress( 2, "ESCORT_truck" );

				// shift to the outside
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rNEDepot.*" );
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rInnerDepot[123456]" );
				SetAvailableMapGoals( TEAM.AXIS, false, "PLANTMINE_rEastWall.*" );
				SetAvailableMapGoals( TEAM.AXIS, false, "CALLARTILLERY_rInnerDepot.*" );
				SetAvailableMapGoals( TEAM.AXIS, false, "ARTILLERY_S_rInnerDepot.*" );
				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_bNEDepot.*" );
				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_bEscape.*" );
				Util.EnableGroup( "routerdepot", TEAM.AXIS );
				Util.EnableGroup( "bouterdepot", TEAM.ALLIES );
			}
			case 6: // truck is outside the gate
			{
				Map.CurrentTriggerBounds = Map.depotGateBounds;

				// shift to the deliver area
				Util.DisableGroup( "routerdepot", TEAM.AXIS );
				Util.DisableGroup( "bouterdepot", TEAM.ALLIES );
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rEscape.*" );
				SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Command_Post" );
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
				Util.EnableGroup( "bcp", TEAM.ALLIES );
			}
		}

		Util.MapDebugPrint("truck at location " + Map.VehicleLocation, true);
	},

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

		// one less dyno at the west depot wall
		Map.West_Depot_Wall_Dyno -= 1;

		Util.MapDebugPrint( "West_Depot_Wall_Defused" );
	},

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

		// reset the dyno counter
		Map.West_Depot_Wall_Dyno = 0;

		// mark the west depot wall as destroyed
		Map.WestWallStatus = true;

		// and shift the defense a bit
		Map.ShiftToInnerDepot();

		Util.MapDebugPrint( "West_Depot_Wall_Destroyed" );
	},

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

		// one more dyno at the west depot wall
		Map.West_Depot_Wall_Dyno += 1;

		// only defuse sides if main isn't destroyed
		SetAvailableMapGoals( TEAM.AXIS, !Map.DepotGateStatus, "DEFUSE_West_Depot.*" );

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

global OnMapLoad = function()
{
	// Adjust goal positions for reachablility
	Util.SetGoalPosition( 29.874, 2384.431, -103.875, "PLANT_Forward_Bunker_Gate" );

	// ignore the 'dead' flag so the escort goal will work
	Util.AddInvVehicle("MOVER_truck");

	// if test map is on, call the function that starts the testmap sequence
	if ( TestMapOn ) { Util.AutoTestMap(); }

	// Register callback functions
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built_Allied );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Command_Post_Built_Axis );
	OnTrigger( "The Crane Controls have been constructed.", Map.Crane_Controls_Built );
	OnTrigger( "The Depot Fence has been constructed.", Map.Depot_Fence_Built );
	OnTrigger( "Planted at the Crane Controls.", Map.Crane_Controls_Planted );
	OnTrigger( "Planted at the Depot Fence.", Map.Depot_Fence_Planted );
	OnTrigger( "Planted at the Depot Gate.", Map.Depot_Gate_Planted );
	OnTrigger( "Planted at the East Depot Wall.", Map.East_Depot_Wall_Planted );
	OnTrigger( "Planted at the Forward Bunker Gate.", Map.Forward_Bunker_Gate_Planted );
	OnTrigger( "Planted at the Forward spawn rear exit.", Map.Forward_spawn_rear_exit_Planted );
	OnTrigger( "Planted at the West Depot Wall.", Map.West_Depot_Wall_Planted );
	OnTrigger( "Defused at the Crane Controls.", Map.Crane_Controls_Defused );
	OnTrigger( "Defused at the Depot Fence.", Map.Depot_Fence_Defused );
	OnTrigger( "Defused at the Depot Gate.", Map.Depot_Gate_Defused );
	OnTrigger( "Defused at the East Depot Wall.", Map.East_Depot_Wall_Defused );
	OnTrigger( "Defused at the Forward Bunker Gate.", Map.Forward_Bunker_Gate_Defused );
	OnTrigger( "Defused at the Forward spawn rear exit.", Map.Forward_spawn_rear_exit_Defused );
	OnTrigger( "Defused at the West Depot Wall.", Map.West_Depot_Wall_Defused );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Command_Post_Destroyed_Allied );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed_Axis );
	OnTrigger( "The Crane Controls have been destroyed.", Map.Crane_Controls_Destroyed );
	OnTrigger( "The Depot fence has been destroyed.", Map.Depot_Fence_Destroyed );
	OnTrigger( "The Allies have breached the Forward Bunker Gate!", Map.Forward_Bunker_Gate_Destroyed );
	OnTrigger( "The Allies have breached the Depot's east wall!", Map.East_Depot_Wall_Destroyed );
	OnTrigger( "The Allies have breached the Depot Gate!", Map.Depot_Gate_Destroyed );
	OnTrigger( "The Allies have opened up the Forward spawn rear exit!", Map.Forward_spawn_rear_exit_Destroyed );
	OnTrigger( "The Allies have breached the Depot's west wall!", Map.West_Depot_Wall_Destroyed );
	OnTrigger( "The Axis have captured the forward bunker!", Map.forwardflag_Axis_Captured );
	OnTrigger( "The Allies have captured the forward bunker!", Map.forwardflag_Allies_Captured );
	OnTrigger( "The Allied Truck is in position!", Map.Truck_In_Position );
	OnTrigger( "The Allies have activated the crane!", Map.Crane_Activated );
	OnTrigger( "The Allies have loaded the Gold Crate onto the Truck!", Map.Crate_Loaded );
	OnTrigger( "truck at location", Map.Truck_Location );

	// disable pushing in the cp spawn area
	cpspawn = OnTriggerRegion(AABB(2319.000,591.000,225.000,2800.000,944.000,336.000),RegionTrigger.DisableBotPush);

	// vehicle location triggers
	forwardGate = OnTriggerRegion(Map.forwardGateBounds,RegionTrigger.VehicleTrigger);
	depotGate = OnTriggerRegion(Map.depotGateBounds,RegionTrigger.VehicleTrigger);
	backDepot = OnTriggerRegion(Map.backDepotBounds,RegionTrigger.VehicleTrigger);
	eastDepot = OnTriggerRegion(Map.eastDepotBounds,RegionTrigger.VehicleTrigger);

	// have the axis fall back when enemies get close to crane controls
	mainstairs = OnTriggerRegion(AABB(847.000,-1968.000,161.000,940.000,-1686.000,235.000),Map.AxisFallback);
	topoframp = OnTriggerRegion(AABB(237.000,-1520.000,321.000,364.000,-1475.000,395.000),Map.AxisFallback);

	// allied bots should prefer to escort from the back at this point
	ETUtil.SetStartIndex("ESCORT_truck", 1);

	// disable all the goals at map start (except routes)
	Util.DisableGoal( ".*", true );

	// disable routes to the command post for axis
	Util.DisableGroup( "p2routes", TEAM.AXIS );

	// disable some routes that are dependant on wall status
	Util.DisableGoal( "ROUTE_westwall.*" );
	Util.DisableGoal( "ROUTE_eastwall.*" );

	// allied covert ops in disguise can sneak through team doors to destroy these goals
	Util.SetRoleForGoals( "PLANT_Command_Post", ROLE.INFILTRATOR );
	Util.SetRoleForGoals( "PLANT_Depot_Fence", ROLE.INFILTRATOR );

	// Priorities
	SetGoalPriority( "PLANT_Forward_Bunker_Gate", 0.82, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Depot_Gate", 0.82, TEAM.ALLIES, CLASS.ENGINEER );

	// defuse these before others
	SetGoalPriority( "DEFUSE_Forward_Bunker_Gate.*", 1.1, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_Depot_Gate.*", 1.1, TEAM.AXIS, CLASS.ENGINEER, true );

	// only have covert ops destroy the fence
	SetGoalPriority( "PLANT_Depot_Fence", 0.0, TEAM.ALLIES, CLASS.ENGINEER );

	// some slightly higher priority camp goals to focus the bots around the truck
	SetGoalPriority( "ATTACK_bTruckAssist.*", 0.51, TEAM.ALLIES );
	SetGoalPriority( "DEFEND_rCrateLoad.*", 0.51, TEAM.AXIS );
	SetGoalPriority( "ATTACK_bRearDepot.*", 0.51, TEAM.ALLIES );
	SetGoalPriority( "DEFEND_rRearDepot.*", 0.51, TEAM.AXIS );

	// Max users per goal
	Util.SetMaxUsers( 1, "ATTACK_.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "AIRSTRIKE_.*" );
	Util.SetMaxUsers( 1, "CALLARTILLERY_.*" );
	Util.SetMaxUsers( 1, "PLANT_.*" );
	Util.SetMaxUsers( 10, "SWITCH_.*" );
	Util.SetMaxUsersInUse( 1, "ESCORT_.*" );
	Util.SetMaxUsers( 1, "BUILD_Command_Post" ); // only one axis bot at start

	// Shared goals
	Util.EnableGoal( "CHECKPOINT_forwardflag" );

	// Axis goals
	Util.EnableGroup( "rbunker", TEAM.AXIS ); // defend, plantmine, artillery
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );

	// Allied goals
	Util.EnableGroup( "bbunker", TEAM.ALLIES ); // attack, plant
	SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );

	// covert ops in disguise can reach these goals at any time
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Command_Post" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Depot_Fence" );

	// Set up routing
	InitializeMapRoutes();

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

global OnBotJoin = function( bot )
{
	// Uncomment for shootable breakables
	//~bot.TargetBreakableDist = 90.0;
	// Only set MaxViewDistance on maps with limited sight (e.g. fog)
	//~bot.MaxViewDistance = 2400;
};

global InitializeMapRoutes = function()
{
	// the route tables
	MapRoutes =
	{
		CHECKPOINT_forwardflag =
		{
			ROUTE_FirstAlliedSpawn =
			{
				ROUTE_UpperWest1 = { ROUTE_UpperWest2 = {}, },
				ROUTE_BunkerCentralWest1 = {
					ROUTE_BunkerCentralWest2 = {
						ROUTE_BunkerCentralWest3 = {
							ROUTE_BunkerCentralWest4 = {
							},
						},
					},
				},
				ROUTE_BunkerCentralEast1 = { ROUTE_BunkerCentralEast2 = {}, },
				ROUTE_BunkerTunnel1 = {},
				ROUTE_BunkerTunnel2 = {},
			},
			ROUTE_rDepotSpawn =
			{
				ROUTE_EastDepotStairs = {},
				ROUTE_DepotDoor = {},
			},
		},
		// 1, 2, 3, 9 and 10 sometimes get routed through cp
		DEFEND_rCp1 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_EastDepotStairs =
				{
					ROUTE_cpgate =
					{
						ROUTE_cprear = {},
						ROUTE_cpfront = {},
					},
				},
				ROUTE_DepotDoor =
				{
					ROUTE_cpgate =
					{
						ROUTE_cprear = {},
						ROUTE_cpfront = {},
					},
				},
			},
		},
		DEFEND_rCp4 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_EastDepotStairs = {},
				ROUTE_DepotDoor = {},
			},
		},
		PLANT_Command_Post =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_DepotTunnelEntrance =
				{
					ROUTE_NorthCpRoad = {},
					ROUTE_SouthCpRoad = {},
				},
				ROUTE_BunkerCliff =
				{
					ROUTE_NorthCpRoad = {},
					ROUTE_SouthCpRoad = {},
					ROUTE_EastBunkerRoad = { ROUTE_NorthCpRoad = {}, },
				},
			},
		},
		ATTACK_bCp1 =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_DepotTunnelEntrance =
				{
					ROUTE_NorthCpRoad = {},
					ROUTE_SouthCpRoad = {},
				},
				ROUTE_DepotTunnelMid = { ROUTE_DepotTunnelExit = {}, },
				ROUTE_BunkerCliff =
				{
					ROUTE_NorthCpRoad = {},
					ROUTE_SouthCpRoad = {},
					ROUTE_EastBunkerRoad = { ROUTE_NorthCpRoad = {}, },
				},
			},
			// for the truck assist when its close to the finish
			ROUTE_cpspawn =
			{
				ROUTE_cpfront =
				{
					ROUTE_cpgate = {},
					ROUTE_destroyedwall = {},
					ROUTE_SouthCpRoad = {},
				},
				ROUTE_cprear =
				{
					ROUTE_cpgate = {},
					ROUTE_destroyedwall = {},
					ROUTE_SouthCpRoad = {},
				},
			},
		},
		DEFEND_rDepotGate1 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_WestSpawnExit = {},
				ROUTE_EastSpawnExit = {},
			},
		},
		PLANT_Depot_Gate =
		{
			ROUTE_cpspawn =
			{
				ROUTE_cpfront =
				{
					ROUTE_cpgate = {},
					ROUTE_destroyedwall = {},
					ROUTE_SouthCpRoad = {},
				},
				ROUTE_cprear =
				{
					ROUTE_cpgate = {},
					ROUTE_destroyedwall = {},
					ROUTE_SouthCpRoad = {},
				},
			},
			ROUTE_FlagSpawn =
			{
				ROUTE_DepotTunnelEntrance =
				{
					ROUTE_NorthCpRoad = {},
					ROUTE_SouthCpRoad = {},
				},
				ROUTE_DepotTunnelMid = { ROUTE_DepotTunnelExit = {}, },
				ROUTE_BunkerCliff =
				{
					ROUTE_NorthCpRoad = {},
					ROUTE_SouthCpRoad = {},
					ROUTE_EastBunkerRoad = { ROUTE_NorthCpRoad = {}, },
				},
			},
		},
		DEFEND_rInnerDepot1 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_WestSpawnExit = {},
				ROUTE_EastSpawnExit = {},
			},
		},
		BUILD_Crane_Controls =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_DepotTunnelEntrance =
				{
					ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
					ROUTE_westdepotgate = {},
					ROUTE_eastdepotgate = {},
					ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
				},
				ROUTE_DepotTunnelMid =
				{
					ROUTE_DepotTunnelExit =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
					},
				},
				ROUTE_BunkerCliff =
				{
					ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
					ROUTE_westdepotgate = {},
					ROUTE_eastdepotgate = {},
					ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					ROUTE_EastBunkerRoad =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
						ROUTE_eastdepotgate = {},
						ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					},
				},
			},
			ROUTE_cpspawn =
			{
				ROUTE_cpfront =
				{
					ROUTE_cpgate =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
						ROUTE_eastdepotgate = {},
						ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					},
					ROUTE_destroyedwall =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
						ROUTE_eastdepotgate = {},
						ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					},
					ROUTE_SouthCpRoad =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
						ROUTE_eastdepotgate = {},
						ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					},
				},
				ROUTE_cprear =
				{
					ROUTE_cpgate =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
						ROUTE_eastdepotgate = {},
						ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					},
					ROUTE_destroyedwall =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
						ROUTE_eastdepotgate = {},
						ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					},
					ROUTE_SouthCpRoad =
					{
						ROUTE_westwall2 = { ROUTE_westwall1 = {}, },
						ROUTE_westdepotgate = {},
						ROUTE_eastdepotgate = {},
						ROUTE_eastwall2 = { ROUTE_eastwall1 = {}, },
					},
				},
			},
		},
		DEFEND_rCraneControls1 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_ccstairs = { Weight = 3, },
				ROUTE_SouthSpawnExit =
				{
					ROUTE_ccstairs = { Weight = 2, },
					ROUTE_ramp = {},
				},
			}
		},
		DEFEND_rCrateLoad1 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_SouthSpawnExit = {},
				ROUTE_bottomstairs = { ROUTE_backdoor = {}, },
				ROUTE_WestSpawnExit = {},
			},
		},
		DEFEND_rRearDepot1 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_SouthSpawnExit = {},
				ROUTE_bottomstairs = { ROUTE_backdoor = {}, },
			},
		},
		DEFEND_rEastDepot1 =
		{
			ROUTE_rDepotSpawn =
			{
				ROUTE_SouthSpawnExit = {},
				ROUTE_bottomstairs = { ROUTE_backdoor = {}, },
				ROUTE_EastSpawnExit = { Weight = 3, },
			},
		},
	};

	// copy some routes
	MapRoutes.ATTACK_bBunker1 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker2 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker3 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker4 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker5 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker6 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker7 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker8 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker9 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.ATTACK_bBunker10 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rCp2 = MapRoutes.DEFEND_rCp1;
	MapRoutes.DEFEND_rCp3 = MapRoutes.DEFEND_rCp1;
	MapRoutes.DEFEND_rCp5 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rCp6 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rCp7 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rCp8 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rCp9 = MapRoutes.DEFEND_rCp1;
	MapRoutes.DEFEND_rCp10 = MapRoutes.DEFEND_rCp1;
	MapRoutes.CALLARTILLERY_rCp1 = MapRoutes.DEFEND_rCp1;
	MapRoutes.CALLARTILLERY_rCp2 = MapRoutes.DEFEND_rCp1;
	MapRoutes.DEFEND_rEscape1 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape2 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape3 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape4 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape5 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape6 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape7 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape8 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape9 = MapRoutes.DEFEND_rCp4;
	MapRoutes.DEFEND_rEscape10 = MapRoutes.DEFEND_rCp4;
	MapRoutes.BUILD_Command_Post = MapRoutes.PLANT_Command_Post;
	MapRoutes.AIRSTRIKE_bCp1 = MapRoutes.PLANT_Command_Post;
	MapRoutes.AIRSTRIKE_bCp2 = MapRoutes.PLANT_Command_Post;
	MapRoutes.ATTACK_bCp2 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp3 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp4 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp5 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp6 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp7 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp8 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp9 = MapRoutes.ATTACK_bCp1;
	MapRoutes.ATTACK_bCp10 = MapRoutes.ATTACK_bCp1;
	MapRoutes.DEFEND_rDepotGate2 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate3 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate4 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate5 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate6 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate7 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate8 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate9 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.DEFEND_rDepotGate10 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.CALLARTILLERY_rDepotGate1 = MapRoutes.DEFEND_rDepotGate1;
	MapRoutes.PLANT_West_Depot_Wall = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.PLANT_East_Depot_Wall = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate1 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate2 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate3 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate4 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate5 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate6 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate7 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate8 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate9 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.ATTACK_bDepotGate10 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.AIRSTRIKE_bDepotGate1 = MapRoutes.PLANT_Depot_Gate;
	MapRoutes.DEFEND_rInnerDepot2 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot3 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot4 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot5 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot6 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot7 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot8 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot9 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rInnerDepot10 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rNEDepot1 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rNEDepot2 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rNEDepot3 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.DEFEND_rNEDepot4 = MapRoutes.DEFEND_rInnerDepot1;
	MapRoutes.ATTACK_bTruckAssist1 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bTruckAssist2 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bTruckAssist3 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bTruckAssist4 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot1 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot2 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot3 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot4 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot5 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot6 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot7 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot8 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot9 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bInnerDepot10 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEscape1 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEscape2 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEscape3 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEscape4 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEscape5 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEscape6 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bRearDepot1 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bRearDepot2 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bRearDepot3 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bRearDepot4 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEastDepot1 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEastDepot2 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEastDepot3 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bEastDepot4 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bNEDepot1 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bNEDepot2 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bNEDepot3 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.ATTACK_bNEDepot4 = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.SWITCH_crane = MapRoutes.BUILD_Crane_Controls;
	MapRoutes.DEFEND_rCraneControls2 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls3 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls4 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls5 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls6 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls7 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls8 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls9 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCraneControls10 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.CALLARTILLERY_rCraneControls1 = MapRoutes.DEFEND_rCraneControls1;
	MapRoutes.DEFEND_rCrateLoad2 = MapRoutes.DEFEND_rCrateLoad1;
	MapRoutes.DEFEND_rCrateLoad3 = MapRoutes.DEFEND_rCrateLoad1;
	MapRoutes.DEFEND_rCrateLoad4 = MapRoutes.DEFEND_rCrateLoad1;
	MapRoutes.DEFEND_rRearDepot2 = MapRoutes.DEFEND_rRearDepot1;
	MapRoutes.DEFEND_rRearDepot3 = MapRoutes.DEFEND_rRearDepot1;
	MapRoutes.DEFEND_rRearDepot4 = MapRoutes.DEFEND_rRearDepot1;
	MapRoutes.DEFEND_rEastDepot2 = MapRoutes.DEFEND_rEastDepot1;
	MapRoutes.DEFEND_rEastDepot3 = MapRoutes.DEFEND_rEastDepot1;
	MapRoutes.DEFEND_rEastDepot4 = MapRoutes.DEFEND_rEastDepot1;
	MapRoutes.DEFEND_rBunker1 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker2 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker3 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker4 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker5 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker6 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker7 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker8 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker9 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.DEFEND_rBunker10 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.CALLARTILLERY_rBunker1 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.PLANTMINE_rBunker1 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.PLANTMINE_rBunker2 = MapRoutes.CHECKPOINT_forwardflag;
	MapRoutes.PLANTMINE_rBunker3 = MapRoutes.CHECKPOINT_forwardflag;

	// register the routes
	Util.Routes(MapRoutes);
};
