global Map =
{
	start_of_map = true,
	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,

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

	DispenseAmmoTime = 15,

	spamnades = true,
	rnadehall_bots = 0,
	rnadedoor_bots = 0,
	Navigation =
	{
		rnadehall =
		{
			wpInfo = Util.WpNameInfo("rNadeHall"),
			navigate = function(_this)
			{
				if ( Map.spamnades && Map.rnadehall_bots < 1 && Map.start_of_map && _this.Bot.HasAmmo(WEAPON.AXIS_GRENADE) )
				{
					Map.rnadehall_bots += 1;

					_this.AddAimRequest(Priority.High, "facing", Map.Navigation.rnadehall.wpInfo.facing);
					_this.AddWeaponRequest( WEAPON.AXIS_GRENADE );

					if ( _this.Goto(Map.Navigation.rnadehall.wpInfo.position) == EVENT.PATH_SUCCESS )
					{
						_this.BlockForWeaponChange( WEAPON.AXIS_GRENADE );
						_this.Bot.HoldButton(BTN.ATTACK1, 0.5);
						sleep(1);
					}

					Map.rnadehall_bots -= 1;
					yield();
				}
				else
				{
					sleep(1);
				}

			},
		},

		quickjump =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.JUMP, 0.25);
				sleep(0.25);
			},
		},
	},

	increasebreakabledistS =
	{
		Name = "increasebreakabledistS",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			b = Util.IsBot(ent);
			if (b)
			{
				b.TargetBreakableDist = 570.0;
			}
			Util.MapDebugPrint( GetEntName(ent) + " entering." );
		},
		OnExit = function(ent)
		{
			b = Util.IsBot(ent);
			if (b)
			{
				b.TargetBreakableDist = 0.0;
			}
			Util.MapDebugPrint( GetEntName(ent) + " exiting." );
		},
	},

	increasebreakabledistB =
	{
		Name = "increasebreakabledistB",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			b = Util.IsBot(ent);
			if (b)
			{
				b.TargetBreakableDist = 570.0;
			}
			Util.MapDebugPrint( GetEntName(ent) + " entering." );
		},
		OnExit = function(ent)
		{
			b = Util.IsBot(ent);
			if (b)
			{
				b.TargetBreakableDist = 0.0;
			}
			Util.MapDebugPrint( GetEntName(ent) + " exiting." );
		},
	},

	// path through for allies throwing a/s to assist in stealing tank
	Airstrike =
	{
		tankassist =
		{
			Enabled = true,
			Team = (1<<TEAM.ALLIES),
			Facing = Vector3(-0.601,-0.392,0.696),
			NoPause = false,
			Waypoint = "bTankAS1",
		},
	},

	slopeNodes = function(close)
	{
		for( i = 1; i <= 3; i += 1 ) {
			s = "slope" + i;
			Wp.SetWaypointFlag( s, "closed", close );
		}
	},

	allies_steal_tank = function()
	{
		Map.spamnades = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Depot_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Tank_Barrier1_.*" );
		Map.Airstrike.tankassist.Enabled = false;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Depot_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Tank_Barrier1_.*",
			"CAMP_rTbarrier1_.*",
			"AIRSTRIKE_rTbarrier1_.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Command_Post",
			"PLANT_Command_Post",
			"DEFUSE_Command_Post.*",
			"AIRSTRIKE_rDepot.*",
			"PLANTMINE_rTank.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"MOUNTMG42_Barrier_1",
			"REPAIRMG42_Barrier_1",
			"AMMOCAB_south_ammocabinet_2",
			"HEALTHCAB_south_healthcabinet_2",
		});

		Util.MapDebugPrint( "allies_steal_tank" );
	},

	tank_at_1st_corner = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNTMG42_Depot",
			"REPAIRMG42_Depot",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_Depot",
			"REPAIRMG42_Depot",
			"AMMOCAB_south_ammocabinet_3",
			"HEALTHCAB_south_healthcabinet_3",
		});

		Util.MapDebugPrint( "tank_at_1st_corner" );
	},

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

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

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

		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Destroyed = function()
	{
		Util.SetPositionGoal( "BUILD_Tank", "MOVER_tank" );

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

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

	Truck_Destroyed = function()
	{
		Util.SetPositionGoal( "BUILD_Truck", "MOVER_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, "BUILD_Tank" ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Tank" ); }

		Wp.SetWaypointFlag( "AccessShaft", "closed", false );

		Util.MapDebugPrint("tank_at_barrier1");
	},

	tank_past_barrier1 = function()
	{
		// open these nodes for a more direct path
		Map.slopeNodes(false);

		Map.near_defense_one = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Tank_Barrier2_.*",
			"ATTACK_newbarrier2_.*",
			"PLANT_Tank_Barrier_2",
			"MOUNTMG42_mg42_bridge",
			"REPAIRMG42_mg42_bridge",
			"AIRSTRIKE_bBarrier2.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Tank_Barrier1_.*",
			"BUILD_Command_Post",
			"PLANT_Command_Post",
			"PLANT_Tank_Barrier_1",
			"AMMOCAB_north_ammocabinet",
			"HEALTHCAB_north_healthcabinet",
			"AMMOCAB_south_ammocabinet_1",
			"HEALTHCAB_south_healthcabinet_1",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"AMMOCAB_south_ammocabinet",
			"DEFEND_Tank_Barrier2_.*",
			"BUILD_Tank_Barrier_2",
			"HEALTHCAB_south_healthcabinet",
			"MOUNTMG42_mg42_bridge",
			"REPAIRMG42_mg42_bridge",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Tank_Barrier_1",
			"DEFEND_Tank_Barrier1_.*",
			"CAMP_rTbarrier1_.*",
			"AIRSTRIKE_rTbarrier1_.*",
			"MOUNTMG42_Barrier_1",
			"REPAIRMG42_Barrier_1",
		});

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

		Util.MapDebugPrint( "tank_past_barrier1" );
	},

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

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

		Util.MapDebugPrint( "Tank_Barrier_1_Built" );
	},

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

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

		Util.MapDebugPrint( "Tank_Barrier_1_Destroyed" );
	},

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

		Map.bOneDyno += 1;

		Util.MapDebugPrint("planted_at_Tank_Barrier_1");
	},

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

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

		Util.MapDebugPrint("defused_at_Tank_Barrier_1");
	},

	tank_at_bridge_mg = function()
	{
		Map.at_bridge_mg = true;

		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier_2" );
		Util.MapDebugPrint("tank_at_bridge_mg");
	},

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

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

		// enable the repair routes
		Util.EnableGoal("ROUTE_repair_route.*");
		Util.MapDebugPrint("tank_at_barrier2");
	},

	tank_past_barrier2 = function()
	{
		Map.near_defense_two = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Bank_.*",
			Map.Mount_mg42_bank,
			"REPAIRMG42_mg42_bank",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Tank_Barrier2_.*",
			"ATTACK_newbarrier2_.*",
			"PLANT_Tank_Barrier_2",
			"MOUNTMG42_mg42_bridge",
			"REPAIRMG42_mg42_bridge",
			"AIRSTRIKE_bBarrier2.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"AMMOCAB_south_ammocabinet_2",
			"HEALTHCAB_south_healthcabinet_2",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"MOUNTMG42_mg42_bank",
			"DEFEND_Bank_.*",
			"REPAIRMG42_mg42_bank",
			"BUILD_Truck_Barrier_1",
			"PLANTMINE_rBank.*",
			"CALLARTILLERY_rBank.*",
			"ARTILLERY_S_rBank.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Tank_Barrier2_.*",
			"DEFEND_Bank_[89]",
			"DEFEND_Bank_Roam4",
			"BUILD_Tank_Barrier_2",
			"MOUNTMG42_mg42_bridge",
			"REPAIRMG42_mg42_bridge",
		});

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

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

		// routing isn't super reliable here, and we want allies avoiding south stairs
		Wp.SetWaypointFlag( "southstairs1", "axis", true );
		Wp.SetWaypointFlag( "southstairs3", "axis", true );

		Util.MapDebugPrint( "tank_past_barrier2" );
	},

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

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

		Util.MapDebugPrint( "Tank_Barrier_2_Built" );
	},

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

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

		Util.MapDebugPrint( "Tank_Barrier_2_Destroyed" );
	},

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

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

		Util.MapDebugPrint("planted_at_Tank_Barrier_2");
	},

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

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

		Util.MapDebugPrint("defused_at_Tank_Barrier_2");
	},

	blow_doors = function()
	{
		sleep( 2 );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Tank" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_Truck",
			"FLAG_Gold_Bars",
			"CAPPOINT_Gold_Dropoff",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNT_tank" );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "MOUNTMG42_mg42_bridge" );
		SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_mg42_bank" );
		SetAvailableMapGoals( TEAM.AXIS, false, "REPAIRMG42_Barrier_1" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"REPAIRMG42_mg42_bank",
			"DEFEND_Bank_[89]",
			"DEFEND_Bank_Roam4",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_tank_axis" );

		// let allies use south stairs again
		Wp.SetWaypointFlag( "southstairs1", "axis", false );
		Wp.SetWaypointFlag( "southstairs3", "axis", false );

		Util.MapDebugPrint( "blow_doors" );
	},

	allies_taking_gold = function()
	{
		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"REPAIRMG42_mg42_allied",
			"ESCORT_truck",
			"MOUNTMG42_mg42_allied",
			"ATTACK_Truck_Barrier1_.*",
			"PLANT_Truck_Barrier_1",
			"PLANT_Truck_Barrier_2",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Bank_.*",
			"MOUNTMG42_mg42_bank",
			"REPAIRMG42_mg42_bank",
		});

		Map.TruckLoaded = true;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"REPAIRMG42_mg42_allied",
			"MOUNTMG42_mg42_allied",
			"DEFEND_Truck_Barrier1_.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Bank_.*",
			"MOUNTMG42_mg42_bank",
			"REPAIRMG42_mg42_bank",
			"PLANTMINE_rBank.*",
			"CALLARTILLERY_rBank.*",
			"ARTILLERY_S_rBank.*",
		});

		Util.MapDebugPrint( "allies_taking_gold" );
	},

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

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

		Wp.SetWaypointFlag( "truckmarker1", "closed", true );

		Util.MapDebugPrint("truck_at_barrier1");
	},

	truck_past_barrier1 = function()
	{
		Map.near_defense_three = false;
		Util.ChangeSpawn( TEAM.ALLIES, 3 );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Truck_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"PLANT_Truck_Barrier_1",
			"AMMOCAB_south_ammocabinet_2",
			"HEALTHCAB_south_healthcabinet_2",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"AMMOCAB_south_ammocabinet_1",
			"HEALTHCAB_south_healthcabinet_1",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Truck_Barrier_1" );
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Truck_Barrier_2" );

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

		Wp.SetWaypointFlag( "truckmarker1", "closed", false );

		Util.MapDebugPrint( "truck_past_barrier1" );
	},

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

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

		Util.MapDebugPrint( "Truck_Barrier_1_Built" );
	},

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

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

		Util.MapDebugPrint( "Truck_Barrier_1_Destroyed" );
	},

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

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

		Util.MapDebugPrint("planted_at_Truck_Barrier_1");
	},

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

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

		Util.MapDebugPrint("defused_at_Truck_Barrier_1");
	},

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

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

		Util.MapDebugPrint("truck_at_barrier2");
	},

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

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Escape_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNTMG42_mg42_allied",
			"REPAIRMG42_mg42_allied",
			"PLANT_Truck_Barrier_2",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck_Escape_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_mg42_allied",
			"REPAIRMG42_mg42_allied",
			"BUILD_Truck_Barrier_2",
		});

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

		Util.MapDebugPrint( "truck_past_barrier2" );
	},

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

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

		Util.MapDebugPrint( "Truck_Barrier_2_Built" );
	},

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

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

		Util.MapDebugPrint( "Truck_Barrier_2_Destroyed" );
	},

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

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

		Util.MapDebugPrint("planted_at_Truck_Barrier_2");
	},

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

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

		Util.MapDebugPrint("defused_at_Truck_Barrier_2");
	},

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

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

	vehicle_at_location = function()
	{
		switch(Map.VehicleLocation)
		{
			case 1: // tank
			{
				Map.tank_at_1st_corner();
			}
			case 2:
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_tank_axis" );
				Map.tank_at_barrier1();
			}
			case 3: // bridge hill
			{
				// axis can't get a good aim from here
				SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_tank_axis" );
			}
			case 4:
			{
				Map.tank_at_bridge_mg();
				SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_tank_axis" );

				// allies can come from both sides
				ETUtil.SetAimModeForMount( "MOUNT_tank_axis", "random" );
			}
			case 5:
			{
				Map.tank_at_barrier2();
			}
			case 6: // truck
			{
				Map.truck_at_barrier1();
			}
			case 7:
			{
				Map.truck_at_barrier2();
			}
		}
		Util.MapDebugPrint("vehicle at location " + Map.VehicleLocation, true);
	},
};

