//============================================================================================================================
//
//  stalingrad.gm
//
//  Who               When            What
//----------------------------------------------------------------------------------------------------------------------------
//  d00d              09-12-2010      Finished waypoints, fixed stuckage, added more facings to camp goals where applicable.
//                                    Fixed conditional variables overwriting functions in map table (!!!).
//  AliceInChains     13-05-2010      Waypointing near finished, just some roofs left
//                                    Partial implementation of DEFEND groups. Added (basic) bot roles
//                                    TODO: Improve Defense, optimize routing/waypoints, increase SNIPE spots (also for Allies)
//=============================================================================================================================

// Spawns:
// Axis Rear Spawn, spawnpoint 1 ( Fall back spawn after Munitions Depot is captured/Main gate is blown by Allies )
// Allies River Spawn, spawnpoint 2 ( Starting spawn for Allies )
// Munitions Depot, spawnpoint 3 ( Checkpoint spawn, fixed for Allies after Main gate is blown )

/*
AXIS DEFEND/MOBILEMG42/SNIPE:

Axis_Bridge             5 DEFEND,  2 MG42,  4 SNIPE
Axis_EastBridge         5 DEFEND,  2 MG42,  4 SNIPE
Axis_MunitionsDepot     4 DEFEND,  2 MG42,  1 SNIPE
Axis_MainGate           5 DEFEND,  1 MG42,  2 SNIPE
Axis_WesternWall        2 DEFEND,  2 MG42,  4 SNIPE
Axis_Church             5 DEFEND,  2 MG42,  2 SNIPE
Axis_EastTank           8 DEFEND,  4 MG42,  4 SNIPE
Axis_WestTank           5 DEFEND,  1 MG42,  2 SNIPE
---------------------------------------------------
Total                  39 DEFEND, 16 MG42, 23 SNIPE
*/

