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,

	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
			{
				numbots = 4,
			},
			DEFENDER1 = // east
			{
				numbots = 4,
			},
		},
		// up to 5 allies will spawn at cp
		ALLIES =
		{
			ATTACKER2 = // west
			{
				numbots = 5,
			},
		},
	},

	Axis_Road_MG_Nest_Built = function()
	{
		sleep( 2 );
		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()
	{
		Util.MapDebugPrint( "Axis_Road_MG_Nest_Destroyed" );
	},

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

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

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

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

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

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

		Map.ShiftAxisToParts();

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Axis_Command_Post_Built = function()
	{
		// cp built, so spawn the eng back at the flag
		if ( !Map.CpFirstBuilt ) {
			Map.CpFirstBuilt = true;

			if ( Map.FirstAxisEng ) {
				Map.FirstAxisEng.ChangeSpawnPoint(0);
			}
		}

		ClearGoalRole( "BUILD_Command_Post", ROLE.DEFENDER2 );
		Util.MapDebugPrint( "axis_radio_built_Built" );
	},

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

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

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

		Util.DisableGoal( "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,
		});

		if ( Map.SideDoorStatus == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				Map.Build_Command_Post,
				Map.Plant_Command_Post,
			});
		}

		// Axis goals
		Map.ShiftAxisToParts();
		ClearGoalRole( "BUILD_Command_Post", ROLE.DEFENDER2 );
		Util.MapDebugPrint( "Main_Entrance_Destroyed" );
	},

	Planted_Main = function()
	{
		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()
	{
		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.*",
		});

		// 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.SideDyno > 0 || Map.SideDoorStatus > 0) && Map.CPStatus == 0 && Map.EastPartsStatus == 0 ) {
			Util.EnableGroup( "cpdefense", TEAM.AXIS );
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANTMINE_rBunkerEast[23]" );
		}
		else if ( Map.EastPartsStatus == 0 ) {
			Util.DisableGroup( "cpdefense", TEAM.AXIS );
			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()
	{
		Map.SideDoorStatus = 1;

		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" );

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

		// Axis goals
		Map.ShiftAxisToParts();
		ClearGoalRole( "BUILD_Command_Post", ROLE.DEFENDER2 );
		Util.MapDebugPrint( "Side_Entrance_Destroyed" );
	},

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

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

		Util.MapDebugPrint( "Planted_Side" );
	},

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

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

		Util.MapDebugPrint( "Defused_Side" );
	},

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

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

		if ( Map.EastPartsStatus != 0 ) {
			Util.DisableGroup( "eastparts", TEAM.AXIS );
			Util.DisableGroup( "cpdefense", TEAM.AXIS );
		}

		Util.MapDebugPrint( "radarbox1_Taken" );
	},

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

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

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

	West_Radar_Dropoff_Captured = function()
	{
		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 );
		}

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

	East_Parts_Taken = function()
	{
		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()
	{
		Map.EastPartsStatus = 0;

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

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

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

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

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

	roadbunker_Axis_Captured = function()
	{
		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Main_Door_.*",
			"ATTACK_Side_Door_.*",
		});

		Util.MapDebugPrint( "roadbunker_Axis_Captured" );
	},

	roadbunker_Allies_Captured = function()
	{
		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Main_Door_.*",
			"ATTACK_Side_Door_.*",
		});

		// Axis goals - nothing to do here since shift depends on Main / Side status

		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( 15, 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( Map.Plant_Axis_Watchtower_MG_Nest, 0.0, TEAM.ALLIES, CLASS.ENGINEER );

	// Axis goals
	SetGoalPriority( Map.Build_Bunker_MG_Nest, 0.91, 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 );

	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_Watchtower_MG_Nest",
		"PLANT_Command_Post",
		"PLANT_Side_Entrance",
		"MOUNTMG42_Axis_Road_MG_Nest",
		"CHECKPOINT_roadbunker",
	});

	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.*",
		"BUILD_Command_Post",
	});

	SetGoalRole( "BUILD_Command_Post", ROLE.DEFENDER2 );

	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;

	// first axis engineer joining will spawn back and build the cp
	if ( !Map.FirstAxisEng && bot.GetTeam() == TEAM.AXIS && bot.GetClass() == CLASS.ENGINEER ) {
		Map.FirstAxisEng = bot;
		bot.ChangeSpawnPoint(5);
	}
};
