/********************************************************
Script and waypoints made by  >WES< P!NNAN & >WES< GRANNY
********************************************************/

//cs: artillery goals need looked at. they were so far off i couldn't tell what the intent was, so i commented out a bunch
// use /bot tracearty or /bot tracearty all to see the problems

//bub: updated so engineers will not focus on buildig tank barriers until group 4
//     changed one-way connection to two-way at command post health/ammo cabinets so bots can leave the area

global Map =
{

	Debug = false,
	Quiet = true,
	//set Talk to false if you don't want the Allied bots to cheer after winning:
	Talk = true,

	Ammo_Cabinet_north_ammocabinet = "AMMOCAB_north_ammocabinet",
	Ammo_Cabinet_north_ammocabinet_1 = "AMMOCAB_north_ammocabinet_1",
	Ammo_Cabinet_north_ammocabinet_2 = "AMMOCAB_north_ammocabinet_2",
	Health_Cabinet_north_healthcabinet = "HEALTHCAB_north_healthcabinet",
	Health_Cabinet_north_healthcabinet_1 = "HEALTHCAB_north_healthcabinet_1",
	Health_Cabinet_north_healthcabinet_2 = "HEALTHCAB_north_healthcabinet_2",
	Call_Artillery_ar_call_1 = "CALLARTILLERY_ar_call_1",
	Call_Artillery_ar_call_2 = "CALLARTILLERY_ar_call_2",
	Call_Artillery_ar_call_3 = "CALLARTILLERY_ar_call_3",
	Call_Artillery_ar_call_4 = "CALLARTILLERY_ar_call_4",
	Call_Artillery_ar_call_5 = "CALLARTILLERY_ar_call_5",
	Call_Artillery_ar_call_6 = "CALLARTILLERY_ar_call_6",
	Call_Artillery_ar_call_7 = "CALLARTILLERY_ar_call_7",
	Artillery_S_ar_tank_0 = "ARTILLERY_S_ar_tank_0",
	Artillery_S_ar_tank_1 = "ARTILLERY_S_ar_tank_1",
	Artillery_S_ar_tank_10 = "ARTILLERY_S_ar_tank_10",
	Artillery_S_ar_tank_11 = "ARTILLERY_S_ar_tank_11",
	Artillery_S_ar_tank_12 = "ARTILLERY_S_ar_tank_12",
	Artillery_S_ar_tank_2 = "ARTILLERY_S_ar_tank_2",
	Artillery_S_ar_tank_3 = "ARTILLERY_S_ar_tank_3",
	Artillery_S_ar_tank_4 = "ARTILLERY_S_ar_tank_4",
	Artillery_S_ar_tank_5 = "ARTILLERY_S_ar_tank_5",
	Artillery_S_ar_tank_6 = "ARTILLERY_S_ar_tank_6",
	Artillery_S_ar_tank_7 = "ARTILLERY_S_ar_tank_7",
	Artillery_S_ar_tank_8 = "ARTILLERY_S_ar_tank_8",
	Artillery_S_ar_tank_9 = "ARTILLERY_S_ar_tank_9",
	Checkpoint_flag1 = "CHECKPOINT_flag1",
	Flag_gold = "FLAG_gold",
	Cappoint_Dropoff = "CAPPOINT_Dropoff",
	Build_Canyon_Rope_Bridge = "BUILD_Canyon_Rope_Bridge",
	Build_Command_Post = "BUILD_Command_Post",
	Build_Escape_caves_scaffolding = "BUILD_Escape_caves_scaffolding",
	Build_Tank = "BUILD_Tank",
	Build_Tank_Barrier = "BUILD_Tank_Barrier",
	Build_Tank_Barrier_1 = "BUILD_Tank_Barrier_1",
	Build_Tank_Bridge = "BUILD_Tank_Bridge",
	Build_Temple_MG_Nest = "BUILD_Temple_MG_Nest",
	Build_temple_wooden_barrier = "BUILD_temple_wooden_barrier",
	Plant_Canyon_Rope_Bridge = "PLANT_Canyon_Rope_Bridge",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_Escape_caves_scaffolding = "PLANT_Escape_caves_scaffolding",
	Plant_Tank_Barrier = "PLANT_Tank_Barrier",
	Plant_Tank_Barrier_1 = "PLANT_Tank_Barrier_1",
	Plant_Tank_Bridge = "PLANT_Tank_Bridge",
	Plant_Temple_MG_Nest = "PLANT_Temple_MG_Nest",
	Plant_floor_breach_to_the_escape_caves = "PLANT_floor_breach_to_the_escape_caves",
	Plant_temple_caves_access_breach = "PLANT_temple_caves_access_breach",
	Plant_temple_corridor_wall_crack = "PLANT_temple_corridor_wall_crack",
	Plant_temple_wooden_barrier = "PLANT_temple_wooden_barrier",
	Mount_1192 = "MOUNTMG42_1192",
	Mount_1417 = "MOUNTMG42_1417",
	Mount_1515 = "MOUNTMG42_1515",
	Mount_Temple_MG_Nest = "MOUNTMG42_Temple_MG_Nest",
	Repair_1192 = "REPAIRMG42_1192",
	Repair_1417 = "REPAIRMG42_1417",
	Repair_1515 = "REPAIRMG42_1515",
	Repair_Temple_MG_Nest = "REPAIRMG42_Temple_MG_Nest",
	Mobile_MG42_mg_obj_1 = "MOBILEMG42_mg_obj_1",
	Mobile_MG42_mg_obj_2 = "MOBILEMG42_mg_obj_2",
	Mobile_MG42_mg_obj_3 = "MOBILEMG42_mg_obj_3",
	Snipe_s_axisspawn_1 = "SNIPE_s_axisspawn_1",
	Snipe_s_axisspawn_2 = "SNIPE_s_axisspawn_2",
	Snipe_s_axisspawn_3 = "SNIPE_s_axisspawn_3",
	Snipe_s_bridge_1 = "SNIPE_s_bridge_1",
	Snipe_s_bridge_2 = "SNIPE_s_bridge_2",
	Mover_tank = "MOVER_tank",

	//Tank stuff
	Tank_Built = function( trigger )
	{
		Util.MapDebugPrint( "Tank_Built" );
	},

	tank_leaves_artyarea1 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_1" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_2" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_1" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_2" );

		Util.MapDebugPrint( "Tank leaves area 1");
	},

	tank_leaves_artyarea2 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_2" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_3" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_2" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_3" );

		Util.MapDebugPrint( "Tank leaves area 2");
	},

	tank_leaves_artyarea3 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_3" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_4" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_3" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_4" );

		Util.MapDebugPrint( "Tank leaves area 3");
	},

	tank_leaves_artyarea4 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_4" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_5" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_4" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_5" );

		Util.MapDebugPrint( "Tank leaves area 4");
	},

	tank_leaves_artyarea5 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_5" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_6" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_5" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_6" );

		Util.MapDebugPrint( "Tank leaves area 5");
	},

	tank_leaves_artyarea6 = function( trigger )
	{
		Groups.DisableAllies(Groups.group1);
		Groups.DisableAxis(Groups.group2);
		Groups.EnableAllies(Groups.group3);
		Groups.EnableAxis(Groups.group4);

		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_6" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_7" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_6" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_7" );

		Util.MapDebugPrint( "Tank leaves area 6");
	},

	tank_leaves_artyarea7 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_7" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_8" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_7" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_8" );

		Util.MapDebugPrint( "Tank leaves area 7");
	},

	tank_leaves_artyarea8 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_8" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_9" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_8" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_9" );

		Util.MapDebugPrint( "Tank leaves area 8");
	},

	tank_leaves_artyarea9 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_9" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_10" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_9" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_10" );

		Util.MapDebugPrint( "Tank leaves area 9");
	},

	tank_leaves_artyarea10 = function( trigger )
	{
		Groups.DisableAllies(Groups.group3);
		Groups.DisableAxis(Groups.group4);
		Groups.EnableAllies(Groups.group5);
		Groups.EnableAxis(Groups.group6);

		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_fort_.*" );

		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Call_Artillery_ar_call_10" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Call_Artillery_ar_call_11" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Map.Artillery_S_ar_tank_10" );
		//SetAvailableMapGoals( TEAM.AXIS, true, "Map.Artillery_S_ar_tank_end" );

		Util.MapDebugPrint( "Tank leaves area 10");
	},

	tank_reaches_artyarea11 = function( trigger )
	{
		Groups.DisableAllies(Groups.group5);
		Groups.DisableAxis(Groups.group6);
		Groups.EnableAllies(Groups.group7);
		Groups.EnableAxis(Groups.group8);

		Util.MapDebugPrint( "Tank reaches area 11");
	},

	//Ropebridge
	Canyon_Rope_Bridge_Built = function( trigger )
	{
		Util.MapDebugPrint( "Canyon_Rope_Bridge_Built" );
	},

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

	//Tankbridge
	Tank_Bridge_Built = function( trigger )
	{
		Util.MapDebugPrint( "Tank_Bridge_Built" );
	},

	fueldump_allies_bridge_reinforce = function( trigger)
	{
		Map.Bridge = "true";
		Util.SetGoalOffset( 1475, -450, 0, Map.Build_Tank_Bridge );

		// cs: disable the ha cabinets so the bots aren't constantly backtracking
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Ammo_Cabinet_north_ammocabinet_2,
			Map.Health_Cabinet_north_healthcabinet_2,
		});

		// cs: disable / re-enable so the bots will repath
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank_Bridge );
		sleep(1);
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank_Bridge );

		Util.MapDebugPrint( "Goal moved");
	},

	Tank_Bridge_Destroyed = function( trigger )
	{
		//Map.Bridgestatus = "false";

		//if ( Map.Bridge == "true" )
		//{ Util.SetGoalOffset( 1000, 0, 0, Map.Build_Tank_Bridge ); }

		Util.MapDebugPrint( "Tank_Bridge_Destroyed" );
	},

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

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

	//Barriers
	Tank_Barrier_Built = function( trigger )
	{
		Util.MapDebugPrint( "Tank_Barrier_Built" );
	},

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

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

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

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

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

	//Cavestuff
	Escape_caves_scaffolding_Built = function( trigger )
	{
		Util.MapDebugPrint( "Escape_caves_scaffolding_Built" );
	},

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

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

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

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


	//MG stuff
	Temple_MG_Nest_Built = function( trigger )
	{
		Util.MapDebugPrint( "Temple_MG_Nest_Built" );
	},

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

	//Gold stuff
	gold_Taken = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_obj.*" );
		Groups.DisableAxis(Groups.group8);
		Groups.EnableAxis(Groups.group9);
		Groups.EnableAllies(Groups.group10);

		Util.MapDebugPrint( "gold_Taken" );
	},

	gold_Returned = function( trigger )
	{
		Groups.DisableAxis(Groups.group9);
		Groups.EnableAxis(Groups.group8);
		Groups.DisableAllies(Groups.group10);
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_a_obj.*" );

		Util.MapDebugPrint( "gold_Returned" );
	},

	Dropoff_Captured = function( trigger )
	{
		ETUtil.WinningChat( TEAM.ALLIES );
		ETUtil.LosingChat( TEAM.AXIS );
		Util.MapDebugPrint( "Dropoff_Captured" );
	},

	//Checkpoint
	flag1_Axis_Captured = function( trigger )
	{
		Util.MapDebugPrint( "flag1_Axis_Captured" );
	},

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

	Tank_Damaged = function( trigger )
	{
		Util.SetPositionGoal( "BUILD_Tank", "MOVER_tank" );
		Util.MapDebugPrint( "tank_damaged" );
	},

	tank_at_location = function( trigger )
	{
		switch(Map.VehicleLocation)
		{
			case 1: { Map.tank_leaves_artyarea1(); }
			case 2: { Map.tank_leaves_artyarea2(); }
			case 3: { Map.tank_leaves_artyarea3(); }
			case 4: { Map.tank_leaves_artyarea4(); }
			case 5: { Map.tank_leaves_artyarea5(); }
			case 6: { Map.tank_leaves_artyarea6(); }
			case 7: { Map.tank_leaves_artyarea7(); }
			case 8: { Map.tank_leaves_artyarea8(); }
			case 9: { Map.tank_leaves_artyarea9(); }
			case 10: { Map.tank_leaves_artyarea10(); }
			case 11: { Map.tank_reaches_artyarea11(); }
		}

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

	tank_reached_command_post_area = function( trigger )
	{

		Util.MapDebugPrint( "tank_reached_command_post_area" );
	},

	tank_passed_first_barrier = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_barrier1_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_a_fort_.*" );

		Util.MapDebugPrint( "tank_passed_first_barrier" );
	},

};