global Map =
{
	Debug = false,

	Ammo_Cabinet_south_ammocabinet = "AMMOCAB_south_ammocabinet",
	Health_Cabinet_south_healthcabinet = "HEALTHCAB_south_healthcabinet",
	Call_Artillery_368 = "CALLARTILLERY_368",
	Call_Artillery_464 = "CALLARTILLERY_464",
	Call_Artillery_474 = "CALLARTILLERY_474",
	Artillery_D_504 = "ARTILLERY_D_504",
	Checkpoint_munitionsflag = "CHECKPOINT_munitionsflag",
	Build_Allied_Command_Post = "BUILD_Allied_Command_Post",
	Build_Axis_Command_Post = "BUILD_Axis_Command_Post",
	Build_East_Tank_MG_Nest = "BUILD_East_Tank_MG_Nest",
	Build_West_Tank_MG_Nest = "BUILD_West_Tank_MG_Nest",
	Plant_Allied_Command_Post = "PLANT_Allied_Command_Post",
	Plant_Axis_Command_Post = "PLANT_Axis_Command_Post",
	Plant_East_Tank = "PLANT_East_Tank",
	Plant_East_Tank_MG_Nest = "PLANT_East_Tank_MG_Nest",
	Plant_Main_Gate = "PLANT_Main_Gate",
	Plant_West_Tank = "PLANT_West_Tank",
	Plant_West_Tank_MG_Nest = "PLANT_West_Tank_MG_Nest",
	Plant_Western_Wall = "PLANT_Western_Wall",
	Mount_328 = "MOUNTMG42_328",
	Mount_East_Tank_MG_Nest = "MOUNTMG42_East_Tank_MG_Nest",
	Mount_West_Tank_MG_Nest = "MOUNTMG42_West_Tank_MG_Nest",
	Repair_328 = "REPAIRMG42_328",
	Repair_East_Tank_MG_Nest = "REPAIRMG42_East_Tank_MG_Nest",
	Repair_West_Tank_MG_Nest = "REPAIRMG42_West_Tank_MG_Nest",

	// Conditionals
	Main_Gate_Is_Destroyed = false,
	Western_Wall_Is_Destroyed = false,
	East_Tank_Is_Destroyed = false,
	West_Tank_Is_Destroyed = false,

	Navigation =
	{
		jump_pt =
		{
			// better response time than nav flags
			navigate = function(_this)
			{
				_this.Bot.PressButton(BTN.JUMP);
				yield();
			},
		},
	},

	Roles = {
		AXIS = {
			AllBots = true,
			DEFENDER2 = {    // East Tank
				//~crucialClass = CLASS.ENGINEER,
				numbots = 2,
			},
			DEFENDER1 = {   // West Tank
				//~crucialClass = CLASS.ENGINEER,
				numbots = 2,
			},
		},
	},

	Allied_Command_Post_Built = function( trigger )
	{
		if ( !Map.Main_Gate_Destroyed )
			{ SetAvailableMapGoals( TEAM.AXIS, true, Map.Plant_Allied_Command_Post ); }

		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Allied_Command_Post );
	},

	Axis_Command_Post_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_Axis_Command_Post );

		if ( Map.Main_Gate_Destroyed || Map.Western_Wall_Destroyed ) {
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Plant_Axis_Command_Post );
		}
	},

	East_Tank_MG_Nest_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_East_Tank_MG_Nest );
	},

	West_Tank_MG_Nest_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_West_Tank_MG_Nest );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Plant_Allied_Command_Post );

		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Allied_Command_Post );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Axis_Command_Post );

		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Axis_Command_Post );
	},

	East_Tank_Destroyed = function( trigger )
	{
		Map.East_Tank_Is_Destroyed = true;

		ClearGoalRole( ".*_Axis_WestTank.*", ROLE.DEFENDER1 );
		//~ClearGoalRole( ".*_Axis_MainGate.*", ROLE.DEFENDER1 );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			Map.Build_East_Tank_MG_Nest,
			Map.Repair_East_Tank_MG_Nest,
			".*_Axis_Church.*",
			".*_Axis_EastTank.*",
			".*_Axis_MainGate.*",
		});

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Plant_East_Tank,
			".*_Allies_EastTank.*",
			"GRENADE_east_tank_mg.*",
			"SMOKEBOMB_east_tank.*",
		});
	},

	East_Tank_MG_Nest_Destroyed = function( trigger )
	{
		if ( !Map.East_Tank_Is_Destroyed ) {
			SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_East_Tank_MG_Nest );
		}
	},

	Main_Gate_Destroyed = function( trigger )
	{
		Map.Main_Gate_Is_Destroyed = true;

		// Munitions Depot is lost so fall back and concentrate defenses around tanks and approach routes.

		sleep(2.0); // Bot pathfinding is done before blockwall state is updated otherwise

		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_Axis_Bridge.*",
			".*_Axis_EastBridge.*",
			".*_Axis_MunitionsDepot.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.Build_Axis_Command_Post,
			".*_Axis_MainGate.*",
			".*_Axis_EastTank.*",
			".*_Axis_WestTank.*",
		});

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			".*_Allies_MainGate.*",
			".*_Allies_WesternWall.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"AMMOCAB_south_ammocabinet",
			"HEALTHCAB_south_healthcabinet",
		});

		if ( !Map.East_Tank_Is_Destroyed )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				Map.Repair_East_Tank_MG_Nest,
				Map.Build_East_Tank_MG_Nest,
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				Map.Plant_East_Tank,
				".*_Allies_EastTank.*",
				"GRENADE_east_tank_mg.*",
				"SMOKEBOMB_east_tank.*",
			});
		}
		if ( !Map.West_Tank_Is_Destroyed )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				Map.Build_West_Tank_MG_Nest,
				Map.Repair_West_Tank_MG_Nest,
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				Map.Plant_West_Tank,
				".*_Allies_WestTank.*",
				"GRENADE_west_tank_mg.*",
				"SMOKEBOMB_west_tank.*",
			});
		}
	},

	West_Tank_Destroyed = function( trigger )
	{
		Map.West_Tank_Is_Destroyed = true;

		ClearGoalRole( ".*_Axis_EastTank.*", ROLE.DEFENDER2 );
		//~ClearGoalRole( ".*_Axis_MainGate.*", ROLE.DEFENDER2 );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			Map.Repair_West_Tank_MG_Nest,
			Map.Build_West_Tank_MG_Nest,
			".*_Axis_WestTank.*",
			".*_Axis_WesternWall.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_Church.*" ); // Ambush Allies using Western Wall --> Church route
		SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_MainGate.*" ); // West defense no longer needed; back to agressive East defense

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"SMOKEBOMB_west_tank.*",
			"GRENADE_west_tank_mg.*",
			Map.Plant_West_Tank,
			".*_Allies_WestTank.*",
		});
	},

	West_Tank_MG_Nest_Destroyed = function( trigger )
	{
		if ( !Map.West_Tank_Is_Destroyed ) {
			SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_West_Tank_MG_Nest );
		}
	},

	Western_Wall_Destroyed = function( trigger )
	{
		Map.Western_Wall_Is_Destroyed = true;

		// Munitions Depot can still be captured at this point. Probably the only situation where bots need to be spread out.

		sleep(2.0);

		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_Axis_Bridge.*",
			".*_Axis_EastBridge.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_WesternWall.*" );
		if ( !Map.East_Tank_Is_Destroyed )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				Map.Repair_East_Tank_MG_Nest,
				Map.Build_East_Tank_MG_Nest,
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				Map.Plant_East_Tank,
				".*_Allies_EastTank.*",
				"GRENADE_east_tank_mg.*",
				"SMOKEBOMB_east_tank.*",
			});
		}
		if ( !Map.West_Tank_Is_Destroyed )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				Map.Build_West_Tank_MG_Nest,
				Map.Repair_West_Tank_MG_Nest,
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				Map.Plant_West_Tank,
				".*_Allies_WestTank.*",
				"GRENADE_west_tank_mg.*",
				"SMOKEBOMB_west_tank.*",
			});
		}
		if ( Map.Main_Gate_Is_Destroyed ) {
			SetAvailableMapGoals( TEAM.ALLIES, false, ".*_Allies_WesternWall.*" ); // Munitions Depot secured so move out
		}
	},

	munitionsflag_Axis_Captured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, {
			".*_Axis_Bridge.*",
			".*_Axis_EastBridge.*",
		});
		if ( Map.Western_Wall_Is_Destroyed ) {
			SetAvailableMapGoals( TEAM.AXIS, false, {
				".*_Axis_Bridge.*",
				".*_Axis_EastBridge.*",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_MunitionsDepot.*" );
		}
	},

	munitionsflag_Allies_Captured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_Axis_Bridge.*",
			".*_Axis_EastBridge.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_MunitionsDepot.*" );

		SetAvailableMapGoals( TEAM.ALLIES, true, ".*_Allies_MainGate.*" ); // 4 ATTACK ==> cover dynamite/route to flag
		if ( !Map.Western_Wall_Is_Destroyed ) {
			SetAvailableMapGoals( TEAM.ALLIES, true, ".*_Allies_WesternWall.*" ); // 4 ATTACK ==> cover dynamite/route to flag
		}
	},
};

