/******************************************************************
Just slightly edited the original Goldrush waypoints and script.
Credits go to the maker of the original Goldrush files.
Editors of the Goldrush-GA release are =VOC= Naerling and crapshoot.
*******************************************************************/
/******************************************************************
UPDATED BY: BubbaG1 & **DRC**Stunner
UPDATED: August 16, 2011
- Added waypoints along ledges and routes to use them
- Added tank barrier 1 & 2 plant positions with updated routing
- Once bank doors are blown, at least half of allied bots will
  change to original spawn.
*******************************************************************/

global Map =
{
	Debug = false,

	Ammo_Cabinet_north_ammocabinet = "AMMOCAB_north_ammocabinet",
	Ammo_Cabinet_south_ammocabinet = "AMMOCAB_south_ammocabinet",
	Health_Cabinet_north_healthcabinet = "HEALTHCAB_north_healthcabinet",
	Health_Cabinet_south_healthcabinet = "HEALTHCAB_south_healthcabinet",
	Flag_gold_crate = "FLAG_gold_crate",
	Cappoint_Gold_Dropoff = "CAPPOINT_Gold_Dropoff",
	Build_Command_Post = "BUILD_Command_Post",
	Build_Tank = "BUILD_Tank",
	Build_Tank_Barrier_1 = "BUILD_Tank_Barrier_1",
	Build_Tank_Barrier_2 = "BUILD_Tank_Barrier_2",
	Build_Truck = "BUILD_Truck",
	Build_Truck_Barrier_1 = "BUILD_Truck_Barrier_1",
	Build_Truck_Barrier_2 = "BUILD_Truck_Barrier_2",
	Plant_Bank_Wall_Breach = "PLANT_Bank_Wall_Breach",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_Tank_Barrier_1 = "PLANT_Tank_Barrier_1",
	Plant_Tank_Barrier_2 = "PLANT_Tank_Barrier_2",
	Plant_Truck_Barrier_1 = "PLANT_Truck_Barrier_1",
	Plant_Truck_Barrier_2 = "PLANT_Truck_Barrier_2",
	Mount_mg42_allied = "MOUNTMG42_mg42_allied",
	Mount_mg42_bank = "MOUNTMG42_mg42_bank",
	Mount_mg42_bridge = "MOUNTMG42_mg42_bridge",
	Mount_mg42_secret = "MOUNTMG42_mg42_secret",
	Repair_mg42_allied = "REPAIRMG42_mg42_allied",
	Repair_mg42_bank = "REPAIRMG42_mg42_bank",
	Repair_mg42_bridge = "REPAIRMG42_mg42_bridge",
	Repair_mg42_secret = "REPAIRMG42_mg42_secret",
	Snipe_246 = "SNIPE_246",
	Snipe_349 = "SNIPE_349",
	Snipe_362 = "SNIPE_362",
	Snipe_825 = "SNIPE_825",
	Snipe_826 = "SNIPE_826",
	Snipe_829 = "SNIPE_829",
	Snipe_830 = "SNIPE_830",
	Snipe_870 = "SNIPE_870",
	Mover_tank = "MOVER_tank",
	Mover_truck = "MOVER_truck",
	Plant_Mine_393 = "PLANTMINE_393",
	Plant_Mine_823 = "PLANTMINE_823",
	Plant_Mine_824 = "PLANTMINE_824",
	Plant_Mine_849 = "PLANTMINE_849",
	Plant_Mine_928 = "PLANTMINE_928",
	Plant_Mine_96 = "PLANTMINE_96",
	Plant_Mine_Depot_6 = "PLANTMINE_Depot_6",
	Plant_Mine_Truck_Barrier1_3 = "PLANTMINE_Truck_Barrier1_3",
	Plant_Mine_depotgate2 = "PLANTMINE_depotgate2",

	start_of_map = true,
	EndTankRun = false,
	Escorting = false,
	TruckLoaded = false,

	//set status' for conditionals
	barrierone = 0, //not constructed
	barriertwo = 0,
	barrierthree = 0,
	barrierfour = 0,

	//vehicle positions
	near_defense_one = false,
	near_defense_two = false,
	near_defense_three = false,
	near_defense_four = false,

	// region triggers
	iw1 = 0,
	iw2 = 0,
	iw3 = 0,
	DefendingTeam = TEAM.AXIS,

	//dyno counters
	bOneDyno = 0,
	bTwoDyno = 0,
	bThreeDyno = 0,
	bFourDyno = 0,

	Switches =
	{
		e1_top1 =
		{
			Enabled = true,
			Priority = 0.0,
			WaypointName = "e1_top1",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator1Pos == "top" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		e1_top2 =
		{
			Enabled = false,
			Priority = 0.0,
			WaypointName = "e1_top2",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator1Pos == "bottom" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		e1_bot1 =
		{
			Enabled = false,
			Priority = 0.0,
			WaypointName = "e1_bot1",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator1Pos == "bottom" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		e1_bot2 =
		{
			Enabled = true,
			Priority = 0.0,
			WaypointName = "e1_bot2",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator1Pos == "top" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		e2_top1 =
		{
			Enabled = true,
			Priority = 0.0,
			WaypointName = "e2_top1",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator2Pos == "top" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		e2_top2 =
		{
			Enabled = false,
			Priority = 0.0,
			WaypointName = "e2_top2",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator2Pos == "bottom" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		e2_bot1 =
		{
			Enabled = false,
			Priority = 0.0,
			WaypointName = "e2_bot1",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator2Pos == "bottom" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		e2_bot2 =
		{
			Enabled = true,
			Priority = 0.0,
			WaypointName = "e2_bot2",
			Timeout = 10000,

			Wait = function()
			{
				if ( Map.Elevator2Pos == "top" )
				{
					sleep(1);
					return true;
				}
				return false;
			},
		},
		window =
		{
			Enabled = true,
			Priority = 0.0,
			WaypointName = "window",
			AimPosition = Vector3(729, 2294, 475),
		},
	},

	Elevator1Pos = "bottom",
	Elevator1 = function(trigger)
	{
		Map.Elevator1Pos = "moving";
		Util.MapDebugPrint("Elevator1 moving", true);

		Map.Switches.e1_top1.Enabled = false;
		Map.Switches.e1_top2.Enabled = false;
		Map.Switches.e1_bot1.Enabled = false;
		Map.Switches.e1_bot2.Enabled = false;

		sleep(7);

		vel = ToVector(trigger.Action);

		if (vel.z < 0)
		{
			Map.Elevator1Pos = "bottom";
			Map.Switches.e1_top1.Enabled = true;
			Map.Switches.e1_bot2.Enabled = true;
			Util.MapDebugPrint("Elevator1 at bottom", true);
		}
		else
		{
			Map.Elevator1Pos = "top";
			Map.Switches.e1_bot1.Enabled = true;
			Map.Switches.e1_top2.Enabled = true;
			Util.MapDebugPrint("Elevator1 at top", true);
		}
	},

	Elevator2Pos = "bottom",
	Elevator2 = function(trigger)
	{
		Map.Elevator2Pos = "moving";
		Util.MapDebugPrint("Elevator1 moving", true);

		Map.Switches.e2_top1.Enabled = false;
		Map.Switches.e2_top2.Enabled = false;
		Map.Switches.e2_bot1.Enabled = false;
		Map.Switches.e2_bot2.Enabled = false;

		sleep(7);

		vel = ToVector(trigger.Action);

		if (vel.z < 0)
		{
			Map.Elevator2Pos = "bottom";
			Map.Switches.e2_top1.Enabled = true;
			Map.Switches.e2_bot2.Enabled = true;
			Util.MapDebugPrint("Elevator2 at bottom", true);
		}
		else
		{
			Map.Elevator2Pos = "top";
			Map.Switches.e2_bot1.Enabled = true;
			Map.Switches.e2_top2.Enabled = true;
			Util.MapDebugPrint("Elevator2 at top", true);
		}
	},

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

	Tank_Built = function( trigger )
	{
		// Allied goals
		if ( Map.start_of_map )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Command_Post );
			Map.start_of_map = false;
		}

		if ( !Map.EndTankRun )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNT_tank" );
		}

		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Barrier_1_Built = function( trigger )
	{
		Map.barrierone = 1;

		if ( Map.near_defense_one )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }

		Util.MapDebugPrint( "Tank_Barrier_1_Built" );
	},

	Tank_Barrier_2_Built = function( trigger )
	{
		Map.barriertwo = 1;

		if ( Map.near_defense_two )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }

		Util.MapDebugPrint( "Tank_Barrier_2_Built" );
	},

	Truck_Built = function( trigger )
	{

		if ( Map.TruckLoaded )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );
		}

		Util.MapDebugPrint( "Truck_Built" );
	},

	Truck_Barrier_1_Built = function( trigger )
	{
		Map.barrierthree = 1;

		if ( Map.near_defense_three )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }

		Util.MapDebugPrint( "Truck_Barrier_1_Built" );
	},

	Truck_Barrier_2_Built = function( trigger )
	{
		Map.barrierfour = 1;

		if ( Map.near_defense_four )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }

		Util.MapDebugPrint( "Truck_Barrier_2_Built" );
	},

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

	Tank_Barrier_1_Destroyed = function( trigger )
	{
		Map.barrierone = 0;

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

		Util.MapDebugPrint( "Tank_Barrier_1_Destroyed" );
	},

	Tank_Barrier_2_Destroyed = function( trigger )
	{
		Map.barriertwo = 0;

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

		Util.MapDebugPrint( "Tank_Barrier_2_Destroyed" );
	},

	Truck_Barrier_1_Destroyed = function( trigger )
	{
		Map.barrierthree = 0;

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

		Util.MapDebugPrint( "Truck_Barrier_1_Destroyed" );
	},

	Truck_Barrier_2_Destroyed = function( trigger )
	{
		Map.barrierfour = 0;

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

		Util.MapDebugPrint( "Truck_Barrier_2_Destroyed" );
	},

	gold_crate_Taken = function( trigger )
	{
		Wp.SetWaypointFlag("rail1", "closed", false);
		Wp.SetWaypointFlag("rail2", "closed", false);
		Wp.SetWaypointFlag("rail3", "closed", false);

		Util.MapDebugPrint( "gold_crate_Taken" );
	},

	gold_crate_Returned = function( trigger )
	{
		Wp.SetWaypointFlag("rail1", "closed", true);
		Wp.SetWaypointFlag("rail2", "closed", true);
		Wp.SetWaypointFlag("rail3", "closed", true);

		Util.MapDebugPrint( "gold_crate_Returned" );
	},

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

	allies_steal_tank = function( trigger )
	{
		Util.OnTriggerPosition( Map.Mover_tank, "tankmarker1", 200.0,
			Map.tank_at_barrier1 );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Depot_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Tank_Barrier1_.*",
			Map.Mount_mg42_secret,
			Map.Repair_mg42_secret,
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Depot_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Tank_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			Map.Build_Command_Post,
			Map.Plant_Command_Post,
		});

		Util.MapDebugPrint( "allies_steal_tank" );
	},

	tank_past_barrier1 = function( trigger )
	{
		Map.near_defense_one = false;

		Util.OnTriggerPosition( Map.Mover_tank, "At Bridge MG", 200.0,
			Map.tank_at_bridge_mg );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Ammo_Cabinet_north_ammocabinet,
			"ATTACK_Tank_Barrier1_.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Tank_Barrier2_.*",
			"ATTACK_newbarrier2_.*",
			Map.Plant_Tank_Barrier_2,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Build_Command_Post,
			Map.Plant_Command_Post,
			Map.Plant_Tank_Barrier_1,
			Map.Health_Cabinet_north_healthcabinet,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Mount_mg42_bridge,
			Map.Repair_mg42_bridge,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Mount_mg42_secret,
			Map.Repair_mg42_secret,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "AIRSTRIKE_Tank_Barrier2_.*" );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Ammo_Cabinet_south_ammocabinet );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Tank_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Tank_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_Tank_Barrier_1 );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.Build_Tank_Barrier_2,
			Map.Health_Cabinet_south_healthcabinet,
			Map.Mount_mg42_bridge,
			Map.Repair_mg42_bridge,
		});

		//make sure the tank repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );

		Util.MapDebugPrint( "tank_past_barrier1" );
	},

	tank_at_bridge_mg = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Tank_Barrier_1 );

		Util.OnTriggerPosition( Map.Mover_tank, "tankmarker2", 200.0,
			Map.tank_at_barrier2 );

		Util.MapDebugPrint("tank_at_bridge_mg");
	},

	tank_past_barrier2 = function( trigger )
	{
		Map.near_defense_two = false;
		Map.tank_past_b2 = true; // for secret window

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Tank_Barrier2_.*",
			"ATTACK_newbarrier2_.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Bank_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Plant_Tank_Barrier_2,
			Map.Mount_mg42_bridge,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Mount_mg42_bank );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Repair_mg42_bridge );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Repair_mg42_bank );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Mount_mg42_secret,
			Map.Repair_mg42_secret,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "GRENADE_bank_mg" );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Tank_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Bank_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Bank_8",
			"DEFEND_Bank_9",
			Map.Build_Tank_Barrier_2,
			Map.Mount_mg42_bridge,
		});
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Mount_mg42_bank );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Repair_mg42_bridge );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.Repair_mg42_bank,
			Map.Build_Truck_Barrier_1,
		});

		//make sure the tank repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );

		// only use the back stairs for the repair
		Util.DisableGoal("ROUTE_repair_route_bridge.*");

		Util.MapDebugPrint( "tank_past_barrier2" );
	},

	blow_doors = function( trigger )
	{
		sleep( 2 );

		Map.EndTankRun = true;

		numAlliedBots = 0;
		foreach ( id and bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.ALLIES )
			{
				numAllies += 1;
				if ( numAlliedBots % 2 == 0 )
				{
					bot.ChangeSpawnPoint( 3 );
				}
			}
		}


		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"AIRSTRIKE_Tank_Barrier2_.*",
			Map.Build_Tank,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Build_Truck,
			Map.Flag_gold_crate,
			Map.Cappoint_Gold_Dropoff,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Mover_tank );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Plant_Bank_Wall_Breach,
			"SMOKEBOMB_bank.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNT_tank" );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Mount_mg42_bridge );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Mount_mg42_bank );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Repair_mg42_bridge );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.Repair_mg42_bank,
			"DEFEND_Bank_8",
			"DEFEND_Bank_9",
		});

		// intrusion warning region triggers
		Map.iw1 = OnTriggerRegion( AABB(1480.742,-2466.167,-403.870,1605.773,-2403.699,-235.466), RegionTrigger.IntrusionWarning );
		Map.iw2 = OnTriggerRegion( AABB(1470.405,-2041.986,-359.106,1696.767,-1951.906,-206.108), RegionTrigger.IntrusionWarning );
		Map.iw3 = OnTriggerRegion( AABB(1854.647,-2344.672,-406.225,1942.472,-2162.907,-187.716), RegionTrigger.IntrusionWarning );

		Wp.SetWaypointFlag("closeddoor1", "closed", false);
		Wp.SetWaypointFlag("closeddoor2", "closed", false);
		Wp.SetWaypointFlag("closeddoor3", "closed", false);

		Util.MapDebugPrint( "blow_doors" );
	},

	allies_taking_gold = function( trigger )
	{
		Util.OnTriggerPosition( Map.Mover_truck, "truckmarker1", 200.0,
			Map.truck_at_barrier1 );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"GRENADE_bank_mg",
			"ATTACK_Bank_.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Truck_Barrier1_.*",
			Map.Plant_Truck_Barrier_1,
			Map.Plant_Truck_Barrier_2,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Mount_mg42_bank );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Mount_mg42_allied );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Repair_mg42_bank );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Repair_mg42_allied,
			Map.Mover_truck,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Plant_Bank_Wall_Breach,
			"SMOKEBOMB_bank.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );

		Map.TruckLoaded = true;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Bank_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Mount_mg42_bank );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Mount_mg42_allied );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Repair_mg42_bank );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Repair_mg42_allied );

		DeleteTriggerRegion( Map.iw1 );
		DeleteTriggerRegion( Map.iw2 );
		DeleteTriggerRegion( Map.iw3 );

		Util.MapDebugPrint( "allies_taking_gold" );
	},

	truck_past_barrier1 = function( trigger )
	{
		Map.near_defense_three = false;

		Util.OnTriggerPosition( Map.Mover_truck, "truckmarker2", 200.0,
			Map.tank_at_barrier2 );

		foreach ( id and bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.ALLIES )
				{ bot.ChangeSpawnPoint( 3 ); }
		}

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Truck_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Truck_Barrier_1 );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_Truck_Barrier_1 );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Truck_Barrier_2 );

		//make sure the truck repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );

		Util.MapDebugPrint( "truck_past_barrier1" );
	},

	truck_past_barrier2 = function( trigger )
	{
		Map.near_defense_four = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Escape_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Mount_mg42_allied,
			Map.Repair_mg42_allied,
			Map.Plant_Truck_Barrier_2,
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck_Escape_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			Map.Mount_mg42_allied,
			Map.Repair_mg42_allied,
			Map.Build_Truck_Barrier_2,
		});

		//make sure the truck repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );

		Util.MapDebugPrint( "truck_past_barrier2" );
	},

	Tank_Destroyed = function ( trigger )
	{
		Util.SetPositionGoal( Map.Build_Tank, Map.Mover_tank );
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNT_tank" );

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

	Truck_Destroyed = function ( trigger )
	{
		Util.SetPositionGoal( Map.Build_Truck, Map.Mover_truck );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );

		Util.MapDebugPrint( "Truck_Destroyed" );
	},

	tank_at_barrier1 = function()
	{
		Map.near_defense_one = true;

		//technically shouldn't need the 'else', but just to be sure
		if ( Map.barrierone > 0 && Map.bOneDyno < 1)
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank ); }

		Util.MapDebugPrint("tank_at_barrier1");
	},

	tank_at_barrier2 = function()
	{
		Map.near_defense_two = true;

		if ( Map.barriertwo > 0 && Map.bTwoDyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank ); }

		// enable the repair routes
		Util.EnableGoal("ROUTE_repair_route.*");

		Util.MapDebugPrint("tank_at_barrier2");
	},

	truck_at_barrier1 = function()
	{
		Map.near_defense_three = true;

		if ( Map.barrierthree > 0 && Map.bThreeDyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck ); }

		Util.MapDebugPrint("truck_at_barrier1");
	},

	truck_at_barrier2 = function()
	{
		Map.near_defense_four = true;

		if ( Map.barrierfour > 0 && Map.bFourDyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck ); }

		Util.MapDebugPrint("truck_at_barrier2");
	},

	planted_at_Tank_Barrier_1 = function ( trigger )
	{
		//got a dyno down, build the tank if needed
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );

		Map.bOneDyno += 1;

		//engineers already have two plants, save charge for tank
		if ( Map.bOneDyno >= 2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Tank_Barrier_1 );
		}

		Util.MapDebugPrint("planted_at_Tank_Barrier_1");
	},

	defused_at_Tank_Barrier_1 = function ( trigger )
	{
		Map.bOneDyno -= 1;

		//focus back on planting dyno
		if ( Map.bOneDyno < 1 && Map.near_defense_one )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank );
		}

		//allow engineers to plant twice
		if ( Map.bOneDyno < 2 && Map.near_defense_one )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Plant_Tank_Barrier_1 );
		}

		Util.MapDebugPrint("defused_at_Tank_Barrier_1");
	},

	planted_at_Tank_Barrier_2 = function ( trigger )
	{
		Map.bTwoDyno += 1;

		if ( Map.near_defense_two )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );
		}

		//engineers already have two plants, save charge for tank
		if ( Map.bTwoDyno >= 2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Tank_Barrier_2 );
		}

		Util.MapDebugPrint("planted_at_Tank_Barrier_2");
	},

	defused_at_Tank_Barrier_2 = function ( trigger )
	{
		Map.bTwoDyno -= 1;

		if ( Map.bTwoDyno < 1 && Map.near_defense_two )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank );
		}

		//allow engineers to plant twice
		if ( Map.bTwoDyno < 2 && Map.near_defense_two )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Plant_Tank_Barrier_2 );
		}

		Util.MapDebugPrint("defused_at_Tank_Barrier_2");
	},

	planted_at_Truck_Barrier_1 = function ( trigger )
	{
		Map.bThreeDyno += 1;

		if ( Map.near_defense_three )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );
		}

		Util.MapDebugPrint("planted_at_Truck_Barrier_1");
	},

	defused_at_Truck_Barrier_1 = function ( trigger )
	{
		Map.bThreeDyno -= 1;

		if ( Map.bThreeDyno < 1 && Map.near_defense_three )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck );
		}

		Util.MapDebugPrint("defused_at_Truck_Barrier_1");
	},

	planted_at_Truck_Barrier_2 = function ( trigger )
	{
		Map.bFourDyno += 1;

		if ( Map.near_defense_four )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );
		}

		Util.MapDebugPrint("planted_at_Truck_Barrier_2");
	},

	defused_at_Truck_Barrier_2 = function ( trigger )
	{
		Map.bFourDyno -= 1;

		if ( Map.bFourDyno < 1 && Map.near_defense_four )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck );
		}

		Util.MapDebugPrint("defused_at_Truck_Barrier_2");
	},

	Bank_Wall_Breach_Destroyed = function( trigger )
	{
			Wp.SetWaypointFlag("wallbreach", "closed", false);

		Util.MapDebugPrint( "Bank_Wall_Breach_Destroyed" );
	},

	Bankdoor1 = function(trigger)
	{
		vel = ToVector(trigger.Action);

		if (vel.y > 0)
		{
			Wp.SetWaypointFlag("onewaydoor1", "door", false);
			Wp.SetWaypointFlag("onewaydoor2", "door", false);
			Util.MapDebugPrint("BankDoor1 opening");
		}
		else
		{
			Wp.SetWaypointFlag("onewaydoor1", "door", true);
			Wp.SetWaypointFlag("onewaydoor2", "door", true);
			Util.MapDebugPrint("BankDoor1 closing");
		}
	},

	Bankdoor2 = function(trigger)
	{
		vel = ToVector(trigger.Action);

		if (vel.y > 0)
		{
			Wp.SetWaypointFlag("onewaydoor3", "door", true);
			Wp.SetWaypointFlag("onewaydoor4", "door", true);
			Util.MapDebugPrint("BankDoor2 closing");
		}
		else
		{
			Wp.SetWaypointFlag("onewaydoor3", "door", false);
			Wp.SetWaypointFlag("onewaydoor4", "door", false);
			Util.MapDebugPrint("BankDoor2 opening");
		}
	},

	Bankdoor3 = function(trigger)
	{
		vel = ToVector(trigger.Action);

		if (vel.y > 0)
		{
			Wp.SetWaypointFlag("onewaydoor5", "door", false);
			Wp.SetWaypointFlag("onewaydoor6", "door", false);
			Util.MapDebugPrint("BankDoor3 opening");
		}
		else
		{
			Wp.SetWaypointFlag("onewaydoor5", "door", true);
			Wp.SetWaypointFlag("onewaydoor6", "door", true);
			Util.MapDebugPrint("BankDoor3 closing");
		}
	},

	Secret_Window = function(trigger)
	{
		Map.Switches.window.Enabled = false;

		vel = ToVector(trigger.Action);

		// disable mg42 when it is closed. note that paththrough is used for the window
		// so if the bot is mounted and it was closed, it should dismount and open it
		// it doesn't handle case of closed when no bot is there, but this mg is a bit
		// useless anyway
		if (vel.y > 0) // closed
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNTMG42_mg42_secret" );
			Map.Switches.window.Enabled = true;
			Util.MapDebugPrint("window closed", true);
		}
		else
		{
			if ( !Map.start_of_map && !Map.tank_past_b2 ) {
				SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNTMG42_mg42_secret" );
			}

			Util.MapDebugPrint("window opened", true);
		}
	},

	secdoor1a = function( trigger )
	{
		vec = ToVector(trigger.Action);
		if ( vec.y > 0)
		{
			// remove door flag once it's open
			Util.MapDebugPrint( "secdoor open" );
			Wp.SetWaypointFlag( "onewaydoor7", "door", false );
			Wp.SetWaypointFlag( "onewaydoor8", "door", false );
		}
		else
		{
			Util.MapDebugPrint( "secdoor closed" );
			Wp.SetWaypointFlag( "onewaydoor7", "door", true );
			Wp.SetWaypointFlag( "onewaydoor8", "door", true );
		}
	}
};

