//==========================================================================================
//
//	uje_secret_base.gm
//
//	Who          	When		What
//------------------------------------------------------------------------------------------
//	^1[UJE]^3Captain	24 February 2017	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 0, // please set to zero before distributing your script
	ShowMovers = false,
	//set status' for conditionals
	// phase 1, first spawn allied , get tank and escort at barrier 1
	// phase 2, second spawn allied, escort tank in tunnel 
	// phase 3, Tank past barrier 2
	// phase 4, Depotwall Destroyed, no need to escort tank anymore	
	// phase 5, Replacement part Fixed,Escape with train

	tankatb1 = false,
	tankatb2 = false,
	tankb1build = false,
	tankb2build = false,
	parts1 = false,
	parts2 = false,
	DoorStatus = 0,
	phase = 1,
	
	Tank_Built = function( trigger )
	{
    if ( Map.phase > 3 or Map.tankatb1 == true or Map.tankatb2 == true )
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_tank" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_tank" );
    }
	if (Map.phase < 4 )
	{
	SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNT_tank" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNT_tank" );
	}
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Tank" );
	
	Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Destroyed = function ( trigger )
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, {
        "ESCORT_tank",
		"MOUNT_tank",
	});
	if (Map.phase < 4 )
	{
    SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Tank" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Tank" );
	}
		Util.MapDebugPrint( "Tank_Destroyed" );
	},
	
	Tank_Barrier_1_Built = function( trigger )
	{
    Map.tankb1build = true;
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier_1" );
	
	if ( Map.tankatb1 == true )
	{
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier_1" );
	}
		Util.MapDebugPrint( "Tank_Barrier_1_Built" );
	},
	
	Tank_Barrier_1_Destroyed = function( trigger )
	{
	Map.tankb1build = false;
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier_1" );
	
		Util.MapDebugPrint( "Tank_Barrier_1_Destroyed" );
	},
	
	tank_at_barrier1 = function( trigger )
	{
	Map.tankatb1 = true;
	if ( Map.tankb1build == true )
	{
    SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier_1" );
    SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_tank" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier_1" );
    SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_tank" );
	}
		Util.MapDebugPrint( "tank_at_barrier1" );
	},
	
	tank_past_barrier1 = function( trigger )
	{
    Map.phase = 2;
	Map.tankatb1 = false;
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier_1" );
	
	SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_tank" );
	
		Util.MapDebugPrint( "tank_past_barrier1" );
	},
	
	axis_spawn_back = function( trigger )
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_tb1.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, {"BUILD_Allied_Mine_Ramp","CAMP_corner1.*"} );
	
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_tb1.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, {"BUILD_Tank_Barrier_2.*","DEFEND_corner1.*"} );
	
		Util.MapDebugPrint( "axis_spawn_back" );
	},
	
	tank_at_coner1 = function( trigger )
	{
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_corner1.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_corner2.*" );
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAMP_corner1.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAMP_corner2.*" );
	
		Util.MapDebugPrint( "tank_at_coner1" );
	},
	
	tank_at_corner2 = function( trigger )
	{
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_corner2.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_tb2.*" );
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAMP_corner2.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_tb2.*" );
	
		Util.MapDebugPrint( "tank_at_corner2" );
	},
	
	Allied_Mine_Ramp_Built = function( trigger )
	{
	if ( Map.phase < 4 )
	{
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Allied_Mine_Ramp" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Mine_Ramp" );
	}
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Mine_Ramp" );
	
		Util.MapDebugPrint( "Allied_Mine_Ramp_Built" );
	},
	
	Allied_Mine_Ramp_Destroyed = function( trigger )
	{
	if ( Map.phase < 4 )
	{
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Mine_Ramp" );;
	}
	else
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Mine_Ramp" );
	}
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Mine_Ramp" );
	
		Util.MapDebugPrint( "Allied_Mine_Ramp_Destroyed" );
	},
	
	Tank_Barrier_2_Built = function( trigger )
	{
	Map.tankb2build = true;
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier_2" );
		
	if ( Map.tankatb2 == true )
	{
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier_2" );
	}
		Util.MapDebugPrint( "Tank_Barrier_2_Built" );
	},
	
	Tank_Barrier_2_Destroyed = function( trigger )
	{
	Map.tankb2build = false;
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier_2" );
	
		Util.MapDebugPrint( "Tank_Barrier_2_Destroyed" );
	},
	
	tank_at_barrier2 = function( trigger )
	{
	Map.tankatb2 = true;
	if ( Map.tankb2build == true )
	{
    SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier_2" );
    SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_tank" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier_1" );
    SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_tank" );
    }
		Util.MapDebugPrint( "tank_at_barrier2" );
	},
	
	tank_past_barrier2 = function( trigger )
	{
    Map.phase = 3;
	Map.tankatb2 = false;
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier_2" );
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier_2" );
    SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_tank" );
	
		Util.MapDebugPrint( "tank_past_barrier2" );
	},
	
	axis_spawn_bunker = function( trigger )
	{
	 Map.phase = 4;
	 SetAvailableMapGoals( TEAM.AXIS, true, {"DEFEND_part.*","DEFEND_train.*","BUILD_Axis_CP",".*CAB_uje8.*",".*CAB_uje2.*","GRENADE_wire"} );
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_tb2.*" );
	 sleep(4);
     SetAvailableMapGoals( TEAM.ALLIES, false, {"ESCORT_tank","MOUNT_tank","BUILD_Tank","ATTACK_tb2.*"} );
     SetAvailableMapGoals( TEAM.ALLIES, true, {"BUILD_Allied_CP","FLAG_Replacement_Part.*",".*CAB_uje5.*",".*CAB_uje8.*",".*CAB_uje2.*","GRENADE_wire","ATTACK_train.*"} );
	 
		Util.MapDebugPrint( "axis_spawn_bunker" );
		
	},
	
	Depotwall_Destroyed = function( trigger )
	{

		Util.MapDebugPrint( "Depotwall_Destroyed" );
	},
	
	Allied_CP_Built = function( trigger )
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_CP" );
	if ( Map.phase < 5 )
	{
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Allied_CP" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_CP" );
	}
		Util.MapDebugPrint( "Allied_CP_Built" );
	},
	
	Allied_CP_Destroyed = function( trigger )
	{
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_CP" );
	
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_CP" );
	
		Util.MapDebugPrint( "Allied_CP_Destroyed" );
	},
	
	Axis_CP_Built = function( trigger )
	{
		Util.MapDebugPrint( "Axis_CP_Built" );
	},
	
	Axis_CP_Destroyed = function( trigger )
	{
	if ( Map.phase < 5 )
	{
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_CP" );
	}
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_CP" );
	
		Util.MapDebugPrint( "Axis_CP_Destroyed" );
	},

	Replacement_Part_Taken = function( trigger )
	{
	 SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_.*" );
	 
		Util.MapDebugPrint( "Replacement_Part_Taken" );
	},

	Replacement_Part_Secured = function( trigger )
	{
	Map.parts1 = true;
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Replacement_Part_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_Part_1" );
	
	if ( Map.parts2 == true )
	{
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_part.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_Replacement_Part.*" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_part.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_Replacement_Part.*" );
	}
		Util.MapDebugPrint( "Replacement_Part_Secured" );
	},

	Replacement_Part_1_Secured = function( trigger )
	{
	Map.parts2 = true;
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Replacement_Part_2" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_Part_2" );
	if ( Map.parts1 == true )
	{
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_part.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_Replacement_Part.*" );
	}
	else
	{
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_part.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_Replacement_Part.*" );
	}
		Util.MapDebugPrint( "Replacement_Part_1_Secured" );
	},
	
	Replacement_Part_1_Built = function( trigger )
	{
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Replacement_Part_1" );
	
		Util.MapDebugPrint( "Replacement_Part_1_Built" );
	},

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

	Train_Depot_Captured  = function( trigger )
	{
     Map.phase = 5;
	 
		SetAvailableMapGoals( TEAM.ALLIES, true, "RIDE_Train" );
		
        SetAvailableMapGoals( TEAM.AXIS, false, {"DEFEND_parts.*","DEFEND_train.*"} );
		SetAvailableMapGoals( TEAM.AXIS, true, {"DEFEND_tunnel.*",".*CAB_east.*"} );
		if ( Map.DoorStatus == 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_gate1" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_gate1" );
		}
		else if( Map.DoorStatus == 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_gate1" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_gate1" );
		}
		Util.MapDebugPrint( "Train_Depot_Captured" );
	},

	Switch_Used = function( trigger )
	{
		vel = ToVector(trigger.Action);

		if ( vel.y > 0 )
		{
			Map.DoorStatus = 0;
			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_gate1" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_gate1" );
			
			Util.MapDebugPrint( "^1The Axis have closed the Gate !" );
		}
		else if ( vel.y < 0 )
		{
			Map.DoorStatus = 1;
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_gate1" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_gate1" );
			Util.MapDebugPrint( "^4The Allies have opened the Gate !" );
        }
	},
	
    Train_at_depot =
    {
 	Name="train_at_depot",
 	TriggerOnClass = { CLASS.VEHICLE_NODAMAGE },
 	OnEnter = function(ent)
 	{		
	if ( Map.phase == 5 )
	{
	 SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_tunnel.*" );
	 SetAvailableMapGoals( TEAM.AXIS, false, {"DEFEND_switch.*",".*MG42.*","RIDE_Train"} );
	 
	 SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_switch.*" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_train.*" );
	}
 		Util.MapDebugPrint( "^5Train at depot!" );
 	},
 	OnExit = function(ent)
 	{
	SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_switch.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_train.*" );
	
	SetAvailableMapGoals( TEAM.AXIS, true, {"DEFEND_switch.*",".*MG42.*","RIDE_Train"} );
    SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_tunnel.*" );
 		Util.MapDebugPrint( "^5Train leave the depot!" );
 	},
 },
    Train_at_tunnel =
    {
 	Name="train_at_tunnel",
 	TriggerOnClass = { CLASS.VEHICLE_NODAMAGE },
 	OnEnter = function(ent)
 	 {

 		Util.MapDebugPrint( "^5Train at tunnel!" );
 	},
 	OnExit = function(ent)
 	{ 
 		Util.MapDebugPrint( "^5Train leave tunnel!" );
 	},
 },
 vehicle_at_location = function( trigger )
	{
		switch(Map.VehicleLocation)
		{
			case 1: 
			{
            Map.tank_at_barrier1();
			}
			case 2: 
			{
			Map.tank_at_coner1();
			}
			case 3: 
			{
			Map.tank_at_corner2();
			}
			case 4: 
			{
			Map.tank_at_barrier2();
			}
		}
		Util.MapDebugPrint("vehicle at location " + Map.VehicleLocation, true);
	},
};
global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "^4Allied ^7Command Post constructed. Charge speed increased!", Map.Allied_CP_Built );
	OnTrigger( "Allied Team have built the Mine-Ramp!!", Map.Allied_Mine_Ramp_Built );
	OnTrigger( "^1Axis ^7Command Post constructed. Charge speed increased!", Map.Axis_CP_Built );
	OnTrigger( "The Tank has been repaired!", Map.Tank_Built );
	OnTrigger( "^5The tank has been damaged", Map.Tank_Destroyed );
	OnTrigger( "^2First tank barrier has been constructed!", Map.Tank_Barrier_1_Built );
	OnTrigger( "^2First tank barrier has been destroyed!", Map.Tank_Barrier_1_Destroyed );
	OnTrigger( "^4The tank is past the first barrier!!", Map.tank_past_barrier1 );
	OnTrigger( "^1Axis ^7spawn back!", Map.axis_spawn_back );
	OnTrigger( "^2Second tank barrier has been constructed!", Map.Tank_Barrier_2_Built );
	OnTrigger( "^2Second tank barrier has been destroyed!", Map.Tank_Barrier_2_Destroyed );
	OnTrigger( "^4The tank is past the second barrier!!", Map.tank_past_barrier2 );
	OnTrigger( "^1Axis ^7spawn in the Bunker!", Map.axis_spawn_bunker );
	OnTrigger( "The Allies breached the Depotwall!", Map.Depotwall_Destroyed );
	OnTrigger( "^1Axis ^7team has destroyed the ^4Allied ^7Command Post!", Map.Allied_CP_Destroyed );
	OnTrigger( "Axis have destroyed the Mine-Ramp!!", Map.Allied_Mine_Ramp_Destroyed );
	OnTrigger( "^4Allied ^7team has destroyed the ^1Axis^7 Command Post!", Map.Axis_CP_Destroyed );
	OnTrigger( "Allies have stolen The Replacement Part!", Map.Replacement_Part_Taken );
	OnTrigger( "^4Replacement Part 1 has been secured!!", Map.Replacement_Part_Secured );
	OnTrigger( "^4Replacement Part 2 has been secured!!", Map.Replacement_Part_1_Secured );
	OnTrigger( "Replacement Part 1 has been fixed!!", Map.Replacement_Part_1_Built );
	OnTrigger( "Replacement Part 2 has been fixed!!", Map.Replacement_Part_2_Built );
	OnTrigger( "^4Allies ^7captured the Depot!", Map.Train_Depot_Captured );
	OnTrigger( "tank at location", Map.vehicle_at_location );
	OnTrigger( "train at location", Map.vehicle_at_location );
	OnTrigger( "gate_button_start", Map.Switch_Used );
	
	Tankatb1 = OnTriggerRegion(AABB(1826.203,-416.792,82.916,2159.742,-305.928,175.134), RegionTrigger.VehicleTrigger);
	TankatCorner1 = OnTriggerRegion(AABB(493.021,-99.353,225.125,585.845,276.015,301.775), RegionTrigger.VehicleTrigger);
    TankatCorner2 = OnTriggerRegion(AABB(-564.820,-441.416,225.126,-113.877,-360.917,318.380), RegionTrigger.VehicleTrigger);
    Tankatb2 = OnTriggerRegion(AABB(-834.943,-1765.008,289.125,-783.678,-1374.228,372.662), RegionTrigger.VehicleTrigger);
	Train_at_depot = OnTriggerRegion(AABB(-1955.957,2130.860,73.125,-1659.408,2749.172,163.125),Map.Train_at_depot);
	Train_at_tunnel = OnTriggerRegion(AABB(-1967.584,3669.543,73.125,-1680.381,4510.494,163.140),Map.Train_at_tunnel);
	
	Util.DisableGoal( ".*", true ); // all but routes
	//activation ALLIES
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ESCORT_tank",
		"MOUNT_tank",
		"ATTACK_tb1.*",
	});
	
	//activation AXIS
	SetAvailableMapGoals( TEAM.AXIS, true, {
	"BUILD_Tank_Barrier_1",
	"DEFEND_tb1.*",
	".*CAB_uje4.*",
	});
	
	// Allied goals
	SetGoalPriority( "BUILD_Tank", 0.92 );
	SetGoalPriority( "PLANT_Tank_Barrier_1", 0.93, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Tank_Barrier_2", 0.93, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK.*", 0.80 );
	SetGoalPriority( "ESCORT_tank", 0.92 );
	SetGoalPriority( "SWITCH_gate1", 0.92 );
	SetGoalPriority( "RIDE_Train", 0.93 );
	SetGoalPriority( "MOUNT_tank", 0.83 );

	// Axis goals
	SetGoalPriority( "BUILD_Tank_Barrier_1", 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Tank_Barrier_2", 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Axis_CP", 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Allied_Mine_Ramp", 0.93, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "DEFEND.*", 0.91 );
	
	// Max users per goal
	Util.SetMaxUsers( 1, "ATTACK.*" );
	Util.SetMaxUsers( 1, "DEFEND.*" );
	Util.SetMaxUsers( 1, "MOUNT.*" );
	Util.SetMaxUsers( 1, "CAPPOINT.*" );
	Util.SetMaxUsers( 1, "ESCORT.*" );
	Util.SetMaxUsers( 2, "FLAG.*" );
	Util.SetMaxUsers( 1, "SWITCH_gate1" );
	Util.SetMaxUsers( 1, "RIDE_Train" );
	Util.SetMaxUsers( 1, "GRENADE.*" );

	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=25, MaxCampTime=90} );
    SetMapGoalProperties( "ATTACK_.*", {MinCampTime=30, MaxCampTime=60} );
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=30, MaxCampTime=60} );
	SetMapGoalProperties( "CAMP.*", {MinCampTime=15, MaxCampTime=40} );

	Util.LimitToClass("ESCORT_tank", TEAM.ALLIES, CLASS.FIELDOPS, CLASS.COVERTOPS, CLASS.ENGINEER);
	Util.LimitToClass("MOUNT_tank*", TEAM.ALLIES, CLASS.SOLDIER, CLASS.MEDIC, CLASS.FIELDOPS, CLASS.COVERTOPS);
	//Offset Plant Fix
    Util.SetGoalPosition( 1999, -699, 239, "PLANT_Tank_Barrier_1" );
	Util.SetGoalPosition( 930, -2113, 416, "PLANT_Allied_Mine_Ramp" );
	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{
	// Uncomment for shootable breakables
	bot.TargetBreakableDist = 90.0;
	// Only set MaxViewDistance on maps with limited sight (e.g. fog)
	//~bot.MaxViewDistance = 2400;
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		FLAG_Replacement_Part =
		{
		},
		FLAG_Replacement_Part_1 =
		{
		},
		BUILD_Replacement_Part_1 =
		{
		},
		PLANT_Replacement_Part_1 =
		{
		},
		BUILD_Replacement_Part_2 =
		{
		},
		PLANT_Replacement_Part_2 =
		{
		},
		BUILD_Allied_Mine_Ramp =
		{
		},
		PLANT_Allied_Mine_Ramp = 
		{
			ROUTE_bunker  = 
			{
				ROUTE_top_tb2  = {Weight=2},
				ROUTE_CAB_uje4  = {Weight=3},
			},
		},
		BUILD_Axis_CP =
		{
		},
		PLANT_Axis_CP =
		{
		},
		BUILD_Allied_CP =
		{
		},
		PLANT_Allied_CP =
		{
		},
		BUILD_Tank_Barrier_1 =
		{
		},
		PLANT_Tank_Barrier_1 = 
		{
		},
		BUILD_Tank_Barrier_2 =
		{
		},
		PLANT_Tank_Barrier_2 =
		{
		},
		BUILD_Tank =
		{
		},
	};
		MapRoutes["ATTACK_tb1_.*"] = {
			ROUTE_allies_spawn_first = {
				ROUTE_tunnel = {Weight=3},
				ROUTE_water = {Weight=2},
			},
	};	
		MapRoutes["DEFEND_parts.*"] = {
			ROUTE_spawn_parts = {
				ROUTE_axis_cp = {Weight=3},
				ROUTE_stairs = {Weight=2},
				ROUTE_wire_rack = {Weight=3},
				ROUTE_ladder = {Weight=1},
			},	
		};
		MapRoutes["DEFEND_train.*"] = {
			ROUTE_spawn_parts = {
				ROUTE_axis_cp = {Weight=3},
				ROUTE_stairs = {Weight=2},
				ROUTE_wire_rack = {Weight=3},
				ROUTE_ladder = {Weight=1},
			},
	};
			MapRoutes["DEFEND_tunnel.*"] = {
			ROUTE_last_axis_spawn = {
				ROUTE_top = {Weight=2},
				ROUTE_switch = {Weight=3},
				ROUTE_cp = {Weight=3},

			},
	};
	       MapRoutes["DEFEND_switch.*"] = {
			ROUTE_last_axis_spawn = {
				ROUTE_top = {Weight=2},
				ROUTE_switch = {Weight=3},
				ROUTE_MG42 = {Weight=2},
			},
	};
	//copy some routes
	MapRoutes["DEFEND_corner1.*"] = MapRoutes.PLANT_Allied_Mine_Ramp;

	Util.Routes(MapRoutes);
};