global OnMapLoad = function()
{
	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 East Tank MG Nest has been constructed!", Map.East_Tank_MG_Nest_Built );
	OnTrigger( "The West Tank MG Nest has been constructed!", Map.West_Tank_MG_Nest_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "Allies have destroyed the East Tank!", Map.East_Tank_Destroyed );
	OnTrigger( "The East Tank MG Nest has been damaged!", Map.East_Tank_MG_Nest_Destroyed );
	OnTrigger( "Allies have blown the Main Gate and secured the Munitions Depot spawn!", Map.Main_Gate_Destroyed );
	OnTrigger( "Allied team has destroyed the West Tank!", Map.West_Tank_Destroyed );
	OnTrigger( "The West Tank MG Nest has been damaged!", Map.West_Tank_MG_Nest_Destroyed );
	OnTrigger( "Allies have breached the Upper wall", Map.Western_Wall_Destroyed );
	OnTrigger( "Axis reclaim the Munitions Depot!", Map.munitionsflag_Axis_Captured );
	OnTrigger( "Allies capture the Munitions Depot!", Map.munitionsflag_Allies_Captured );

	Util.SetMaxUsers( 5, Map.Checkpoint_munitionsflag );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );

	Util.SetMaxUsersInProgress( 2, "BUILD_.*" );
	Util.SetMaxUsersInUse( 1, "BUILD_.*" );
	Util.SetMaxUsersInProgress( 2, "PLANT_.*" );
	Util.SetMaxUsersInUse( 1, "PLANT_.*" );
	Util.SetMaxUsersInProgress( 2, "MOBILEMG42_.*" );
	Util.SetMaxUsersInProgress( 2, "SNIPE_.*" );

	Util.SetGoalOffset( -200, 60, 0, Map.Plant_West_Tank );

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=15, MaxCampTime=20} );
	SetMapGoalProperties( "ATTACK_Allies_EastTank_Main", {MinCampTime=2, MaxCampTime=3} ); // Special Case
	SetMapGoalProperties( "ATTACK_Allies_WestTank_Main", {MinCampTime=2, MaxCampTime=3} ); // Special Case
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=30, MaxCampTime=45} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=60, MaxCampTime=90} );
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=45, MaxCampTime=60} );

	Util.DisableGoal( ".*", true ); // All but Routes

	Util.LimitToClass( Map.Plant_Allied_Command_Post, TEAM.AXIS, CLASS.COVERTOPS );

	// Axis Goals
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"CHECKPOINT_munitionsflag",
		".*_Axis_Bridge.*",
		".*_Axis_EastBridge.*",
	});

	// Allied Goals
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"CHECKPOINT_munitionsflag",
		Map.Build_Allied_Command_Post,
		Map.Plant_Main_Gate,
		Map.Plant_Western_Wall,
	});

	MapRoutes =
	{
		// Allied
		PLANT_Main_Gate =
		{
			ROUTE_alliedRiverSpawn =
			{
				ROUTE_bridgeLeft =
				{
					Weight = 2,
					ROUTE_bridgeLeft_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_bridgeRight =
				{
					ROUTE_bridgeRight_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
			},
			ROUTE_alliedRiverSpawn_Bridge =
			{
				ROUTE_bridgeLeft =
				{
					ROUTE_bridgeLeft_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_bridgeRight =
				{
					ROUTE_bridgeRight_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
			},
			ROUTE_alliedRiverSpawn_Flank =
			{
				ROUTE_eastBridge_Left =
				{
					ROUTE_munitionsDepot_Right = {},
				},
				ROUTE_eastBridge_Right =
				{
					ROUTE_munitionsDepot_Right = {},
				},
			},
			ROUTE_alliedCommandPost = // Needed?
			{
				ROUTE_munitionsDepot_Right = {},
			},
		},

		PLANT_Western_Wall =
		{
			ROUTE_alliedRiverSpawn =
			{
				ROUTE_bridgeLeft =
				{
					Weight = 2,
					ROUTE_bridgeLeft_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_bridgeRight =
				{
					ROUTE_bridgeRight_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_eastBridge_Left =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
				ROUTE_eastBridge_Right =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
			},
			ROUTE_alliedRiverSpawn_Bridge =
			{
				ROUTE_bridgeLeft =
				{
					Weight = 2,
					ROUTE_bridgeLeft_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_bridgeRight =
				{
					ROUTE_bridgeRight_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
			},
			ROUTE_alliedRiverSpawn_Flank =
			{
				ROUTE_eastBridge_Left =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
				ROUTE_eastBridge_Right =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
			},
			ROUTE_alliedCommandPost =
			{
				ROUTE_munitionsDepot_Left = {},
				ROUTE_munitionsDepot_Right = {},
			},
		},

		BUILD_Allied_Command_Post =
		{
			ROUTE_alliedRiverSpawn =
			{
				ROUTE_eastBridge_Left = { Weight = 2, },
				ROUTE_eastBridge_Right = { Weight = 2, },
				ROUTE_bridgeLeft =
				{
					ROUTE_bridgeLeft_End = {},
				},
				ROUTE_bridgeRight =
				{
					ROUTE_bridgeRight_End = {},
				},
			},
			ROUTE_alliedRiverSpawn_Flank =
			{
				ROUTE_eastBridge_Left = {},
				ROUTE_eastBridge_Right = {},
			},
		},

		PLANT_West_Tank =
		{
			ROUTE_munitionsDepot =
			{
				ROUTE_westernWall =
				{
					ROUTE_churchSide =
					{
						ROUTE_eastTank_Approach = {},
					},
					ROUTE_westTank_Approach = {},
				},
				ROUTE_mainGate =
				{
					ROUTE_churchSide =
					{
						ROUTE_westTank_Approach = {},
					},
				},
			},
		},

		PLANT_East_Tank =
		{
			ROUTE_munitionsDepot =
			{
				ROUTE_westernWall =
				{
					ROUTE_churchSide =
					{
						ROUTE_eastTank_Approach =
						{
							ROUTE_eastTank_Left = {},
							ROUTE_eastTank_Right = {},
						},
					},
					ROUTE_westTank_Approach =
					{
						ROUTE_eastTank_Left = {},
						ROUTE_eastTank_Right = {},
					},
				},
				ROUTE_mainGate =
				{
					ROUTE_churchSide =
					{
						ROUTE_westTank_Approach =
						{
							ROUTE_eastTank_Left = {},
							ROUTE_eastTank_Right = {},
						},
					},
					ROUTE_eastTank_Approach =
					{
						ROUTE_eastTank_Left = {},
						ROUTE_eastTank_Right = {},
					},
				},
			},
		},

		PLANT_Axis_Command_Post =
		{
			ROUTE_munitionsDepot =
			{
				ROUTE_westernWall =
				{
					ROUTE_churchSide =
					{
						ROUTE_eastTank_Approach =
						{
							ROUTE_eastTank_Left = {},
							ROUTE_eastTank_Right = {},
						},
					},
				},
				ROUTE_mainGate =
				{
					ROUTE_eastTank_Approach =
					{
						ROUTE_eastTank_Left = {},
						ROUTE_eastTank_Right = {},
					},
				},
			},
		},

		// Combined Allied/Axis
		CHECKPOINT_munitionsflag =
		{
			// Allied
			ROUTE_alliedRiverSpawn =
			{
				ROUTE_bridgeLeft =
				{
					Weight = 2,
					ROUTE_bridgeLeft_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_bridgeRight =
				{
					ROUTE_bridgeRight_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_eastBridge_Left =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
				ROUTE_eastBridge_Right =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
			},
			ROUTE_alliedRiverSpawn_Bridge =
			{
				ROUTE_bridgeLeft =
				{
					Weight = 2,
					ROUTE_bridgeLeft_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
				ROUTE_bridgeRight =
				{
					ROUTE_bridgeRight_End =
					{
						ROUTE_munitionsDepot_Left = {},
						ROUTE_munitionsDepot_Right = {},
					},
				},
			},
			ROUTE_alliedRiverSpawn_Flank =
			{
				ROUTE_eastBridge_Left =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
				ROUTE_eastBridge_Right =
				{
					ROUTE_munitionsDepot_Left = {},
					ROUTE_munitionsDepot_Right = {},
				},
			},
			// Axis
			ROUTE_axisRearSpawn =
			{
				ROUTE_churchSide =
				{
					ROUTE_mainGate = {},
					ROUTE_westernWall = {},
				},
				ROUTE_eastTank_Approach =
				{
					ROUTE_mainGate = {},
					ROUTE_westernWall = {},
				},
				ROUTE_westTank_Approach =
				{
					ROUTE_westernWall = {},
				},
			},
			ROUTE_axisRearSpawn_Crossroad =
			{
				ROUTE_churchSide =
				{
					ROUTE_mainGate = {},
					ROUTE_westernWall = {},
				},
				ROUTE_eastTank_Approach =
				{
					ROUTE_mainGate = {},
					ROUTE_westernWall = {},
				},
				ROUTE_westTank_Approach =
				{
					ROUTE_westernWall = {},
				},
			},
		},
	};

	// Copy Routes
	MapRoutes.ATTACK_Allies_WesternWall_1 = MapRoutes.PLANT_Western_Wall;
	MapRoutes.ATTACK_Allies_WesternWall_2 = MapRoutes.PLANT_Western_Wall;
	MapRoutes.ATTACK_Allies_WesternWall_3 = MapRoutes.PLANT_Western_Wall;
	MapRoutes.ATTACK_Allies_WesternWall_4 = MapRoutes.PLANT_Western_Wall;

	MapRoutes.ATTACK_Allies_MainGate_1 = MapRoutes.PLANT_Main_Gate;
	MapRoutes.ATTACK_Allies_MainGate_2 = MapRoutes.PLANT_Main_Gate;
	MapRoutes.ATTACK_Allies_MainGate_3 = MapRoutes.PLANT_Main_Gate;
	MapRoutes.ATTACK_Allies_MainGate_4 = MapRoutes.PLANT_Main_Gate;

	MapRoutes.ATTACK_Allies_EastTank_Main = MapRoutes.PLANT_EastTank;
	MapRoutes.ATTACK_Allies_WestTank_Main = MapRoutes.PLANT_WestTank;

	MapRoutes.PLANT_Allied_Command_Post = MapRoutes.CHECKPOINT_munitionsflag;

	Util.Routes(MapRoutes);

	Util.MapDebugPrint( "OnMapLoad: Stalingrad" );
};

global OnBotJoin = function( bot )
{

	bot.MaxViewDistance = 1600; // Really needed as this map has fog

	team = bot.GetTeam();
	class = bot.GetClass();

	if ( team == TEAM.ALLIES ) {
		if ( class == CLASS.COVERTOPS ) {
				bot.ChangePrimaryWeapon( WEAPON.GARAND );
		}
	}
	if ( team == TEAM.AXIS ) {
		if ( class == CLASS.COVERTOPS ) {
			bot.ChangePrimaryWeapon( WEAPON.K43 );
		}
	}
};