global OnMapLoad = function()
{
	OnTrigger( "the canyon rope bridge has been constructed", Map.Canyon_Rope_Bridge_Built );
	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 escape tunnels' scaffolding has been constructed", Map.Escape_caves_scaffolding_Built );
	OnTrigger( "The Tank has been repaired!", Map.Tank_Built );
	OnTrigger( "Tank Barrier #1 has been constructed.", Map.Tank_Barrier_Built );
	OnTrigger( "Tank Barrier #2 has been constructed.", Map.Tank_Barrier_1_Built );
	OnTrigger( "The Canyon main bridge has been constructed", Map.Tank_Bridge_Built );
	OnTrigger( "Temple MG42 Nest constructed.", Map.Temple_MG_Nest_Built );
	OnTrigger( "the temple wooden barrier has been contructed", Map.temple_wooden_barrier_Built );
	OnTrigger( "the canyon rope bridge has been destroyed", Map.Canyon_Rope_Bridge_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "the escape tunnels' scaffolding has been destroyed", Map.Escape_caves_scaffolding_Destroyed );
	OnTrigger( "Tank Barrier #1 has been destroyed.", Map.Tank_Barrier_Destroyed );
	OnTrigger( "Tank Barrier #2 has been destroyed.", Map.Tank_Barrier_1_Destroyed );
	OnTrigger( "the canyon main bridge has been destroyed", Map.Tank_Bridge_Destroyed );
	OnTrigger( "Temple MG42 Nest destroyed.", Map.Temple_MG_Nest_Destroyed );
	OnTrigger( "Allies have breached the floor access to the caves!!!!", Map.floor_breach_to_the_escape_caves_Destroyed );
	OnTrigger( "Allies have breached the wall access to the caves!!!!", Map.temple_caves_access_breach_Destroyed );
	OnTrigger( "Allies have breached the temple corridor wall!!!!", Map.temple_corridor_wall_crack_Destroyed );
	OnTrigger( "the temple wooden barrier has been destroyed", Map.temple_wooden_barrier_Destroyed );
	OnTrigger( "Allies have stolen the gold crate!!!!", Map.gold_Taken );
	OnTrigger( "The gold crate has been returned!!!!", Map.gold_Returned );
	OnTrigger( "Allies have escaped with the gold crate", Map.Dropoff_Captured );
	OnTrigger( "^3Axis have reclaimed the church ruins", Map.flag1_Axis_Captured );
	OnTrigger( "^3Allies have captured the church ruins", Map.flag1_Allies_Captured );
	OnTrigger( "fueldump_allies_bridge_reinforce", Map.fueldump_allies_bridge_reinforce );
	OnTrigger( "The Tank has been damaged!", Map.Tank_Damaged );
	OnTrigger( "tank at location", Map.tank_at_location );
	OnTrigger( "The tank has reached the command post area", Map.tank_reached_command_post_area );
	OnTrigger( "the tank has passed the first barrier", Map.tank_passed_first_barrier );

	//set up a positional trigger for the tank
	l1 = OnTriggerRegion(AABB(3189.990,6417.613,982.043,3386.819,6738.422,1084.557), RegionTrigger.VehicleTrigger);
	l2 = OnTriggerRegion(AABB(3653.701,6030.951,986.514,3870.060,6387.173,1089.107), RegionTrigger.VehicleTrigger);
	l3 = OnTriggerRegion(AABB(5767.228,5985.970,977.775,5869.293,6257.436,1054.645), RegionTrigger.VehicleTrigger);
	l4 = OnTriggerRegion(AABB(5800.500,7070.501,965.979,6125.702,7234.107,1058.058), RegionTrigger.VehicleTrigger);
	l5 = OnTriggerRegion(AABB(5877.639,8179.885,968.376,6245.405,8361.523,1060.533), RegionTrigger.VehicleTrigger);
	l6 = OnTriggerRegion(AABB(6903.821,9323.481,1106.999,7091.187,9704.563,1218.672), RegionTrigger.VehicleTrigger);
	l7 = OnTriggerRegion(AABB(9869.163,9676.038,1183.765,9975.956,10092.193,1268.516), RegionTrigger.VehicleTrigger);
	l8 = OnTriggerRegion(AABB(10659.021,8049.334,1079.236,11113.450,8229.253,1217.644), RegionTrigger.VehicleTrigger);
	l9 = OnTriggerRegion(AABB(9992.446,7552.380,1113.252,10370.374,7806.219,1230.113), RegionTrigger.VehicleTrigger);
	l10 = OnTriggerRegion(AABB(10901.037,4563.480,1084.337,11311.856,4787.485,1214.861), RegionTrigger.VehicleTrigger);
	l11 = OnTriggerRegion(AABB(8220,3466,1328,8207,3679,1356), RegionTrigger.VehicleTrigger);

	//position of some Goals for better reaching
	Util.SetGoalOffset( -25, 0, 0, "BUILD_Tank_Bridge" );
	Util.SetGoalOffset( 25, 0, -75, "PLANT_temple_wooden_barrier" );
	Util.SetGoalOffset( 0, -20, 0, "PLANT_temple_corridor_wall_crack" );
	Util.SetGoalOffset( 20, -40, 0, "PLANT_Tank_Barrier_1" );

	//set max users for goals
	Util.SetMaxUsersInProgress( 2, "BUILD.*" );
	Util.SetMaxUsersInProgress( 2, "PLANT.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_d_barrier1.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_a_barrier1.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_d_barrier2.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_a_barrier2.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_d_flag.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_a_flag.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_d_obj.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_a_obj.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_d_gold.*" );
	Util.SetMaxUsersInProgress( 1, "MOUNTMG42.*" );
	Util.SetMaxUsersInProgress( 3, "MOUNT_tank" );

	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=999, MaxCampTime=9999});
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=30, MaxCampTime=120});
	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=10, MaxCampTime=40});
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=120, MaxCampTime=120});

	// cs: set these as slightly higher priority so allies will favor assisting doc run
	SetGoalPriority( "ATTACK_.*", 0.49, TEAM.ALLIES );
	SetGoalPriority( "ATTACK_a_gold.*", 0.50, TEAM.ALLIES );
	SetGoalPriority( "BUILD_Canyon_Rope_Bridge", 0.89, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "DEFUSE_Tank_Bridge_.*", 1.10, TEAM.ALLIES, CLASS.ENGINEER, true );

	// bub: set priority to build tank barriers, first by CP, then by temple
	SetGoalPriority( "BUILD_.*", 0.88, TEAM.AXIS );
	SetGoalPriority( "BUILD_Tank_Barrier", 0.90, TEAM.AXIS );
	SetGoalPriority( "BUILD_temple_wooden_barrier", 0.90, TEAM.AXIS );
	SetGoalPriority( "BUILD_Tank_Barrier_1", 0.89, TEAM.AXIS );
	SetGoalPriority( "DEFUSE_temple_wooden_barrier_.*", 1.25, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_Tank_Barrier_.*", 1.15, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_Tank_Barrier_1_.*", 1.10, TEAM.AXIS, CLASS.ENGINEER, true );

	SetAvailableMapGoals( TEAM.AXIS, false, ".*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );

	Util.EnableGoal("ROUTE.*"); //enable routing for both teams

	//enable part 1 goals
	Groups.EnableAllies(Groups.group1);
	Groups.EnableAxis(Groups.group2);

	//Routes
	MapRoutes =
	{
		PLANT_temple_wooden_barrier =
		{
			ROUTE_r_alliedspawn_4 =
			{
				ROUTE_r_corridorwall = { ROUTE_r_leftway = {}, },
				ROUTE_r_al_exit_4 =
				{
					ROUTE_r_middlegate = { ROUTE_r_rightway = {}, },
				},
			},
		},
		CAPPOINT_Dropoff =
		{
			ROUTE_r_Gold =
			{
				ROUTE_r_escapewall =
				{
					ROUTE_r_escape_split_1 =
					{
						ROUTE_r_righttunnel_1 =
						{
							ROUTE_r_escape_split_2 =
							{
								ROUTE_r_ladder = {},
								ROUTE_r_ladder_2 = {},
							},
						},
						ROUTE_r_lefttunnel ={},
					},
				},
				ROUTE_r_rightway =
				{
					ROUTE_r_hole = { ROUTE_r_escape_split_1 = {}, },
					ROUTE_r_middlegate = { ROUTE_r_tankexit = {}, },
				},
			},
		},
	};

	//copying some routes
	MapRoutes.FLAG_gold = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_1 = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_2 = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_3 = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_4 = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_5 = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_6 = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_7 = MapRoutes.PLANT_temple_wooden_barrier;
	MapRoutes.ATTACK_a_obj_8 = MapRoutes.PLANT_temple_wooden_barrier;

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


global Groups =
{
	//Allied part 1
	group1 =
	{
		Map.Build_Tank,
		"MOUNT_tank",
		Map.Build_Tank_Bridge,
		Map.Build_Canyon_Rope_Bridge,
		Map.Checkpoint_flag1,
		Map.Snipe_s_bridge_1,
		Map.Snipe_s_bridge_2,
		"ATTACK_a_bridge_.*",
		"ATTACK_a_flag_.*",
		Map.Mount_1417,
		Map.Repair_1417,
		Map.Ammo_Cabinet_north_ammocabinet_2,
		Map.Health_Cabinet_north_healthcabinet_2,
	},

	//Axis part 1
	group2 =
	{
		Map.Ammo_Cabinet_north_ammocabinet,
		Map.Health_Cabinet_north_healthcabinet,
		//"MOBILEMORTAR_m_axis_.*", // cs: this doesn't exist
		Map.Build_Tank_Barrier,
		Map.Plant_Canyon_Rope_Bridge,
		Map.Plant_Tank_Bridge,
		Map.Checkpoint_flag1,
		Map.Call_Artillery_ar_call_1,
		Map.Artillery_S_ar_tank_2,
		Map.Snipe_s_axisspawn_1,
		Map.Snipe_s_axisspawn_2,
		Map.Snipe_s_axisspawn_3,
		"DEFEND_d_flag.*",
	},

	//Allied part 2
	group3 =
	{
		"MOUNT_tank",
		Map.Build_Tank,
		Map.Plant_Tank_Barrier,
		"ATTACK_a_barrier1.*",
		Map.Ammo_Cabinet_north_ammocabinet,
		Map.Health_Cabinet_north_healthcabinet,
	},

	//Axis part 2
	group4 =
	{
		Map.Build_Tank_Barrier,
		Map.Build_Tank_Barrier_1,
		Map.Build_Temple_MG_Nest,
		"DEFEND_d_barrier1.*",
		Map.Mount_1515,
		Map.Repair_1515,
	},

	//Allied part 3
	group5 =
	{
		"MOUNT_tank",
		Map.Build_Tank,
		"ATTACK_a_barrier2.*",
		Map.Plant_Tank_Barrier_1,
		Map.Plant_Temple_MG_Nest,
	},

	//Axis part 3
	group6 =
	{
		"DEFEND_d_barrier2.*",
		Map.Build_Tank_Barrier_1,
		Map.Mount_Temple_MG_Nest,
		Map.Repair_Temple_MG_Nest,
		Map.Mount_1192,
		Map.Repair_1192,
	},

	//Allied part 4
	group7 =
	{
		"ATTACK_a_obj.*",
		Map.Ammo_Cabinet_north_ammocabinet_1,
		Map.Health_Cabinet_north_healthcabinet_1,
		Map.Plant_floor_breach_to_the_escape_caves,
		Map.Plant_temple_caves_access_breach,
		Map.Plant_temple_corridor_wall_crack,
		Map.Plant_temple_wooden_barrier,
		Map.Build_Escape_caves_scaffolding,
		Map.Flag_gold,
		Map.Cappoint_Dropoff,
	},

	//Axis part4
	group8 =
	{
		"DEFEND_d_obj.*",
		Map.Build_temple_wooden_barrier,
		Map.Plant_Escape_caves_scaffolding,
		Map.Mobile_MG42_mg_obj_1,
		Map.Mobile_MG42_mg_obj_2,
		Map.Mobile_MG42_mg_obj_3,
	},

	//Axis defend tank after gold is taken
	group9 =
	{
		"DEFEND_d_gold.*",
		Map.Mount_1192,
		Map.Repair_1192,
	},

	// Allies for assisting in doc run
	group10 =
	{
		"ATTACK_a_gold.*",
	},

	EnableAllies = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, goal );
			Util.MapDebugPrint("EnableAllies: enabling " + goal, true);
		}
	},

	EnableAxis = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.AXIS, true, goal );
			Util.MapDebugPrint("EnableAxis: enabling " + goal, true);
		}
	},

	DisableAllies = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, goal );
			Util.MapDebugPrint("DisableAllies: disabling " + goal, true);
		}
	},

	DisableAxis = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, goal );
			Util.MapDebugPrint("DisableAxis: disabling " + goal, true);
		}
	},
};