global OnMapLoad = function()
{
	Util.SetGoalOffset( 0, 160, 0, Map.Plant_Tank_Barrier_1 );
	Util.SetGoalOffset( 0, 174, 0, Map.Plant_Tank_Barrier_2 );

	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "The Tank has been repaired!", Map.Tank_Built );
	OnTrigger( "Tank Barrier #1 has been constructed.", Map.Tank_Barrier_1_Built );
	OnTrigger( "Tank Barrier #2 has been constructed.", Map.Tank_Barrier_2_Built );
	OnTrigger( "The Truck has been repaired!", Map.Truck_Built );
	OnTrigger( "Truck Barrier #1 has been constructed.", Map.Truck_Barrier_1_Built );
	OnTrigger( "Truck Barrier #2 has been constructed.", Map.Truck_Barrier_2_Built );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "The Tank has been damaged!", Map.Tank_Destroyed );
	OnTrigger( "Tank Barrier #1 has been destroyed.", Map.Tank_Barrier_1_Destroyed );
	OnTrigger( "Tank Barrier #2 has been destroyed.", Map.Tank_Barrier_2_Destroyed );
	OnTrigger( "The Truck has been damaged!", Map.Truck_Destroyed );
	OnTrigger( "Truck Barrier #1 has been destroyed.", Map.Truck_Barrier_1_Destroyed );
	OnTrigger( "Truck Barrier #2 has been destroyed.", Map.Truck_Barrier_2_Destroyed );
	OnTrigger( "goldrush_allies_gold1_taken", Map.gold_crate_Taken );
	OnTrigger( "goldrush_allies_gold2_taken", Map.gold_crate_Taken );
	OnTrigger( "goldrush_allies_gold1_returned", Map.gold_crate_Returned );
	OnTrigger( "goldrush_allies_gold2_returned", Map.gold_crate_Returned );
	OnTrigger( "Allied team has secured the first Gold Crate!", Map.Gold_Dropoff_Captured );
	OnTrigger( "Allied team has secured the second Gold Crate!", Map.Gold_Dropoff_Captured );
	OnTrigger( "Allied team has stolen the Tank!", Map.allies_steal_tank );
	OnTrigger( "Allied team is escaping with the Gold Crates!", Map.allies_taking_gold );
	OnTrigger( "goldrush_allies_tank_barrier1", Map.tank_past_barrier1 );
	OnTrigger( "goldrush_allies_tank_barrier2", Map.tank_past_barrier2 );
	OnTrigger( "goldrush_allies_truck_barrier1", Map.truck_past_barrier1 );
	OnTrigger( "goldrush_allies_truck_barrier2", Map.truck_past_barrier2 );
	OnTrigger( "Allied team has destroyed the Bank Doors!", Map.blow_doors );
	OnTrigger( "Planted at Tank Barrier #1.", Map.planted_at_Tank_Barrier_1 );
	OnTrigger( "Defused at Tank Barrier #1.", Map.defused_at_Tank_Barrier_1 );
	OnTrigger( "Planted at Tank Barrier #2.", Map.planted_at_Tank_Barrier_2 );
	OnTrigger( "Defused at Tank Barrier #2.", Map.defused_at_Tank_Barrier_2 );
	OnTrigger( "Planted at Truck Barrier #1.", Map.planted_at_Truck_Barrier_1 );
	OnTrigger( "Defused at Truck Barrier #1.", Map.defused_at_Truck_Barrier_1 );
	OnTrigger( "Planted at Truck Barrier #2.", Map.planted_at_Truck_Barrier_2 );
	OnTrigger( "Defused at Truck Barrier #2.", Map.defused_at_Truck_Barrier_2 );
	OnTrigger( "Allied team has destroyed the bank wall breach!", Map.Bank_Wall_Breach_Destroyed );
	OnTrigger( "bankdoorfloor2_start", Map.Bankdoor1 );
	OnTrigger( "bankdoorfloor2b_start", Map.Bankdoor2 );
	OnTrigger( "bankdoorfloor1a_start", Map.Bankdoor3 );
	OnTrigger( "elevator1_goto", Map.Elevator1 );
	OnTrigger( "elevator2_goto", Map.Elevator2 );
	OnTrigger( "secdoor3a_start", Map.Secret_Window );
	OnTrigger( "secdoor1a_start", Map.secdoor1a );

	// Adjust tank goal for rebuild
	Util.SetPositionGoal( Map.Build_Tank, Map.Mover_tank );
	Util.SetPositionGoal( Map.Build_Truck, Map.Mover_truck ); //truck too

	//Additional plant positions for Tank Barrier 1
	Util.AddUsePoint( "PLANT_Tank_Barrier_1", { Vec3(935, 611, 8), Vec3(628, 524, -1), Vec3(545, 465, 3), Vec3(647, 613, 8) } );

	//Additional plant positions for Tank Barrier 2
	Util.AddUsePoint( "PLANT_Tank_Barrier_2", { Vec3(2030, 253, -401), Vec3(1631, 251, -413), Vec3(1653, 304, -285), Vec3(1581, -130, -183), Vec3(2042, 480, -403) } );

	// Max users per goal
	Util.SetMaxUsersInProgress( 1, "ATTACK_Depot_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_Tank_Barrier1_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_Tank_Barrier2_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_Truck_Barrier1_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_Truck_Barrier2_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_Escape_.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_Depot_.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_Tank_Barrier1_.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_Tank_Barrier2_.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_Truck_Barrier1_.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_Truck_Barrier2_.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_Escape_.*" );
	Util.SetMaxUsersInProgress( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsersInProgress( 1, "SMOKEBOMB_.*" );

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=5, MaxCampTime=10} );
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=5, MaxCampTime=20} );
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=60, MaxCampTime=120} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=120, MaxCampTime=120}  );
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=120, MaxCampTime=120} );

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

	ETUtil.SetCabinets();

	// Allied goals
	SetGoalPriority( Map.Flag_gold_crate, 0.92, TEAM.ALLIES );
	SetGoalPriority( Map.Cappoint_Gold_Dropoff, 0.92, TEAM.ALLIES );
	SetGoalPriority( Map.Build_Tank, 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Command_Post, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Tank_Barrier_1, 0.84, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Tank_Barrier_2, 0.83, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Truck_Barrier_1, 0.82, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Truck_Barrier_2, 0.81, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "SMOKEBOMB_bank.*", 0.95, TEAM.ALLIES, CLASS.COVERTOPS );

	SetAvailableMapGoals( TEAM.ALLIES, false, {
		Map.Ammo_Cabinet_south_ammocabinet,
		"ATTACK.*",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Depot_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"DEFEND.*",
		Map.Health_Cabinet_south_healthcabinet,
		Map.Build_Command_Post,
		Map.Build_Truck,
		Map.Plant_Bank_Wall_Breach,
		Map.Plant_Tank_Barrier_2,
		Map.Plant_Truck_Barrier_1,
		Map.Plant_Truck_Barrier_2,
		Map.Flag_gold_crate,
		Map.Cappoint_Gold_Dropoff,
		Map.Mount_mg42_bridge,
		Map.Mount_mg42_bank,
		Map.Mount_mg42_allied,
		Map.Repair_mg42_bridge,
		Map.Repair_mg42_bank,
		Map.Repair_mg42_allied,
		"SNIPE.*",
		"PLANTMINE.*",
		Map.Mover_truck,
		"MOUNTMG42_mg42_secret",
		"REPAIRMG42_mg42_secret",
		"SMOKEBOMB_.*",
		"AIRSTRIKE_.*",
		"GRENADE_bank_mg",
		"ESCORT_truck",
		"MOUNT_tank",
	});

	// Axis goals
	SetGoalPriority( Map.Build_Tank_Barrier_1, 0.94, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Command_Post, 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Tank_Barrier_2, 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Truck_Barrier_1, 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Command_Post, 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_Depot_[14]", 0.6, TEAM.AXIS ); //try and keep these two occupied

	SetAvailableMapGoals( TEAM.AXIS, false, {
		Map.Ammo_Cabinet_north_ammocabinet,
		Map.Ammo_Cabinet_south_ammocabinet,
		"ATTACK.*",
		"DEFEND.*",
		Map.Health_Cabinet_north_healthcabinet,
		Map.Health_Cabinet_south_healthcabinet,
		Map.Build_Tank_Barrier_2,
		Map.Build_Truck_Barrier_1,
		Map.Build_Truck_Barrier_2,
		Map.Mount_mg42_bridge,
		Map.Mount_mg42_bank,
		Map.Mount_mg42_allied,
		Map.Repair_mg42_bridge,
		Map.Repair_mg42_bank,
		Map.Repair_mg42_allied,
		"SNIPE.*",
		"PLANTMINE.*",
		"AIRSTRIKE_.*",
		"GRENADE_bank_mg",
	});
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Depot_.*" );

	Wp.SetWaypointFlag("closeddoor1", "closed", true);
	Wp.SetWaypointFlag("closeddoor2", "closed", true);
	Wp.SetWaypointFlag("closeddoor3", "closed", true);
	Wp.SetWaypointFlag("rail1", "closed", true);
	Wp.SetWaypointFlag("rail2", "closed", true);
	Wp.SetWaypointFlag("rail3", "closed", true);
	Wp.SetWaypointFlag("wallbreach", "closed", true);
	Wp.SetWaypointFlag("onewaydoor1", "door", true);
	Wp.SetWaypointFlag("onewaydoor2", "door", true);
	Wp.SetWaypointFlag("onewaydoor3", "door", true);
	Wp.SetWaypointFlag("onewaydoor4", "door", true);
	Wp.SetWaypointFlag("onewaydoor5", "door", true);
	Wp.SetWaypointFlag("onewaydoor6", "door", true);
	Wp.SetWaypointFlag("onewaydoor7", "door", true);
	Wp.SetWaypointFlag("onewaydoor8", "door", true);

	SetGoalPriority( "PLANT_Bank_Wall_Breach", 0.95 );

	// disable combat movement
	secretwindow = OnTriggerRegion(AABB(2175,-1087,-30, 2320,-700,97), RegionTrigger.DisableBotPush);
	sill1 = OnTriggerRegion(AABB(-65,-620,123, 1628,-164,407), RegionTrigger.DisableBotPush);

	//routes for tank build at barrier 2
	Util.DisableGoal("ROUTE_repair_route.*");

	//set up some routing
	MapRoutes =
	{
		BUILD_Tank =
		{
			ROUTE_AllySpawn =
			{
				ROUTE_depotgate =
				{
					ROUTE_depotgate2 =
					{
					},
					ROUTE_depotgatesplit =
					{
						ROUTE_as_rightsplit1 =
						{
						},
					},
					ROUTE_cproute =
					{
					},
				},
				ROUTE_as_right =
				{
					ROUTE_as_rightsplit1 =
					{
					},
					ROUTE_as_rightsplit2 =
					{
						ROUTE_depotflank =
						{
						},
					},
				},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_depotgate =
				{
					ROUTE_depotgate2 =
					{
					},
					ROUTE_depotgatesplit =
					{
						ROUTE_as_rightsplit1 =
						{
						},
					},
					ROUTE_cproute =
					{
					},
				},
				ROUTE_as_right =
				{
					ROUTE_as_rightsplit1 =
					{
					},
					ROUTE_as_rightsplit2 =
					{
						ROUTE_depotflank =
						{
						},
					},
				},
			},

			ROUTE_TankYardSpawn =
			{
				ROUTE_repair_route_stairs =
				{
				},
				ROUTE_repair_route_bridge1 =
				{
					ROUTE_repair_route_bridge2 =
					{
						ROUTE_repair_route_bridge3 =
						{
						},
					},
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_repair_route_stairs =
				{
				},
				ROUTE_repair_route_bridge1 =
				{
					ROUTE_repair_route_bridge2 =
					{
						ROUTE_repair_route_bridge3 =
						{
						},
					},
				},
			},
		},
		PLANT_Tank_Barrier_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_depotflank =
				{
					ROUTE_tank_barrier_1a = {},
					ROUTE_tank_barrier_1b = {},
					ROUTE_tank_barrier_1c = {},
					ROUTE_tank_barrier_1d = {},
				},
				ROUTE_depotflank2 =
				{
					ROUTE_tank_barrier_1a = {},
					ROUTE_tank_barrier_1b = {},
					ROUTE_tank_barrier_1c = {},
					ROUTE_tank_barrier_1d = {},
				},
				ROUTE_as_rightsplit1 =
				{
					ROUTE_tank_barrier_1a = {},
					ROUTE_tank_barrier_1b = {},
					ROUTE_tank_barrier_1c = {},
					ROUTE_tank_barrier_1d = {},
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_depotflank =
				{
					ROUTE_tank_barrier_1a = {},
					ROUTE_tank_barrier_1b = {},
					ROUTE_tank_barrier_1c = {},
					ROUTE_tank_barrier_1d = {},
				},
				ROUTE_depotflank2 =
				{
					ROUTE_tank_barrier_1a = {},
					ROUTE_tank_barrier_1b = {},
					ROUTE_tank_barrier_1c = {},
					ROUTE_tank_barrier_1d = {},
				},
				ROUTE_as_rightsplit1 =
				{
					ROUTE_tank_barrier_1a = {},
					ROUTE_tank_barrier_1b = {},
					ROUTE_tank_barrier_1c = {},
					ROUTE_tank_barrier_1d = {},
				},
			},
		},
		ATTACK_Tank_Barrier1_3 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_hidden_passage =
				{
				},
			},
		},
		PLANT_Tank_Barrier_2 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_tank_barrier_2a = {},
					ROUTE_bridgeroute2 =
					{
						ROUTE_tank_barrier_2b = {},
						ROUTE_tank_barrier_2c = {},
						ROUTE_tank_barrier_2d = {},
					},
				},
				ROUTE_cp_stairs =
				{
					Weight = 2,
					ROUTE_tank_barrier_2b = {},
					ROUTE_tank_barrier_2c = {},
					ROUTE_tank_barrier_2d = {},
				},
				ROUTE_repair_route_bridge1 =
				{
					ROUTE_tank_barrier_2a = {},
				},
				ROUTE_tank_barrier_2e = {},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_tank_barrier_2a = {},
					ROUTE_bridgeroute2 =
					{
						ROUTE_tank_barrier_2b = {},
						ROUTE_tank_barrier_2c = {},
						ROUTE_tank_barrier_2d = {},
					},
				},
				ROUTE_cp_stairs =
				{
					Weight = 2,
					ROUTE_tank_barrier_2b = {},
					ROUTE_tank_barrier_2c = {},
					ROUTE_tank_barrier_2d = {},
				},
				ROUTE_repair_route_bridge1 =
				{
					ROUTE_tank_barrier_2a = {},
				},
				ROUTE_tank_barrier_2e = {},
			},
		},
		ATTACK_Tank_Barrier2_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_trb1_stairs =
				{
					Weight = 2,
					ROUTE_b2flank =
					{
					},
				},
				ROUTE_cp_stairs = {},
				ROUTE_bridge_mg_ledge1 =
				{
					ROUTE_bridge_mg_ledge2 =
					{
						ROUTE_bridge_mg_ledge3 = {},
					},
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_bridgeroute2 =
					{
					},
				},
				ROUTE_trb1_stairs =
				{
					Weight = 2,
					ROUTE_b2flank =
					{
					},
				},
				ROUTE_cp_stairs =
				{
				},
				ROUTE_bridge_mg_ledge1 =
				{
					ROUTE_bridge_mg_ledge2 =
					{
						ROUTE_bridge_mg_ledge3 =
						{
						},
					},
				},
			},
		},
		ATTACK_newbarrier2_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs =
				{
					Weight = 3,
					ROUTE_b2flank =
					{
					},
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs =
				{
					Weight = 3,
					ROUTE_b2flank =
					{
					},
				},
			},
		},
		ATTACK_Bank_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs =
				{
				},
				ROUTE_cp_stairs =
				{
					ROUTE_cp_stairs2 =
					{
					},
				},
				ROUTE_southstairs =
				{
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs =
				{
				},
				ROUTE_cp_stairs =
				{
					ROUTE_cp_stairs2 =
					{
					},
				},
				ROUTE_southstairs =
				{
				},
			},
		},
		BUILD_Truck =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs =
				{
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs =
				{
				},
			},
			ROUTE_AllySpawn =
			{
				ROUTE_SouthStairsLedge =
				{
					ROUTE_TruckLedge =
					{
						ROUTE_AxisMGLedge =
						{
						},
					},
				},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_SouthStairsLedge =
				{
					ROUTE_TruckLedge =
					{
						ROUTE_AxisMGLedge = {},
					},
				},
			},
		},
		FLAG_gold_crate =
		{
			ROUTE_AllySpawn =
			{
				ROUTE_bankback =
				{
					ROUTE_bankback3 =
					{
						ROUTE_elevator = {},
					},
				},
				ROUTE_SouthStairsLedge =
				{
					ROUTE_TruckLedge =
					{
						ROUTE_AxisMGLedge =
						{
							ROUTE_bankback =
							{
							},
							ROUTE_bankfront =
							{
							},
						},
					},
				},
				ROUTE_wallbreach =
				{
				},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_bankback =
				{
					ROUTE_bankback3 =
					{
						ROUTE_elevator = {},
					},
				},
				ROUTE_SouthStairsLedge =
				{
					ROUTE_TruckLedge =
					{
						ROUTE_AxisMGLedge =
						{
							ROUTE_bankback =
							{
							},
							ROUTE_bankfront =
							{
							},
						},
					},
				},
				ROUTE_wallbreach =
				{
				},
			},
			ROUTE_TankYardSpawn =
			{
				ROUTE_bankback =
				{
					ROUTE_bankback3 =
					{
						ROUTE_elevator =
						{
						},
					},
				},
				ROUTE_TankYardSpawn2 =
				{
					ROUTE_trb1_stairs =
					{
						Weight = 2,
						ROUTE_westbank =
						{
							ROUTE_bankfront =
							{
							},
							ROUTE_westbank2 =
							{
								ROUTE_bankback =
								{
								},
							},
						},
					},
					ROUTE_cp_stairs =
					{
						ROUTE_cp_stairs2 =
						{
						},
					},
					ROUTE_southstairs =
					{
					},
					ROUTE_southstairs2 =
					{
						ROUTE_wallbreach =
						{
						},
					},
				},
				ROUTE_TankYardSpawn3 =
				{
					ROUTE_trb1_stairs =
					{
						Weight = 2,
						ROUTE_westbank =
						{
							ROUTE_bankfront =
							{
							},
							ROUTE_westbank2 =
							{
								ROUTE_bankback = {},
							},
						},
					},
					ROUTE_cp_stairs =
					{
						ROUTE_cp_stairs2 = {},
					},
					ROUTE_southstairs =
					{
					},
					ROUTE_southstairs2 =
					{
						ROUTE_wallbreach =
						{
						},
					},
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs =
				{
					Weight = 2,
					ROUTE_westbank =
					{
						ROUTE_bankfront =
						{
						},
						ROUTE_westbank2 =
						{
							ROUTE_bankback = {},
						},
					},
				},
				ROUTE_cp_stairs =
				{
					ROUTE_cp_stairs2 =
					{
					},
				},
				ROUTE_southstairs =
				{
				},
			},
		},
		CAPPOINT_Gold_Dropoff =
		{
			ROUTE_goldgrab =
			{
				ROUTE_bankback =
				{
					Weight = 2,
					ROUTE_westbank2 =
					{
					},
				},
				ROUTE_bankfront =
				{
				},
			},
		},
		ATTACK_Truck_Barrier1_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_longalley = { Weight = 2, ROUTE_longstairs = {}, },
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_longalley = { Weight = 2, ROUTE_longstairs = {}, },
			},
		},
		DEFEND_Tank_Barrier1_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_cp_stairs2 =
				{
					Weight = 2,
					ROUTE_cp_stairs = {},
				},
				ROUTE_southstairs = {},
			},
		},
		DEFEND_Tank_Barrier2_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r = {},
				ROUTE_axisspawn_l = {},
			},
		},
		DEFEND_Bank_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r = {},
				ROUTE_axisspawn_l = {},
				ROUTE_bankback3 =
				{
					ROUTE_bankback2 = { ROUTE_bankback = {}, },
				},
			},
		},
		DEFEND_Truck_Barrier1_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r =
				{
					ROUTE_southstairs = { ROUTE_southstairs2 = {}, },
					ROUTE_trb1_stairs = {},
				},
				ROUTE_axisspawn_l = {},
			},
		},
	};
	// copy some routes
	MapRoutes.ATTACK_Depot_6 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_7 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_8 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_9 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_10 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Tank_Barrier1_1 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.ATTACK_Tank_Barrier1_2 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.ATTACK_Tank_Barrier1_4 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.ATTACK_Tank_Barrier1_5 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.MOUNTMG42_mg42_bridge = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_2 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_3 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_4 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_5 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_newbarrier2_2 = MapRoutes.ATTACK_newbarrier2_1;
	MapRoutes.ATTACK_newbarrier2_3 = MapRoutes.ATTACK_newbarrier2_1;
	MapRoutes.ATTACK_Bank_2 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.ATTACK_Bank_3 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.ATTACK_Bank_4 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.ATTACK_Bank_5 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.MOUNTMG42_mg42_bank = MapRoutes.ATTACK_Bank_1;
	MapRoutes.MOUNTMG42_mg42_allied = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.PLANT_Truck_Barrier_1 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_2 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_3 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_4 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_5 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.DEFEND_Tank_Barrier1_7 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier1_8 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier1_9 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier1_10 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier2_7 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Tank_Barrier2_8 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Tank_Barrier2_9 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Tank_Barrier2_10 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.MOUNTMG42_mg42_bridge = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.MOUNTMG42_mg42_bank = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Bank_7 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_8 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_9 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_10 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Truck_Barrier1_7 = MapRoutes.DEFEND_Truck_Barrier1_6;
	MapRoutes.DEFEND_Truck_Barrier1_8 = MapRoutes.DEFEND_Truck_Barrier1_6;
	MapRoutes.DEFEND_Truck_Barrier1_9 = MapRoutes.DEFEND_Truck_Barrier1_6;
	MapRoutes.DEFEND_Truck_Barrier1_10 = MapRoutes.DEFEND_Truck_Barrier1_6;

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