global Map =
{
	Ammo_Cabinet_objhacab2 = "AMMOCAB_objhacab2",
	Ammo_Cabinet_objhacab3 = "AMMOCAB_objhacab3",
	Health_Cabinet_objhacab1 = "HEALTHCAB_objhacab1",
	Health_Cabinet_objhacab4 = "HEALTHCAB_objhacab4",
	Checkpoint_roadbunker = "CHECKPOINT_roadbunker",
	Flag_radarbox1 = "FLAG_radarbox1",
	Flag_radarbox2 = "FLAG_radarbox2",
	Cappoint_Radar_Dropoff = "CAPPOINT_Radar_Dropoff",
	Build_Axis_Road_MG_Nest = "BUILD_Axis_Road_MG_Nest",
	Build_Axis_Watchtower_MG_Nest = "BUILD_Axis_Watchtower_MG_Nest",
	Build_Bunker_MG_Nest = "BUILD_Bunker_MG_Nest",
	Build_Command_Post = "BUILD_Command_Post",
	Plant_Axis_Road_MG_Nest = "PLANT_Axis_Road_MG_Nest",
	Plant_Axis_Watchtower_MG_Nest = "PLANT_Axis_Watchtower_MG_Nest",
	Plant_Bunker_MG_Nest = "PLANT_Bunker_MG_Nest",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_Main_Entrance = "PLANT_Main_Entrance",
	Plant_Side_Entrance = "PLANT_Side_Entrance",
	Mount_Allied_Spawn_MG = "MOUNTMG42_Allied_Spawn_MG",
	Mount_Axis_Road_MG_Nest = "MOUNTMG42_Axis_Road_MG_Nest",
	Mount_Axis_Watchtower_MG_Nest = "MOUNTMG42_Axis_Watchtower_MG_Nest",
	Mount_Bunker_MG_Nest = "MOUNTMG42_Bunker_MG_Nest",
	Mount_CP_Bunker_MG = "MOUNTMG42_CP_Bunker_MG",
	Repair_Allied_Spawn_MG = "REPAIRMG42_Allied_Spawn_MG",
	Repair_Axis_Road_MG_Nest = "REPAIRMG42_Axis_Road_MG_Nest",
	Repair_Axis_Watchtower_MG_Nest = "REPAIRMG42_Axis_Watchtower_MG_Nest",
	Repair_Bunker_MG_Nest = "REPAIRMG42_Bunker_MG_Nest",
	Repair_CP_Bunker_MG = "REPAIRMG42_CP_Bunker_MG",

	//set status's for conditionals
	MainDoorStatus = 0, //intact
	SideDoorStatus = 0,
	EastPartsStatus = 0, //0 home, 1 stolen, 2 secured
	WestPartsStatus = 0,
	CPStatus = 0, //not allies
	AxisShiftedToParts = 0, // still in bunker defense

	//dyno counters
	MainDyno = 0,
	SideDyno = 0,

	FirstAxisEng = null,

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

	Roles =
	{
		// split the defense into east and west teams. anything past 8 bots will use
		// more aggressive roaming positions
		AXIS =
		{
			AllBots = true,
			DEFENDER2 = // west
			{
				crucialClass = CLASS.ENGINEER, // for mines
				numbots = 4,
			},
			DEFENDER1 = // east
			{
				crucialClass = CLASS.ENGINEER, // for mines
				numbots = 4,
			},
		},
		// up to 5 allies will spawn at cp
		ALLIES =
		{
			ATTACKER2 = // west
			{
				numbots = 5,
			},
		},
	},

	Axis_Road_MG_Nest_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Mount_Axis_Road_MG_Nest,
			Map.Repair_Axis_Road_MG_Nest,
		});

		if ( Map.MainDoorStatus == 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				Map.Mount_Axis_Road_MG_Nest,
				Map.Repair_Axis_Road_MG_Nest,
			});
		}

		Util.MapDebugPrint( "Axis_Road_MG_Nest_Built" );
	},

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

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

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

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

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

	Allied_Command_Post_Built = function( trigger )
	{
		Map.CPStatus = 1;

		Util.ChangeSpawnForRole( TEAM.ALLIES, ROLE.ATTACKER2, 1 );
		Util.DisableGoal("ROUTE_cpassist");

		Util.DisableGroup( "cpdefense", TEAM.AXIS );
		Map.ShiftAxisToParts();

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Axis_Command_Post_Built = function( trigger )
	{
		if ( Map.FirstAxisEng && !Map.AxisShiftedToParts ) {
			Map.FirstAxisEng.ChangeSpawnPoint(3);
		}

		Util.MapDebugPrint( "axis_radio_built_Built" );
	},

	Command_Post_Destroyed = function( trigger )
	{
		Map.CPStatus = 0;

		if ( Map.SideDoorStatus == 1 )
			{ Util.EnableGoal("ROUTE_cpassist"); }

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

	Main_Entrance_Destroyed = function( trigger )
	{
		Map.MainDoorStatus = 1;

		SetAvailableMapGoals( 0, false, "CHECKPOINT.*" );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Main_Door_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Radar_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Main_Entrance );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Flag_radarbox1,
			Map.Flag_radarbox2,
			Map.Cappoint_Radar_Dropoff,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Build_Bunker_MG_Nest,
			Map.Mount_Bunker_MG_Nest,
			Map.Repair_Bunker_MG_Nest,
			Map.Plant_Bunker_MG_Nest,
		});

		// Axis goals
		Map.ShiftAxisToParts();
		Util.MapDebugPrint( "Main_Entrance_Destroyed" );
	},

	Planted_Main = function( trigger )
	{
		if ( TestMap || Map.CPStatus == 1 )
			{ return; }

		Map.MainDyno += 1;

		if ( !Map.AxisShiftedToParts ) {
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rMainDefuseAssist.*" );
		}

		Util.MapDebugPrint( "Planted_Main" );
	},

	Defused_Main = function( trigger )
	{
		Map.MainDyno -= 1;

		if ( Map.MainDyno < 1 ) {
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rMainDefuseAssist.*" );
		}

		Util.MapDebugPrint( "Defused_Main" );
	},

	// called from Side_Entrance_Destroyed and Main_Entrance_Destroyed
	ShiftAxisToParts = function()
	{
		Map.AxisShiftedToParts = true;
		Util.DisableGroup( "eastbunker", TEAM.AXIS );
		Util.DisableGroup( "westbunker", TEAM.AXIS );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CHECKPOINT.*",
			"DEFEND_rBunkerPatrol.*",
			"TRIPMINE_rBunker.*",
		});

		// don't bother with defuses
		SetGoalPriority( "DEFUSE_Main_Entrance.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );
		SetGoalPriority( "DEFUSE_Side_Entrance.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );

		if ( Map.CPStatus < 2 && Map.EastPartsStatus == 0 ) {
			Util.EnableGroup( "cpdefense", TEAM.AXIS );
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANTMINE_rBunkerEast[23]" );
		}
		else if ( Map.EastPartsStatus == 0 ) {
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANTMINE_rBunkerEast[23]" );
			Util.EnableGroup( "eastparts", TEAM.AXIS );
		}

		if ( Map.WestPartsStatus == 0 ) {
			Util.EnableGroup( "westparts", TEAM.AXIS );
		}

		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rPartsPatrol.*" );

		// set the spawns
		Util.ChangeSpawnForRole( TEAM.AXIS, ROLE.DEFENDER2, 4 );
		Util.ChangeSpawnForRole( TEAM.AXIS, ROLE.DEFENDER1, 5 );

		// and some cleanup
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_rMainDefuseAssist.*",
			"DEFEND_rSideDefuseAssist.*",
			"DEFUSE_Main.*",
			"DEFUSE_Side.*",
		});
	},

	Side_Entrance_Destroyed = function( trigger )
	{
		Map.SideDoorStatus = 1;

		// let allies build it now
		Util.ClearRoleForGoals( "BUILD_Command_Post", ROLE.DEFENDER3 );

		if ( Map.CPStatus == 0 ) {
			Util.EnableGoal("ROUTE_cpassist");
		}

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Side_Door_.*",
			Map.Plant_Side_Entrance,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ROUTE_cpassist",
			Map.Build_Command_Post,
			Map.Plant_Command_Post,
		});

		if ( Map.MainDoorStatus == 1 || GetGameTimeLeft() < 90 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ATTACK_Radar_.*",
				Map.Flag_radarbox1,
				Map.Flag_radarbox2,
				Map.Cappoint_Radar_Dropoff,
			});
		}

		// Axis goals
		Map.ShiftAxisToParts();
		Util.MapDebugPrint( "Side_Entrance_Destroyed" );
	},

	Planted_Side = function( trigger )
	{
		Map.SideDyno += 1;

		if ( !Map.AxisShiftedToParts ) {
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rSideDefuseAssist.*" );
		}
		else {
			Map.ShiftAxisToParts();
		}

		Util.MapDebugPrint( "Planted_Side" );
	},

	Defused_Side = function( trigger )
	{
		Map.SideDyno -= 1;

		if ( Map.SideDyno < 1 ) {
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rMainDefusAssist.*" );
		}

		Util.MapDebugPrint( "Defused_Side" );
	},

	West_Parts_Taken = function( trigger )
	{
		Map.WestPartsStatus = 1;
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Main_Door_.*" );

		Util.DisableGroup( "westparts", TEAM.AXIS );
		Util.EnableGroup( "rdeliver", TEAM.AXIS );

		// shift the east defenders too unless east parts are home
		if ( Map.EastPartsStatus != 0 ) {
			Util.DisableGroup( "eastparts", TEAM.AXIS );
			Util.DisableGroup( "cpdefense", TEAM.AXIS );
		}

		Util.MapDebugPrint( "radarbox1_Taken" );
	},

	West_Parts_Returned = function( trigger )
	{
		Map.WestPartsStatus = 0;

		// are the others on their way?
		if ( Map.EastPartsStatus != 1 ) {
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Main_Door_.*" );
			Util.DisableGroup( "rdeliver", TEAM.AXIS );
		}

		// reset the east defense
		if ( Map.EastPartsStatus == 2 ) {
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_rEastParts.*",
				"CALLARTILLERY_rEastParts.*",
				"ARTILLERY_S_rEastParts.*",
			});
		}

		Util.EnableGroup( "westparts", TEAM.AXIS );
		Util.MapDebugPrint( "radarbox1_Returned" );
	},

	West_Radar_Dropoff_Captured = function( trigger )
	{
		Map.WestPartsStatus = 2;

		// are the others on their way?
		if ( Map.EastPartsStatus != 1  ) {
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Main_Door_.*" );
			Util.DisableGroup( "rdeliver", TEAM.AXIS );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_rWestParts.*",
				"CALLARTILLERY_rWestParts.*",
				"ARTILLERY_S_rWestParts.*",
			});
		}

		// add more focus to east
		Util.ClearRoleForGroup("eastparts", ROLE.DEFENDER1);
		SetGoalPriority( "DEFEND_rEastParts.*", 0.65, TEAM.AXIS );

		Util.MapDebugPrint( "radarbox1_Radar_Dropoff_Captured" );
	},

	East_Parts_Taken = function( trigger )
	{
		Map.EastPartsStatus = 1;

		Util.DisableGroup( "eastparts", TEAM.AXIS );
		Util.DisableGroup( "cpdefense", TEAM.AXIS );
		Util.EnableGroup( "rdeliver", TEAM.AXIS );

		if ( Map.WestPartsStatus != 0 ) {
			Util.DisableGroup( "westparts", TEAM.AXIS );
		}

		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Main_Door_.*" );

		Util.MapDebugPrint( "radarbox2_Taken" );
	},

	East_Parts_Returned = function( trigger )
	{
		Map.EastPartsStatus = 0;

		// are the others on their way?
		if ( Map.WestPartsStatus != 1 ) {
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Main_Door_.*" );
			Util.DisableGroup( "rdeliver", TEAM.AXIS );
		}

		// reset the west defense
		if ( Map.WestPartsStatus == 2 ) {
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_rWestParts.*",
				"CALLARTILLERY_rWestParts.*",
				"ARTILLERY_S_rWestParts.*",
			});
		}

		Util.EnableGroup( "eastparts", TEAM.AXIS );
		Util.MapDebugPrint( "radarbox2_Returned" );
	},

	East_Radar_Dropoff_Captured = function( trigger )
	{
		Map.EastPartsStatus = 2;

		// make sure these are disabled
		Util.DisableGroup( "cpdefense", TEAM.AXIS );

		// are the others on their way?
		if ( Map.WestPartsStatus != 1 ) {
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Main_Door_.*" );
			Util.DisableGroup( "rdeliver", TEAM.AXIS );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_rEastParts.*",
				"CALLARTILLERY_rEastParts.*",
				"ARTILLERY_S_rEastParts.*",
			});
		}

		// add more focus to west
		Util.ClearRoleForGroup("westparts", ROLE.DEFENDER2);
		SetGoalPriority( "DEFEND_rWestParts.*", 0.65, TEAM.AXIS );

		Util.MapDebugPrint( "radarbox2_Radar_Dropoff_Captured" );
	},

	roadbunker_Axis_Captured = function( trigger )
	{
		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, Map.MainDyno > 1, "DEFEND_rMainDefuseAssist.*" );
		SetAvailableMapGoals( TEAM.AXIS, Map.SideDyno > 1, "DEFEND_rSideDefuseAssist.*" );

		Util.MapDebugPrint( "roadbunker_Axis_Captured" );
	},

	roadbunker_Allies_Captured = function( trigger )
	{
		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_rMainDefuseAssist.*",
			"DEFEND_rSideDefuseAssist.*",
		});

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

