//==========================================================================================
//
//	praetoria_m2.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
// palota	13 March 2010	Initial script
// crapshoot,d00d	2 July 2010	updated for 0.8
// palota	7 August 2010	command post priority, camping time, spawn radius
// palota	21 November 2010	coverspots, tank aim mode, mg42 facing, mortar, mines, grenade, new routes, more snipe and camp goals
//==========================================================================================
//
global Map =
{
	tankDamaged = false,
	phase = 0,
	alliesCloseDepot = false,
	sideEntranceDestroyed = false,
	sideWallDestroyed = false,
	depotDoor = "closed",

	Mover_Tank = "MOVER_tank1",
	Movers = { "MOVER_tank1" },

	Depot_hatch_Destroyed = function()
	{
		Util.EnableGoal("ROUTE_depot_up");
		Util.MapDebugPrint("Depot_hatch_Destroyed", true);
	},

	Invert_Gate_Depot = function()
	{
		Map.alliesCloseDepot = !Map.alliesCloseDepot;

		mg = GetGoal("SWITCH_gate_depot");
		if (mg.IsAvailable(TEAM.ALLIES))
		{
			Util.LimitToTeam(TEAM.AXIS, "SWITCH_gate_depot");
			Util.MapDebugPrint("Axis will close door", true);
		}
		else
		{
			Util.LimitToTeam(TEAM.ALLIES, "SWITCH_gate_depot");
			Util.MapDebugPrint("Allies will close door", true);
		}
	},

	gate_depot_trigger = function( trigger )
	{
		Util.DisableGoal("SWITCH_gate_depot");
		vel = ToVector(trigger.Action);
		if (vel.z < 0)
		{
			Map.depotDoor = "closed";
			Util.MapDebugPrint("Door closed", true);
		}
		else
		{
			Map.depotDoor = "open";
			Util.MapDebugPrint("Door opened", true);
		}
		if ((vel.z < 0 && !Map.alliesCloseDepot) || (vel.z >= 0 && Map.alliesCloseDepot))
		{
			Util.LimitToTeam(TEAM.ALLIES, "SWITCH_gate_depot");
		}
		else
		{
			Util.LimitToTeam(TEAM.AXIS, "SWITCH_gate_depot");
		}
	},

	Repair_Activated = function( trigger )
	{
		if (Map.phase < 20)
		{
			vel = ToVector(trigger.Action);
			if ( vel.z <= 0 )
			{
				Util.LimitToTeam(TEAM.AXIS, "SWITCH_repair_activate");
				Util.MapDebugPrint( "Repair_Activated", true );
			}
			else
			{
				Util.LimitToTeam(TEAM.ALLIES, "SWITCH_repair_activate");
				Util.MapDebugPrint( "Repair_Deactivated", true );
			}
		}
	},

	Tank_Bunker = function( trigger )
	{
		Map.Set_Class(CLASS.ENGINEER);
		SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_axis1" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ARTILLERY_.*" );
		ETUtil.SetAimModeForMount("MOUNT_Tank", "velocity");
		Util.MapDebugPrint( "Tank_Bunker", true );
	},

	Gun_Spotted = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Mover_Tank,
			"ESCORT_tank",
		});
		if (RandInt(0,1)==0){ index = 0; } else { index = 2; }
		ETUtil.SetStartIndex( "BUILD_Hell_on_Wheels", index);
		Util.MapDebugPrint( "Gun_Spotted" );
	},

	Tank_Burning = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Mover_Tank,
			"ESCORT_tank",
		});
		Util.OnTriggerPosition( Map.Mover_Tank, "before_gate", 180.0, Map.Tank_At_Gate );
		Util.MapDebugPrint( "Tank_Burning" );
	},

	Tank_At_Gate = function( trigger )
	{
		Util.OnTriggerPosition( Map.Mover_Tank, "depot", 190.0, Map.Tank_In_Depot );
		SetGoalPriority( "SWITCH_gate_depot", 0.9 );
		SetAvailableMapGoals( TEAM.ALLIES, true, "TRIPMINE_repair_l.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "TRIPMINE_repair_x.*" );
		Util.MapDebugPrint( "Tank_At_Gate" );
	},

	Tank_In_Depot = function( trigger )
	{
		Map.phase = 10;
		Map.Invert_Gate_Depot();
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Mover_Tank,
			"ESCORT_tank",
		});
		SetGoalPriority( "SWITCH_gate_depot", 0.51 );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"SWITCH_repair_lock",
			"PLANT_Side_Wall",
		});
		Util.EnableGoal("DEFEND_depot.*");
		Util.MapDebugPrint( "Tank_In_Depot" );
	},

	Repair_Locked = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_repair_lock" );
		Util.MapDebugPrint( "Repair_Locked" );
	},

	Repair_Start = function( trigger )
	{
		SetGoalPriority(".*Command_Post", 0.95, TEAM.AXIS);
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_repair_activate" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_axis1" );
		Util.MapDebugPrint( "Repair_Start" );
	},

	Set_Class = function(class)
	{
		foreach ( bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.ALLIES && bot.GetClass() == class ){
				return;
			}
		}
		if (Server.MinClassCount[TEAM.ALLIES][class] == 0)
		{
			Server.MinClassCount[TEAM.ALLIES][class] = 1;
		}
		foreach ( bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.ALLIES)
			{
				Util.MapDebugPrint("Change class " + bot.GetClass() + " to " + class, true);
				bot.ChangeClass(class);
				return;
			}
		}
	},

	Class_Need = function(class)
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_class_need" );
		SetMapGoalProperties( "DEFEND_class_need", {mincamptime=12, maxcamptime=40} );
		SetGoalPriority( "DEFEND_class_need", 0.0, TEAM.ALLIES );
		Map.Set_Class(class);
		SetGoalPriority( "DEFEND_class_need", 2.0, TEAM.ALLIES, class, true );

		//this hack is necessary in Omnibot 0.8
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_depot.*" );
		if(class==CLASS.COVERTOPS){ SetAvailableMapGoals( TEAM.ALLIES, false, "SNIPE_allied.*" ); }
		sleep(2);
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_depot.*" );
		if(class==CLASS.COVERTOPS){ Map.Set_Snipe(); }
	},

	COVERTOPS_Need = function( trigger )
	{
		Map.Class_Need(CLASS.COVERTOPS);
		Util.MapDebugPrint( "COVERTOPS_Need" );
	},
	FIELDOPS_Need = function( trigger )
	{
		Map.Class_Need(CLASS.FIELDOPS);
		Util.MapDebugPrint( "FIELDOPS_Need" );
	},
	MEDIC_Need = function( trigger )
	{
		Map.Class_Need(CLASS.MEDIC);
		Util.MapDebugPrint( "MEDIC_Need" );
	},
	SOLDIER_Need = function( trigger )
	{
		Map.Class_Need(CLASS.SOLDIER);
		Util.MapDebugPrint( "SOLDIER_Need");
	},
	ENGINEER_Need = function( trigger )
	{
		Map.Class_Need(CLASS.ENGINEER);
		Util.MapDebugPrint( "ENGINEER_Need" );
	},

	Tank_Installed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_class_need" );
		Util.LimitToTeam( TEAM.ALLIES, "SWITCH_repair_activate");
		Util.MapDebugPrint( "Tank_Installed" );
	},

	Check_Switch = function()
	{
		if(Map.phase==20)
		{
			SetAvailableMapGoals( TEAM.ALLIES, !Map.tankDamaged, "SWITCH_repair_lock" );
		}
	},

	Tank_Upgraded = function( trigger )
	{
		Map.phase = 20;
		Map.Invert_Gate_Depot();
		if ( Map.depotDoor == "closed" )
		{
			Util.LimitToTeam(TEAM.ALLIES, "SWITCH_gate_depot");
			Map.alliesCloseDepot = false;
		}
		Util.DisableGoal("SWITCH_repair_activate");
		Util.DisableGoal("DEFEND_class_need");
		Map.Check_Switch();
		Util.MapDebugPrint( "Tank_Upgraded", true );
	},

	Attack_Gun = function(enable)
	{
		SetAvailableMapGoals( TEAM.ALLIES, enable, {
			"CALLARTILLERY.*",
			"ATTACK_gun.*",
		});
	},

	Tank_Unlocked = function( trigger )
	{
		Map.phase = 25;
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_repair_lock" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Mover_Tank,
			"ESCORT_tank",
			"MOUNT_Tank",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANTMINE_east.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "TRIPMINE_repair_l.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "TRIPMINE_repair_x.*" );
		Map.Attack_Gun(true);
		Util.DisableGoal("DEFEND_depot.*");
		Util.OnTriggerPosition( Map.Mover_Tank, "before_gate", 180.0, Map.Tank_At_Gate2 );
		SetGoalPriority( "SWITCH_gate_depot", 0.8 );
		SetGoalPriority(".*Command_Post", 0.85, TEAM.AXIS);
		Util.MapDebugPrint( "Tank_Unlocked" );
	},

	Tank_At_Gate2 = function( trigger )
	{
		Map.phase = 30;
		Map.Set_Mg();
		SetGoalPriority( "SWITCH_gate_depot", 0.1 );
		SetAvailableMapGoals( TEAM.AXIS, true, "ESCORT_tank" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMORTAR_allied1" );
		Util.MapDebugPrint( "Tank_At_Gate2" );
	},

	Set_Snipe = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, !Map.commandPostAllied, "SNIPE_axis_r.*" );
		SetAvailableMapGoals( TEAM.AXIS, Map.commandPostAllied, "SNIPE_axis_l.*" );
		SetAvailableMapGoals( TEAM.ALLIES, !Map.commandPostAllied, "SNIPE_allied_l.*" );
		SetAvailableMapGoals( TEAM.ALLIES, Map.commandPostAllied, "SNIPE_allied_r.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SNIPE_allied1" );
	},

	Set_Mg = function()
	{
		b = Map.commandPostAllied || Map.phase>=80;
		SetAvailableMapGoals( TEAM.AXIS, b, ".*MG42_mg_south" );
		SetAvailableMapGoals( TEAM.ALLIES, b, "GRENADE_mg_south" );
		b = !Map.commandPostAllied || Map.phase>=30 && Map.phase<50;
		SetAvailableMapGoals( TEAM.AXIS, b, ".*MG42_mg_north" );
		SetAvailableMapGoals( TEAM.ALLIES, b, "GRENADE_mg_north" );
	},

	Set_Command_Post = function( built )
	{
		Map.commandPostAllied = built;
		Map.Set_Snipe();
		Map.Set_Mg();
	},

	Allied_Command_Post_Built = function( trigger )
	{
		Map.Set_Command_Post(true);
		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		Map.Set_Command_Post(false);
		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	Fire_Gun = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_gun");
		Util.SetMaxUsersInProgress( 3, "SWITCH_gun");
		SetGoalPriority("SWITCH_gun", 1.1);
		Map.Attack_Gun(true);
		Util.MapDebugPrint( "Fire_Gun" );
	},

	Tank_Past_Gun = function( trigger )
	{
		Map.phase = 50;
		Map.Set_Mg();
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"ESCORT_tank",
			"SWITCH_gun",
		});
		Map.Attack_Gun(false);
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_yard.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOBILEMORTAR_allied1" );
		SetGoalPriority(".*Command_Post", 0.7, TEAM.AXIS);
		Util.MapDebugPrint( "Tank_Past_Gun" );
	},

	Gun_Damaged = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_gun");
		Util.MapDebugPrint( "Gun_Damaged" );
	},

	Tank_Damaged = function( trigger )
	{
		Util.SetMaxUsersInProgress( 1, "SWITCH_gun");
		SetGoalPriority("SWITCH_gun", 0.69);
		Map.tankDamaged=true;
		Util.SetPositionGoal( "BUILD_Hell_on_Wheels", Map.Mover_Tank );
		Map.Check_Switch();
		Util.MapDebugPrint( "Tank_Damaged" );
	},

	Tank_Repaired = function( trigger )
	{
		Map.tankDamaged=false;
		Map.Check_Switch();
		ETUtil.SetStartIndex( "BUILD_Hell_on_Wheels", -1);
		Util.MapDebugPrint( "Tank_Repaired" );
	},

	Set_Fuel_Goals = function( enable )
	{
		SetAvailableMapGoals( TEAM.AXIS, enable, {
			"DEFEND_fuel.*",
			"MOBILEMG42_fuel.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, !enable, ".*CAB_south_.*cabinet" );
		SetAvailableMapGoals( TEAM.ALLIES, enable, {
			"FLAG_fuel_tank",
			"CAPPOINT.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, !enable, {
			Map.Mover_Tank,
			"ESCORT_tank",
		});
		SetAvailableMapGoals( TEAM.ALLIES, enable && !Map.sideWallDestroyed, "ATTACK_side_wall.*" );
	},

	Get_Fuel = function( trigger )
	{
		Map.Set_Fuel_Goals(true);
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNT_Tank" );
		SetGoalPriority( ".*_Command_Post", 0.99, TEAM.ALLIES );
		SetGoalPriority( "PLANT_Side_Wall", 0.85, TEAM.ALLIES );
		SetGoalPriority( "BUILD_Hell_on_Wheels", 0.6, TEAM.ALLIES );
		Util.ForceRouting( "BUILD_Hell_on_Wheels", true );
		Util.MapDebugPrint( "Get_Fuel" );
	},

	Side_Entrance_Destroyed = function( trigger )
	{
		Map.sideEntranceDestroyed = true;
		Util.MapDebugPrint( "Side_Entrance_Destroyed" );
	},

	Side_Wall_Destroyed = function( trigger )
	{
		Map.sideWallDestroyed = true;
		Util.EnableGoal("ROUTE_side_wall");
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_side_wall.*" );
		Util.MapDebugPrint( "Side_Wall_Destroyed" );
	},

	Allies_Escape = function( trigger )
	{
		Map.Set_Fuel_Goals(false);
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANTMINE_east.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"MOUNT_Tank",
			"TRIPMINE_gun",
		});
		SetGoalPriority( "BUILD_Hell_on_Wheels", 0.99, TEAM.ALLIES );
		ETUtil.SetAimModeForMount("MOUNT_Tank", "opposite");
		Util.OnTriggerPosition( Map.Mover_Tank, "yard3", 300.0, Map.Allies_Escape2 );
		Server.MinClassCount[TEAM.AXIS][CLASS.COVERTOPS] += 1;
		Server.MinClassCount[TEAM.AXIS][CLASS.ENGINEER] -= 1;
		Util.MapDebugPrint( "Allies_Escape" );
	},

	Allies_Escape2 = function( trigger )
	{
		Util.ForceRouting( "BUILD_Hell_on_Wheels", false );
		Util.OnTriggerPosition( Map.Mover_Tank, "gun", 400.0, Map.Tank_Past_Gun2 );
		Util.MapDebugPrint( "Allies_Escape2" );
	},

	Tank_Past_Gun2 = function( trigger )
	{
		Map.phase = 80;
		Map.Set_Mg();
		SetAvailableMapGoals( TEAM.AXIS, true, "ESCORT_tank" );
		if(!Map.sideEntranceDestroyed){ SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Side_Entrance" ); }
		if(!Map.sideWallDestroyed){ SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Side_Wall" ); }
		Util.MapDebugPrint( "Tank_Past_Gun2" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "The Tank has breached the Bunker Tunnel Doors!", Map.Tank_Bunker );
	OnTrigger( "^1WARNING: ^3AT Gun spotted! ^1FIRE AT WILL!!!", Map.Gun_Spotted );
	OnTrigger( "^3Escort the Tank to the Repair Depot!", Map.Tank_Burning );
	OnTrigger( "repair_door_goto", Map.gate_depot_trigger );
	OnTrigger( "GRENADE_depot_hatch Exploded.", Map.Depot_hatch_Destroyed );
	OnTrigger( "^1Tank Repair Locks Engaged!", Map.Repair_Locked );
	OnTrigger( "^3Upgrade the Tank", Map.Repair_Start );
	OnTrigger( "hint_arrow_white_goto", Map.Repair_Activated );
	OnTrigger( "tank_covops_need", Map.COVERTOPS_Need );
	OnTrigger( "^2Jamming Transmitter Installed!", Map.Tank_Installed );
	OnTrigger( "tank_sol_need", Map.SOLDIER_Need );
	OnTrigger( "^2First Aid Kit Installed!", Map.Tank_Installed );
	OnTrigger( "tank_medic_need", Map.MEDIC_Need );
	OnTrigger( "^2Ammo Supply Kit Installed!", Map.Tank_Installed );
	OnTrigger( "tank_eng_need", Map.ENGINEER_Need );
	OnTrigger( "^2Six-Shooter Cannon Installed!", Map.Tank_Installed );
	OnTrigger( "tank_fops_need", Map.FIELDOPS_Need );
	OnTrigger( "^2Armour Upgrade Installed!", Map.Tank_Installed );
	OnTrigger( "^2Tank Upgrade Complete!!!", Map.Tank_Upgraded );
	OnTrigger( "The Tank is Returning to Battle!", Map.Tank_Unlocked );
	OnTrigger( "Allied Command Post constructed. Forward Spawn Enabled!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );

	OnTrigger( "^1WARNING: ^3Fire the AT Gun!!", Map.Fire_Gun);
	OnTrigger( "^1WARNING: ^3Manual Fire Control Damaged!!!", Map.Gun_Damaged);
	OnTrigger( "The Tank is past the Anti Tank Gun!", Map.Tank_Past_Gun);
	OnTrigger( "The Tank has been damaged!", Map.Tank_Damaged);
	OnTrigger( "The Tank has been Repaired!", Map.Tank_Repaired);
	OnTrigger( "^3Get the Fuel Tanks!", Map.Get_Fuel);
	OnTrigger( "The Allies have destroyed the Side Entrance!!", Map.Side_Entrance_Destroyed);
	OnTrigger( "The Allies have destroyed the Side Wall!!", Map.Side_Wall_Destroyed);
	OnTrigger( "The Allies are escaping with the Fuel!", Map.Allies_Escape);

	Util.DisableGoal(".*", true);
	Util.DisableGoal("ROUTE_depot_up");
	Util.DisableGoal("ROUTE_side_wall");
	Util.EnableGoal("AMMOCAB.*");
	Util.EnableGoal("HEALTHCAB.*");
	Util.EnableGoal(".*Command_Post");
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"BUILD_Gun_Controls",
		"DEFEND_depot.*",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"BUILD_Hell_on_Wheels",
		"ESCORT_tank",
		"SWITCH_gate_depot",
		"PLANT_Side_Entrance",
		"GRENADE_depot_hatch",
	});
	Map.Set_Command_Post(false);

	SetGoalPriority( "BUILD_Gun_Controls", 0.99, TEAM.AXIS );
	SetGoalPriority( "BUILD_Hell_on_Wheels", 0.99, TEAM.ALLIES );
	SetGoalPriority( "ESCORT_tank", 0.7, TEAM.ALLIES );
	SetGoalPriority( "ESCORT_tank", 0.5, TEAM.AXIS );
	SetGoalPriority( "MOUNT_Tank", 0.79, TEAM.ALLIES );
	SetGoalPriority( "FLAG_fuel_tank", 0.6, TEAM.ALLIES );
	SetGoalPriority( "ATTACK_side_wall.*", 0.61, TEAM.ALLIES );
	SetGoalPriority( "SNIPE_allied.*", 0.81, TEAM.ALLIES );
	SetGoalPriority( "GRENADE_mg.*", 0.69, TEAM.ALLIES );

	Util.SetMaxUsersInProgress( 4, "ESCORT_tank" );
	Util.SetMaxUsersInUse( 2, "ESCORT_tank" );
	Util.SetMaxUsersInProgress( 2, "PLANT_Command_Post" );
	Util.SetMaxUsers( 1, "ATTACK_side_wall.*" );
	Util.SetMaxUsers( 1, "GRENADE.*" );

	SetMapGoalProperties( "DEFEND_.*", {mincamptime=30, maxcamptime=90} );
	SetMapGoalProperties( "SNIPE_.*", {mincamptime=40, maxcamptime=100} );
	SetMapGoalProperties( "MOBILEMG42.*", {mincamptime=90, maxcamptime=120} );

	MapRoutes =
	{
		BUILD_Command_Post =
		{
			ROUTE_allies_spawn =
			{
				ROUTE_allies_west =
				{
					ROUTE_allies_south = {},
				},
				ROUTE_allies_front =
				{
					ROUTE_allies_south = {},
				},
				ROUTE_depot_gate = {},
			},
			ROUTE_axis_spawn =
			{
				ROUTE_tunnel = {},
				ROUTE_depot_gate = {},
			},
		},
		PLANT_Side_Entrance =
		{
			ROUTE_allies_spawn =
			{
				ROUTE_allies_down = {},
			},
		},
		ATTACK_yard3 =
		{
			ROUTE_allies_spawn =
			{
				ROUTE_allies_east = {},
			},
		},
		SWITCH_gate_depot =
		{
			ROUTE_allies_spawn =
			{
				ROUTE_allies_west =
				{
					ROUTE_allies_south =
					{
						ROUTE_depot3 = {},
						ROUTE_depot_up = { Weight=2 },
					},
				},
				ROUTE_allies_front =
				{
					ROUTE_allies_south = {},
				},
			},
			ROUTE_axis_spawn =
			{
				ROUTE_tunnel = { Weight=2 },
				ROUTE_depot_gate = {},
				ROUTE_allies_front = { ROUTE_allies_south = {} },
			}
		},
		FLAG_fuel_tank =
		{
			ROUTE_allies_spawn =
			{
				ROUTE_side_wall = {},
				ROUTE_yard2 = {},
				ROUTE_yard3 = {},
			},
			ROUTE_cp_spawn =
			{
				ROUTE_yard2 = {},
				ROUTE_yard3 = {},
				ROUTE_yard4 = {},
				ROUTE_side_wall = { Weight=4 },
			},
		},
		CAPPOINT_299 =
		{
			ROUTE_fuel =
			{
				ROUTE_fuel_gate = {},
				ROUTE_fuel_up = { ROUTE_axis_up_south = { ROUTE_axis_up_north = {}}},
			}
		},
		BUILD_Hell_on_Wheels =
		{
			ROUTE_allies_spawn =
			{
				ROUTE_allies_down = {},
				ROUTE_yard1 = {},
			},
			ROUTE_cp_spawn =
			{
				ROUTE_yard1 = {},
				ROUTE_yard2 = {},
				ROUTE_side_wall = {},
			},
		},
	};
	MapRoutes.PLANT_Command_Post = MapRoutes.BUILD_Command_Post;
	MapRoutes.DEFEND_class_need = MapRoutes.SWITCH_gate_depot;
	MapRoutes.SWITCH_repair_activate = MapRoutes.SWITCH_gate_depot;
	MapRoutes.DEFEND_depot1 = MapRoutes.SWITCH_gate_depot;
	MapRoutes.DEFEND_depot2 = MapRoutes.DEFEND_depot1;
	MapRoutes.DEFEND_depot3 = MapRoutes.DEFEND_depot1;
	MapRoutes.DEFEND_depot4 = MapRoutes.DEFEND_depot1;
	MapRoutes.DEFEND_depot5 = MapRoutes.DEFEND_depot1;
	MapRoutes.ATTACK_yard4 = MapRoutes.PLANT_Side_Entrance;
	Util.Routes(MapRoutes);

	Util.MapDebugPrint( "Map script for " + GetMapName() + " loaded" );
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 40.0;
};