global OnMapLoad = function()
{
	Util.SetGoalOffset( 0, 160, 0, "PLANT_Tank_Barrier_1" );
	Util.SetGoalOffset( 0, 174, 0, "PLANT_Tank_Barrier_2" );

	// Adjust tank goal for rebuild
	Util.SetPositionGoal( "BUILD_Tank", "MOVER_tank" );
	Util.SetPositionGoal( "BUILD_Truck", "MOVER_truck" ); //truck too

	// close these waypoints until tank is past barrier
	Map.slopeNodes(true);

	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( "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( "tank at location", Map.vehicle_at_location );
	OnTrigger( "truck at location", Map.vehicle_at_location );

	firstcorner = OnTriggerRegion(AABB(641.330,1526.699,184.529,952.875,1677.401,267.442), RegionTrigger.VehicleTrigger);
	barrier1 = OnTriggerRegion(AABB(660.253,828.462,59.548,960.874,1040.700,173.040), RegionTrigger.VehicleTrigger);
	bridgehill = OnTriggerRegion(AABB(2151.544,-64.875,-147.159,2313.876,184.875,-36.052), RegionTrigger.VehicleTrigger);
	bridgemg = OnTriggerRegion(AABB(2223.261,938.122,-416.814,2471.191,1218.338,-342.679), RegionTrigger.VehicleTrigger);
	barrier2 = OnTriggerRegion(AABB(1656.194,493.729,-416.801,2034.268,726.966,-337.425), RegionTrigger.VehicleTrigger);
	barrier3 = OnTriggerRegion(AABB(480.061,-720.472,-332.313,634.705,-478.740,-222.440), RegionTrigger.VehicleTrigger);
	barrier4 = OnTriggerRegion(AABB(-1818.902,-1406.621,-47.144,-1658.912,-1076.801,37.125), RegionTrigger.VehicleTrigger);

	SideJump = OnTriggerRegion( AABB(447.233,-436.875,-54.875,858.853,-271.125,114.482), Map.increasebreakabledistS );
	BankEnt = OnTriggerRegion( AABB(1399.125,-2560.245,-374.875,1982.150,-2004.758,-248.875), Map.increasebreakabledistB );

	// when tank is between barrier 2 and final spot, force allies anywhere but south stairs
	Wp.SetWaypointFlag( "southstairs1", "axis", false );
	Wp.SetWaypointFlag( "southstairs3", "axis", false );

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

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsersInProgress( 2, "DEFEND_Bank_Roam.*" );
	Util.SetMaxUsersInProgress( 2, "DEFEND_Tank_Barrier2_Roam.*" );
	Util.SetMaxUsers( 1, "CAMP_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "MOUNT_tank.*" );

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=10, MaxCampTime=30});
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=15, MaxCampTime=20});
	SetMapGoalProperties( "DEFEND_Bank_Roam.*", {MinCampTime=1, MaxCampTime=2});
	SetMapGoalProperties( "DEFEND_Tank_Barrier2_Roam.*", {MinCampTime=1, MaxCampTime=2});
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=45, MaxCampTime=90});
	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 );
	SetGoalPriority( "DEFEND_Bank_Roam.*", 0.49 );
	SetGoalPriority( "DEFEND_Tank_Barrier2_Roam.*", 0.49 );


	// Allied goals
	SetGoalPriority( "FLAG_Gold_Bars", 0.92, TEAM.ALLIES );
	SetGoalPriority( "CAPPOINT_Gold_Dropoff", 0.92, TEAM.ALLIES );
	SetGoalPriority( "BUILD_Tank", 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Command_Post", 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Tank_Barrier_1", 0.84, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Tank_Barrier_2", 0.83, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Truck_Barrier_1", 0.82, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Truck_Barrier_2", 0.81, TEAM.ALLIES, CLASS.ENGINEER );

	// Axis goals
	SetGoalPriority( "PLANTMINE_rTank2", 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Tank_Barrier_1", 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Command_Post", 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Tank_Barrier_2", 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Truck_Barrier_1", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Command_Post", 0.0, TEAM.AXIS, CLASS.ENGINEER );

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

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"AMMOCAB_north_ammocabinet",
		"HEALTHCAB_north_healthcabinet",
		"AMMOCAB_south_ammocabinet_1",
		"HEALTHCAB_south_healthcabinet_1",
		"AMMOCAB_south_ammocabinet_3",
		"HEALTHCAB_south_healthcabinet_3",
		"BUILD_Tank",
		"PLANT_Tank_Barrier_1",
		"PLANT_Tank_Barrier_2",
		"MOUNT_tank",
		"PLANT_Command_Post",
		"ATTACK_Depot.*",
		"MOUNTMG42_Depot",
		"REPAIRMG42_Depot",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"BUILD_Tank_Barrier_1",
		"BUILD_Command_Post",
		"PLANT_Command_Post",
		"DEFEND_Depot.*",
		"AIRSTRIKE_rDepot.*",
		"PLANTMINE_rTank.*",
		"MOUNTMG42_Depot",
		"REPAIRMG42_Depot",
		"AMMOCAB_south_ammocabinet_3",
		"HEALTHCAB_south_healthcabinet_3",
	});

	Wp.SetWaypointFlag( "truckmarker1", "closed", false );
	Wp.SetWaypointFlag( "AccessShaft", "closed", true );

	//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 =
				{
					Weight = 2,
					ROUTE_repair_route_bridge2 =
					{
						ROUTE_repair_route_bridge3 = {},
					}
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_repair_route_stairs = {},
				ROUTE_repair_route_bridge1 =
				{
					Weight = 2,
					ROUTE_repair_route_bridge2 =
					{
						ROUTE_repair_route_bridge3 = {},
					}
				},
			},
		},
		PLANT_Tank_Barrier_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_depotflank = {},
				ROUTE_depotflank2 = {},
				ROUTE_as_rightsplit1 = {},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_depotflank = {},
				ROUTE_depotflank2 = {},
				ROUTE_as_rightsplit1 = {},
			},
		},
		PLANT_Tank_Barrier_2 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					Weight = 3,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
		},
		ATTACK_Tank_Barrier2_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					Weight = 3,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_trb1_stairs = { Weight = 2, ROUTE_b2flank = {}, },
				ROUTE_cp_stairs = {},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					Weight = 2,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_trb1_stairs = { Weight = 2, ROUTE_b2flank = {}, },
				ROUTE_cp_stairs = {},
			},
		},
		ATTACK_newbarrier2_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs = { ROUTE_b2flank = {}, },
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs = { 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 = {}, },
		},
		FLAG_Gold_Bars =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs =
				{
					Weight = 2,
					ROUTE_westbank =
					{
						ROUTE_bankfront = {},
						ROUTE_westbank2 = { ROUTE_bankback = {}, },
					},
				},
				ROUTE_cp_stairs = { ROUTE_cp_stairs2 = {}, },
				ROUTE_southstairs = {},
			},
			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 = {},
			},
		},
		MOUNTMG42_mg42_bridge =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r = {},
				ROUTE_axisspawn_l = {},
			},
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					Weight = 3,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
		},
		BUILD_Tank_Barrier_1 =
		{
			ROUTE_TankYardSpawn  =
			{
				ROUTE_TankYardSpawn2  =
				{
					ROUTE_depotflank  =
					{
					},
					ROUTE_depotflank2  =
					{
					},
				},
			},
		},

	};

	//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.MOUNT_tank = 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_3 = 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.AIRSTRIKE_bBarrier2_1 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.AIRSTRIKE_bBarrier2_2 = 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_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_Bank_11 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_12 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_13 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_14 = 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.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};