global OnMapLoad = function()
{
	Util.SetGoalOffset( -20, 0, 0, Map.Build_Axis_Road_MG_Nest );

	OnTrigger( "The Axis Road MG Nest has been constructed.", Map.Axis_Road_MG_Nest_Built );
	OnTrigger( "The Axis Watchtower MG Nest has been constructed.", Map.Axis_Watchtower_MG_Nest_Built );
	OnTrigger( "The Bunker MG Nest has been constructed.", Map.Bunker_MG_Nest_Built );
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "The Axis Road MG Nest has been destroyed.", Map.Axis_Road_MG_Nest_Destroyed );
	OnTrigger( "The Axis Watchtower MG Nest has been destroyed.", Map.Axis_Watchtower_MG_Nest_Destroyed );
	OnTrigger( "The Bunker MG Nest has been destroyed.", Map.Bunker_MG_Nest_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( "Allies have breached the Main Entrance and secured the Forward Bunker!", Map.Main_Entrance_Destroyed );
	OnTrigger( "Allies have breached the Side Entrance!", Map.Side_Entrance_Destroyed );
	OnTrigger( "Allies have stolen the West Radar Parts!", Map.West_Parts_Taken );
	OnTrigger( "Allies have stolen the East Radar Parts!", Map.East_Parts_Taken );
	OnTrigger( "Allies have secured the West Radar Parts!", Map.West_Radar_Dropoff_Captured );
	OnTrigger( "Allies have secured the East Radar Parts!", Map.East_Radar_Dropoff_Captured );
	OnTrigger( "Allies capture the Forward Bunker!", Map.roadbunker_Allies_Captured );
	OnTrigger( "Axis reclaim the Forward Bunker!", Map.roadbunker_Axis_Captured );
	OnTrigger( "Planted at the Main Entrance.", Map.Planted_Main );
	OnTrigger( "Defused at the Main Entrance.", Map.Defused_Main );
	OnTrigger( "Planted at the Side Entrance.", Map.Planted_Side );
	OnTrigger( "Defused at the Side Entrance.", Map.Defused_Side );
	OnTrigger( "Flag returned radarbox1!", Map.West_Parts_Returned );
	OnTrigger( "Flag returned radarbox2!", Map.East_Parts_Returned );

	// Max users per goal
	Util.SetMaxUsers( 4, Map.Checkpoint_roadbunker );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 8, "FLAG_.*" );
	Util.SetMaxUsersInProgress( 4, "DEFEND_rSideDefuseAssist.*" );
	Util.SetMaxUsersInProgress( 4, "DEFEND_rMainDefuseAssist.*" );
	Util.SetMaxUsersInProgress( 2, "DEFEND_rBunkerPatrol.*" );
	Util.SetMaxUsersInProgress( 2, "DEFEND_rPartsPatrol.*" );
	Util.SetMaxUsersInProgress( 2, "DEFEND_rDeliver.*" );
	Util.SetMaxUsersInUse( 1, "DEFEND_rSideDefuseAssist.*" );
	Util.SetMaxUsersInUse( 1, "DEFEND_rMainDefuseAssist.*" );
	Util.SetMaxUsersInUse( 1, "DEFEND_rBunkerPatrol.*" );
	Util.SetMaxUsersInUse( 1, "DEFEND_rPartsPatrol.*" );
	Util.SetMaxUsersInUse( 2, "DEFEND_rDeliver.*" );

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=10, MaxCampTime=30});
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=20, MaxCampTime=40});
	SetMapGoalProperties( "DEFEND_rBunkerPatrol.*", {MinCampTime=2, MaxCampTime=3});
	SetMapGoalProperties( "DEFEND_rPartsPatrol.*", {MinCampTime=2, MaxCampTime=3});
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=9999, MaxCampTime=9999});
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=120, MaxCampTime=120});
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=120, MaxCampTime=120});

	SetGoalPriority( Map.Plant_Command_Post, 0.0, 0, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Bunker_MG_Nest, 0.0, 0, CLASS.ENGINEER );

	// Allied goals
	SetGoalPriority( "ATTACK_Main_Door_.*", 0.51, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Command_Post, 0.89, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Command_Post, 0.9, 0, CLASS.COVERTOPS );
	SetGoalPriority( Map.Plant_Main_Entrance, 0.82, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Side_Entrance, 0.81, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Axis_Road_MG_Nest, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Axis_Watchto.*MG_Nest", 0.0, TEAM.ALLIES, CLASS.ENGINEER );

	// Axis goals
	SetGoalPriority( Map.Build_Bunker_MG_Nest, 0.79, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_rSideDefuseAssist.*", 0.8, TEAM.AXIS );
	SetGoalPriority( "DEFEND_rMainDefuseAssist.*", 0.8, TEAM.AXIS );
	SetGoalPriority( "DEFEND_rPartsPatrol.*", 0.49, TEAM.AXIS );
	SetGoalPriority( "CHECKPOINT.*", 0.9, TEAM.AXIS ); // always recapture!

	Util.SetRoleForGoals( "BUILD_Command_Post", ROLE.DEFENDER3 );
	Util.ClearRoleForGoals( "BUILD_Command_Post", ROLE.ATTACKER2 );

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

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"CAPPOINT_Radar_Dropoff",
		"REPAIRMG42_Bunker_MG_Nest",
		"REPAIRMG42_Axis_Road_MG_Nest",
		"BUILD_Bunker_MG_Nest",
		"PLANT_Axis_Road_MG_Nest",
		"PLANT_Main_Entrance",
		"PLANT_Axis_Watchto.*MG_Nest",
		"PLANT_Command_Post",
		"PLANT_Side_Entrance",
		"MOUNTMG42_Axis_Road_MG_Nest",
		"CHECKPOINT_roadbunker",
		"ATTACK_Main_Door_.*",
		"ATTACK_Side_Door_.*",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"REPAIRMG42_Bunker_MG_Nest",
		"REPAIRMG42_Axis_Road_MG_Nest",
		"BUILD_Bunker_MG_Nest",
		"BUILD_Axis_Road_MG_Nest",
		"MOUNTMG42_Bunker_MG_Nest",
		"MOUNTMG42_Axis_Road_MG_Nest",
		"CHECKPOINT_roadbunker",
		"PLANTMINE_rBunker.*",
		"CALLARTILLERY_rBunker.*",
		"ARTILLERY_S_rBunker.*",
		"DEFEND_rBunker.*",
		"TRIPMINE_rBunker.*",
		"BUILD_Command_Post",
	});

	Util.DisableGoal("ROUTE_cpassist");

	MapRoutes =
	{
		CHECKPOINT_roadbunker =
		{
			ROUTE_AllySpawn1 =
			{
				ROUTE_tunnel =
				{
					ROUTE_hill =
					{
						ROUTE_flagside = { Weight = 2, },
						ROUTE_flagroad =
						{
							ROUTE_flagroad2 = { ROUTE_flagfar = {}, },
						},
					},
				 },
				ROUTE_allyfront =
				{
					Weight = 2,
					ROUTE_flagmain = { Weight = 2, },
					ROUTE_flagside = {},
					ROUTE_flagroad =
					{
						ROUTE_flagroad2 = { ROUTE_flagfar = {}, },
					},
				},
				ROUTE_flagside = {},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_tunnel =
				{
					ROUTE_hill =
					{
						ROUTE_flagside = { Weight = 2, },
						ROUTE_flagroad =
						{
							ROUTE_flagroad2 = { ROUTE_flagfar = {}, },
						},
					},
				 },
				ROUTE_allyfront =
				{
					Weight = 2,
					ROUTE_flagmain = { Weight = 2, },
					ROUTE_flagside = {},
					ROUTE_flagroad =
					{
						ROUTE_flagroad2 = { ROUTE_flagfar = {}, },
					},
				},
				ROUTE_flagside = {},
			},
			ROUTE_AllySpawn3 =
			{
				ROUTE_tunnel =
				{
					ROUTE_hill =
					{
						ROUTE_flagside = { Weight = 2, },
						ROUTE_flagroad =
						{
							ROUTE_flagroad2 = { ROUTE_flagfar = {}, },
						},
					},
				 },
				ROUTE_allyfront =
				{
					Weight = 2,
					ROUTE_flagmain = { Weight = 2, },
					ROUTE_flagside = {},
					ROUTE_flagroad =
					{
						ROUTE_flagroad2 = { ROUTE_flagfar = {}, },
					},
				},
				ROUTE_flagside = {},
			},
		},
		PLANT_Main_Entrance =
		{
			ROUTE_AllySpawn1 =
			{
				ROUTE_tunnel =
				{
					ROUTE_hill =
					{
						ROUTE_flagroad =
						{
							ROUTE_flagroad2 = {},
						},
					},
				 },

			},
		},
		FLAG_radarbox1 =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_maincentral =
				{
					ROUTE_mainflank =
					{
						ROUTE_mainflank2 = {},
					},
				},
				ROUTE_mainright = { ROUTE_mainright2 = {}, },
				ROUTE_cpassist = { Weight = 2, },
			},
			ROUTE_CpSpawn =
			{
				ROUTE_tincorner =
				{
					ROUTE_secorner = { ROUTE_swcorner = {}, },
				},
				ROUTE_mainflank = {},
				ROUTE_bridgehill = { ROUTE_bridge = {}, },
			},
		},
		FLAG_radarbox2 =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_maincentral = { Weight = 2, },
				ROUTE_mainright2 =
				{
					ROUTE_swcorner = { ROUTE_secorner = {}, },
				},
				ROUTE_cpassist = { Weight = 2, },
			},
			ROUTE_CpSpawn =
			{
				ROUTE_tincorner = { Weight = 2, },
				ROUTE_eastmid = {},
			},
		},
		CAPPOINT_Radar_Dropoff =
		{
			ROUTE_East_Radar =
			{
				ROUTE_cpassist =
				{
					ROUTE_flagroute = {},
				},
			},

		},
		DEFEND_rEastParts1 =
		{
			ROUTE_AxisSpawn1 =
			{
				ROUTE_eastpatrol1 = {},
				ROUTE_eastpatrol2 = {},
			},
			ROUTE_AxisSpawn2 =
			{
				ROUTE_gateroute = {},
				ROUTE_westpatrol1 = {},
			},
		},
		DEFEND_rWestParts1 =
		{
			ROUTE_AxisSpawn1 =
			{
				ROUTE_maincentral = {},
				ROUTE_westpatrol1 = {},
				ROUTE_westpatrol2 = {},
			},
		},
	};

	//copy some routes
	MapRoutes.DEFEND_rEastParts2 = MapRoutes.DEFEND_rEastParts1;
	MapRoutes.DEFEND_rEastParts3 = MapRoutes.DEFEND_rEastParts1;
	MapRoutes.DEFEND_rEastParts4 = MapRoutes.DEFEND_rEastParts1;
	MapRoutes.DEFEND_rEastParts5 = MapRoutes.DEFEND_rEastParts1;
	MapRoutes.DEFEND_rWestParts2 = MapRoutes.DEFEND_rWestParts1;
	MapRoutes.DEFEND_rWestParts3 = MapRoutes.DEFEND_rWestParts1;
	MapRoutes.DEFEND_rWestParts4 = MapRoutes.DEFEND_rWestParts1;
	MapRoutes.DEFEND_rWestParts5 = MapRoutes.DEFEND_rWestParts1;

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

global OnBotJoin = function( bot )
{
	bot.MaxViewDistance = 2500;
	bot.TargetBreakableDist = 150.0;

	if ( bot.GetTeam() == TEAM.AXIS ) {
		if ( !Map.FirstAxisEng ) {
			bot.SetRoles(ROLE.DEFENDER3, ROLE.DEFENDER1);
			bot.ChangeClass(CLASS.ENGINEER);
			bot.ChangeSpawnPoint(5); // cs: will not work on a map_restart
			Map.FirstAxisEng = bot;
		}
		else {
			bot.ChangeSpawnPoint(3);
		}
	}
	else {
		bot.ChangeSpawnPoint(2);
	}
};
