//==========================================================================================
//
//	cortex_who.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
//	palota	14 November 2011	paththrough navigation, RideMover - lift1,lift2,mongolfier, DYNAMITE goals, SWITCH_cd1, SWITCH_helicopter
//	palota	3 December 2011	DEFEND, routes, roles, GRENADE_pc, tram paththrough navigation
//==========================================================================================
//

global Map =
{
	Debug = 0,
	cd1Secured = false,
	cd2Secured = false,
	cd3Secured = false,
	cd4Secured = false,
	elicoCalled = false,
	grate_flag_Destroyed = false,
	grate_cd2_Destroyed = false,
	grate_cd3_Destroyed = false,
	doorDestroyed = false,

	lift1Position = 0, //to the 3rd floor
	lift2Position = 0, //shaft near axis spawn
	tramPosition = 0,
	mongolfierPosition = 0, //airship on the 3rd floor
	Movers = { "MOVER_camionp1", "MOVER_as", "MOVER_mongolfier" },

	Roles =
	{
		AXIS =
		{
			AllBots = true,
			DEFENDER = {
				numbots = 16
			},
			ATTACKER = {
				numbots = 15
			}
		},
		ALLIES =
		{
			AllBots = true,
			DEFENDER = {
				numbots = 8
			},
			DEFENDER1 = {
				numbots = 9,
			},
			DEFENDER2 = {
				numbots = 9,
			},
			DEFENDER3 = {
				numbots = 9,
			},
		},
	},

	NavL = function(_this, x,y,z, x2,y2)
	{
		_this.AddAimRequest(Priority.High, "facing", Vec3(x,y,z));
		for(i=0; i<20; i+=1) {
			pos = _this.Bot.GetPosition();
			if(Abs(pos.x - x2) > 60 || Abs(pos.y - y2) > 60){ break; }
			sleep(0.5);
		}
	},

	Navigation =
	{
		l1 = {navigate=function(_this){ //238
			Map.NavL(_this, -0.2,0,0.8,  -4967.875, 237.950);
		}},
		l2 = {navigate=function(_this){ //203,204
			Map.NavL(_this, -0.2,0,0.8,  -4967.699, 687.045);
		}},
		l3 = {navigate=function(_this){ //549
			_this.AddAimRequest(Priority.High, "facing", Vec3(0.2,0,0.8));
			_this.Bot.HoldButton(BTN.BACKWARD, BTN.STRAFE_L, 2);
			sleep(3);
		}},
		l4 = {navigate=function(_this){ //161
			Map.NavL(_this, 0,0.2,0.8,  -5371.135, 1925.875);
		}},
		l5 = {navigate=function(_this){ //612
			Map.NavL(_this, 0,0.2,0.8,  -1336.151, -800.253);
		}},
		l6 = {navigate=function(_this){ //645
			Map.NavL(_this, 0,0.2,0.8,  -4475.482, 1925.875);
		}},
		l7 = {navigate=function(_this){ //712
			_this.AddAimRequest(Priority.High, "facing", Vector3(0.4,0,-0.9));
			_this.Bot.HoldButton(BTN.CROUCH, 5);
			for(i=0; i<100 && _this.Bot.GetPosition().z > -1190; i+=1){
				_this.Bot.PressButton(BTN.BACKWARD);
				yield();
			}
			_this.Bot.ReleaseButton(BTN.CROUCH);
			_this.Bot.HoldButton(BTN.FORWARD, 10);
			z1 = _this.Bot.GetPosition().z;
			for(i=0; i<60; i+=1){
				z = _this.Bot.GetPosition().z;
				if(z>z1){ break; }
				z1=z;
				yield();
			}
			_this.Bot.ReleaseButton(BTN.FORWARD);
			_this.AddAimRequest(Priority.High, "facing", Vector3(0.4,0,0.9));
			_this.Bot.HoldButton(BTN.BACKWARD, 10);
			for(i=0; i<15 && _this.Bot.GetPosition().z > -1880; i+=1){
				sleep(1);
			}
			_this.Bot.ReleaseButton(BTN.BACKWARD);
			_this.AddAimRequest(Priority.High, "facing", Vector3(-1,0,0));
			_this.Bot.HoldButton(BTN.FORWARD, 0.5);
			sleep(1);
		}},
		l8 = {navigate=function(_this){ //721
			Map.NavL(_this, -0.2,0,0.8,  -1306.056, -338.125);
		}},
		l9 = {navigate=function(_this){ //732
			Map.NavL(_this, 0,0.2,0.8,  481.794, 224.342);
		}},
		desk = {navigate=function(_this){ //255
			_this.AddAimRequest(Priority.High, "facing", Vec3(0,-0.2,0.8));
			sleep(0.1);
			_this.Bot.HoldButton(BTN.FORWARD, 1);
			for(i=0; i<9 && _this.Bot.GetPosition().z<-700; i+=1) {
				sleep(0.5);
			}
			_this.Bot.HoldButton(BTN.STRAFE_L, 7);
			for(i=0; i<14; i+=1) {
				z = _this.Bot.GetPosition().z;
				if(z>-600 || z<-800){ break; }
				sleep(0.5);
			}
			_this.Bot.ReleaseButton(BTN.STRAFE_L);
		}},
		lamp = {navigate=function(_this){ //300
			_this.AddAimRequest(Priority.High, "position", Vec3(580,-915,-2012));
			for(i=0; i<15; i+=1) {
				z = _this.Bot.GetPosition().z;
				if(z>-2040 || z<-2220){ break; }
				sleep(0.5);
			}
		}},
		fall_cd1 = {navigate=function(_this){ //714
			_this.Goto(_this.Bot.GetPosition());
			_this.AddAimRequest(Priority.High, "facing", Vector3(0,0.4,-0.9));
			_this.Bot.HoldButton(BTN.CROUCH, 4);
			for(i=0; i<100 && _this.Bot.GetPosition().z > -1195; i+=1){
				_this.Bot.PressButton(BTN.FORWARD);
				yield();
			}
			_this.Bot.ReleaseButton(BTN.CROUCH);
			sleep(1.5);
		}},
		jump = {navigate=function(_this){ //462
			for(i=0; i<3 && _this.Bot.GetPosition().x > -525; i+=1) {
				_this.Goto(Vec3(-508.935, -1060.115, -471.672));
				_this.AddAimRequest(Priority.High, "facing", Vec3(-0.4,0,0.5));
				_this.Bot.PressButton(BTN.JUMP);
				sleep(0.5);
				_this.Bot.ResetStuckTime();
				_this.Bot.HoldButton(BTN.FORWARD,0.5);
				sleep(0.5);
			}
		}},
		helicopter_cd = {navigate=function(_this){ //514
			if(_this.Bot.GetTeam()==TEAM.AXIS) {
				for(i=0; i<8 && !_this.Bot.HasEntityFlag(ENTFLAG.CARRYINGGOAL); i+=1){
					_this.AddAimRequest(Priority.High, "position", Vec3(-3129,620,-625));
					yield();
					_this.Bot.PressButton(BTN.USE);
					sleep(0.3);
				}
			}
			sleep(0.5);
		}},
		cable = {navigate=function(_this){ //499
			_this.AddAimRequest(Priority.High, "facing", Vec3(0,0.9,-0.3));
			_this.Goto(_this.Bot.GetPosition());
			for(i=0; i<200; i+=1)
			{
				pos = _this.Bot.GetPosition();
				if(pos.z<400){ break; }
				if(i % 20 == 0 && pos.y < -160){
					_this.Bot.PressButton(BTN.USE);
				}
				_this.Bot.MoveTowards(pos);
				yield();
			}
		}},
		tram = {navigate=function(_this){ //16
			bot = _this.Bot;
			dowhile( Map.tramPosition==0 )
			{
				_this.Goto(Vec3(-1400.704, 1844.914, -2239.712));
				yield();
			}
			Util.MapDebugPrint("tram enter", true);
			bot.HoldButton(BTN.CROUCH,3);
			sleep(0.25);
			for(;;)
			{
				pos = bot.GetPosition();
				if(pos.x < -1600) { break; }
				bot.MoveTowards(Vec3(-1733.368, 1796.223, -2246.875));
				yield();
			}
			end = Vec3(-4757.100, 1838, -732.875);
			for(i=0; bot.DistanceTo(end) > 195; i+=1)
			{
				pos = bot.GetPosition();
				if(pos.x > -2200 && i > 40 || i > 250){
					Util.MapDebugPrint("tram enter failed", true);
					_this.Goto(Vec3(-1457.609, 1587.521, -2246.875));
					return;
				}
				bot.MoveTowards(Vec3(pos.x,1800,pos.z));
				yield();
			}
			Util.MapDebugPrint("tram exit", true);
			for(i=0; i<170; i+=1)
			{
				pos = bot.GetPosition();
				if(pos.x > -4455 || pos.x <-4680){ break; }
				if(pos.y<1840){ y=end.y - 400; }
				else{ y=end.y + 300; }
				bot.MoveTowards(Vec3(end.x,y,end.z));
				yield();
			}
		}},
	},

	RideMovers =
	{
		lift1 =
		{
			movergoal = "MOVER_camionp1",
			rideposition = Vector3(0,0,0),
			startwp = "lift1_in",
			exitwp = "lift1_out",
			board = function(_this)
			{
				return Map.lift1Position == 1;
			},
			leave = function(_this)
			{
				return Map.lift1Position == 3;
			},
		},
		lift2 =
		{
			movergoal = "MOVER_as",
			rideposition = Vector3(10,0,0),
			startwp = "lift2_in",
			exitwp = "lift2_out",
			board = function(_this)
			{
				return Map.lift2Position == 1;
			},
			leave = function(_this)
			{
				return Map.lift2Position == 3;
			},
		},
		mongolfier =
		{
			movergoal = "MOVER_mongolfier",
			rideposition = Vector3(0,0,0),
			startwp = "mongolfier_in",
			exitwp = "mongolfier_out",
			board = function(_this)
			{
				return Map.mongolfierPosition == 1;
			},
			leave = function(_this)
			{
				return Map.mongolfierPosition == 2;
			},
		},
	},

	Tram_Start = {
		Name = "Tram_Start",
		TriggerOnClass = { CLASS.VEHICLE_NODAMAGE, CLASS.GOAL },
		OnEnter = function(ent)
		{
			sleep(1);
			Map.tramPosition=1;
			sleep(0.5);
			Map.tramPosition=0;
		},
	},


	camionp1_goto = function(trigger)
	{
		if(ToVector(trigger.Action).z > 0){
			Map.lift1Position = 2;
			//Util.MapDebugPrint("lift1 moving up", true);
			sleep(4.5);
			Map.lift1Position = 3;
			//Util.MapDebugPrint("lift1 is up", true);
		}else{
			Map.lift1Position = 4;
			//Util.MapDebugPrint("lift1 moving down", true);
			sleep(4.5);
			Map.lift1Position = 1;
			//Util.MapDebugPrint("lift1 is down", true);
		}
	},

	as_goto = function(trigger)
	{
		if(ToVector(trigger.Action).z > 0){
			Map.lift2Position = 2;
			//Util.MapDebugPrint("lift2 moving up", true);
			sleep(5.5);
			Map.lift2Position = 3;
			//Util.MapDebugPrint("lift2 is up", true);
		}else{
			Map.lift2Position = 4;
			//Util.MapDebugPrint("lift2 moving down", true);
			sleep(5.5);
			Map.lift2Position = 1;
			//Util.MapDebugPrint("lift2 is down", true);
		}
	},

	cdbas_goto = function(trigger)
	{
		if(!Map.cd1Secured) {
			if(ToVector(trigger.Action).y > 0){
				Wp.SetWaypointFlag("cd1", "closed", false);
				SetAvailableMapGoals(TEAM.AXIS, true, "FLAG_cd1");
				Util.LimitToTeam(TEAM.ALLIES, "SWITCH_cd1");
				Util.SetRoleForGoals("SWITCH_cd1", ROLE.DEFENDER1 );
				Util.MapDebugPrint("cd1 opened");
			}else{
				SetAvailableMapGoals(TEAM.AXIS, false, "FLAG_cd1");
				Wp.SetWaypointFlag("cd1", "closed", true);
				Util.LimitToTeam(TEAM.AXIS, "SWITCH_cd1");
				Util.ClearRoleForGoals("SWITCH_cd1", ROLE.DEFENDER1 );
				Util.MapDebugPrint("cd1 closed");
			}
		}
	},

	elico_goto = function(trigger)
	{
		if(!Map.elicoCalled){
			Map.elicoCalled = true;
			SetAvailableMapGoals(TEAM.AXIS, false, "SWITCH_helicopter");
			SetAvailableMapGoals(TEAM.ALLIES, false, "DEFEND_heli.*");
			Util.MapDebugPrint("helicopter used to take cd4");
		}
	},


	door_Destroyed = function( trigger )
	{
		Map.doorDestroyed = true;
		if(!Map.cd3Secured){
			SetAvailableMapGoals(TEAM.AXIS, true, "FLAG_cd3");
			SetAvailableMapGoals(TEAM.ALLIES, true, "DEFEND_cd3.*");
			Util.ClearRoleForGoals("DEFEND_heli.*", ROLE.DEFENDER3 );
		}
		if(!Map.grate_cd3_Destroyed){
			SetAvailableMapGoals(TEAM.AXIS, true, "DYNAMITE_cd3");
		}
		Util.MapDebugPrint("door_Destroyed");
	},

	cd1_Secured = function( trigger )
	{
		Map.cd1Secured = true;
		Util.SetRoleForGoals("CHECKPOINT_roadbunker", ROLE.DEFENDER1);
		SetAvailableMapGoals(TEAM.ALLIES, false, {
			".*MG42_tower",
			"DEFEND_cd1.*",
		});
		Util.DisableGoal("SWITCH_cd1");
		Util.MapDebugPrint("cd1_Secured");
	},
	cd2_Secured = function( trigger )
	{
		Map.cd2Secured = true;
		Util.SetRoleForGoals("CHECKPOINT_roadbunker", ROLE.DEFENDER2);
		SetAvailableMapGoals(TEAM.ALLIES, false, "DEFEND_cd2.*");
		Util.MapDebugPrint("cd2_Secured");
	},
	cd3_Secured = function( trigger )
	{
		Map.cd3Secured = true;
		Util.SetRoleForGoals("CHECKPOINT_roadbunker", ROLE.DEFENDER3);
		SetAvailableMapGoals(TEAM.ALLIES, false, "DEFEND_cd3.*");
		if(!Map.doorDestroyed){
			SetAvailableMapGoals(TEAM.AXIS, false, "PLANT_porte_de_minus_2eme_etage");
		}
		Util.MapDebugPrint("cd3_Secured");
	},
	cd4_Secured = function( trigger )
	{
		Map.cd4Secured = true;
		SetAvailableMapGoals(TEAM.AXIS, false, "SWITCH_helicopter");
		SetAvailableMapGoals(TEAM.ALLIES, false, "DEFEND_heli.*");
		Util.MapDebugPrint("cd4_Secured");
	},


	SetFlag = function(axis)
	{
		SetAvailableMapGoals(TEAM.AXIS, axis, ".*Command_Post.*");
		SetAvailableMapGoals(TEAM.ALLIES, !axis, ".*Command_Post.*");
		SetAvailableMapGoals(TEAM.AXIS, axis, ".*MG42_pc");
		SetAvailableMapGoals(TEAM.ALLIES, !axis, ".*MG42_pc");
		SetAvailableMapGoals(TEAM.AXIS, !axis, "GRENADE_pc");
		SetAvailableMapGoals(TEAM.ALLIES, axis, "GRENADE_pc");
		SetAvailableMapGoals(TEAM.AXIS, !axis, ".*MG42_stairs");
		SetAvailableMapGoals(TEAM.AXIS, axis, {
			"DEFEND_x.*",
			"MOBILEMG42_x.*",
		});
		SetAvailableMapGoals(TEAM.ALLIES, !axis, {
			"DEFEND_l.*",
			"MOBILEMG42_l.*",
			"TRIPMINE_l.*",
		});
		if(axis){ p=0.85; } else { p=0.81; }
		SetGoalPriority( "PLANT_porte_de_minus_2eme_etage", p);
	},

	flag_Axis_Captured = function( trigger )
	{
		Map.SetFlag(true);
		Util.MapDebugPrint("flag_Axis_Captured");
	},

	flag_Allies_Captured = function( trigger )
	{
		Map.SetFlag(false);
		Util.MapDebugPrint("flag_Allies_Captured");
	},


	grate_axis_spawnExploded = function(trigger)
	{
		SetAvailableMapGoals(TEAM.AXIS, false, "DYNAMITE_axis_spawn");
		if(!Map.grate_flag_Destroyed){
			SetAvailableMapGoals(TEAM.AXIS, true, "DYNAMITE_flag");
		}
		if(!Map.grate_cd2_Destroyed){
			SetAvailableMapGoals(TEAM.AXIS, true, "DYNAMITE_cd2");
		}
		if(!Map.grate_cd3_Destroyed){
			SetAvailableMapGoals(TEAM.AXIS, true, "DYNAMITE_cd3");
		}
		Util.EnableGoal("ROUTE_grate_axis");
		Util.MapDebugPrint("grate_axis_spawnExploded");
	},
	grate_flagExploded = function(trigger)
	{
		Map.grate_flag_Destroyed = true;
		SetAvailableMapGoals(TEAM.AXIS, false, "DYNAMITE_flag");
		Util.EnableGoal("ROUTE_grate_flag");
		Util.MapDebugPrint("grate_flagExploded");
	},
	grate_cd2Exploded = function(trigger)
	{
		Map.grate_cd2_Destroyed = true;
		SetAvailableMapGoals(TEAM.AXIS, false, "DYNAMITE_cd2");
		Util.EnableGoal("ROUTE_grate_cd2");
		Util.MapDebugPrint("grate_cd2Exploded");
	},
	grate_cd3Exploded = function(trigger)
	{
		Map.grate_cd3_Destroyed = true;
		SetAvailableMapGoals(TEAM.AXIS, false, "DYNAMITE_cd3");
		if(!Map.cd3Secured){
			SetAvailableMapGoals(TEAM.AXIS, true, "FLAG_cd3");
			SetAvailableMapGoals(TEAM.ALLIES, true, "DEFEND_cd3.*");
			Util.ClearRoleForGoals("DEFEND_heli.*", ROLE.DEFENDER3 );
		}
		Util.EnableGoal("ROUTE_grate_cd3");
		Util.MapDebugPrint("grate_cd3Exploded");
	},
	glass_cd1Exploded = function(trigger)
	{
		Wp.SetWaypointFlag("cd1up1", "closed", false);
		Wp.SetWaypointFlag("cd1up2", "closed", true);
		Util.MapDebugPrint("glass_cd1Exploded");
	},

	WatchMongolfier = function()
	{
		entity = GetGoal("MOVER_mongolfier").GetEntity();
		start = Vec3(-3750, -29, 1307);
		end = Vec3(-4325, 1731, 1240);
		for(;;)
		{
			if ( DistanceBetween( entity, start ) < 250)
			{
				Map.mongolfierPosition = 1;
				//Util.MapDebugPrint("mongolfier start", true);
			}
			else if ( DistanceBetween( entity, end ) < 300)
			{
				Map.mongolfierPosition = 2;
				//Util.MapDebugPrint("mongolfier end", true);
			}
			else
			{
				Map.mongolfierPosition = 0;
			}
			sleep(1);
		}
	},
};

global OnMapLoad = function()
{
	OnTrigger( "Allies capture the Forward Bunker!", Map.flag_Allies_Captured );
	OnTrigger( "Axis reclaim the Forward Bunker!", Map.flag_Axis_Captured );
	OnTrigger( "porte de minus (2eme etage) Destroyed.", Map.door_Destroyed );
	OnTrigger( "Les axes on le cd 1", Map.cd1_Secured );
	OnTrigger( "Les axes on le cd 2", Map.cd2_Secured );
	OnTrigger( "Les axes on le cd 3", Map.cd3_Secured );
	OnTrigger( "Les axes on le cd 4", Map.cd4_Secured );
	OnTrigger("cdbas_goto", Map.cdbas_goto);
	OnTrigger("elico_goto", Map.elico_goto);
	OnTrigger("camionp1_goto", Map.camionp1_goto);
	OnTrigger("as_goto", Map.as_goto);
	OnTrigger("GRENADE_grate_axis_spawn Exploded.", Map.grate_axis_spawnExploded);
	OnTrigger("GRENADE_grate_flag Exploded.", Map.grate_flagExploded);
	OnTrigger("GRENADE_grate_cd2 Exploded.", Map.grate_cd2Exploded);
	OnTrigger("GRENADE_grate_cd3 Exploded.", Map.grate_cd3Exploded);
	OnTrigger("GRENADE_glass_cd1 Exploded.", Map.glass_cd1Exploded);

	OnTriggerRegion(AABB(-1504.793,1900.826,-2272.605,-1409.701,1941.368,-2156.813),Map.Tram_Start);
	OnTriggerRegion(AABB(-4600,1680.655,-2269.875,-1390,2030.875,-512.875),RegionTrigger.DisableBotPush); //tram
	OnTriggerRegion(AABB(958.518,-1064.266,-2091.100,1217.779,-849.723,-1309.294),RegionTrigger.DisableBotPush); //cd1
	OnTriggerRegion(AABB(-502.993,-1141.052,-636.093,-309.041,-829.999,-354.092),RegionTrigger.DisableBotPush); //cd3
	OnTriggerRegion(AABB(-6757.539,425.793,-673.679,-6583.428,2084.875,464.633),RegionTrigger.DisableCombatMovement); //stairs to the 3rd floor
	OnTriggerRegion(AABB(-2935.362,-700.252,-1115.518,-2812.620,-387.665,-634.237),RegionTrigger.DisableBotPush); //Axis shaft
	OnTriggerRegion(AABB(-4236.022,1857.000,-824.166,-4121.771,1900.410,-706.081),RegionTrigger.KillTrigger); //tram

	Util.DisableGoal( ".*", true );
	Util.DisableGoal("ROUTE_grate_.*");
	Util.EnableGoal("AMMOCAB.*");
	Util.EnableGoal("HEALTHCAB.*");
	Util.EnableGoal("CHECKPOINT_roadbunker");

	Util.ClearRoleForGoals("CHECKPOINT_roadbunker", { ROLE.DEFENDER1,ROLE.DEFENDER2,ROLE.DEFENDER3 } );
	Util.SetRoleForTable({ "CHECKPOINT_roadbunker", "MOUNTMG42_pc", "DEFEND_x.*", "GRENADE_pc" }, ROLE.DEFENDER );
	Util.SetRoleForTable({ "DEFEND_cd1.*", "MOUNTMG42_tower" }, ROLE.DEFENDER1 );
	Util.SetRoleForGoals( "DEFEND_cd2.*", ROLE.DEFENDER2 );
	Util.SetRoleForTable({ "DEFEND_cd3.*", "DEFEND_heli.*" }, ROLE.DEFENDER3 );
	Util.ClearRoleForGoals("SWITCH_cd1", ROLE.DEFENDER1 );

	SetAvailableMapGoals(TEAM.AXIS, true, {
		"FLAG_cd[24]",
		"CAPPOINT_pc",
		"DYNAMITE_axis_spawn",
		"PLANT_porte_de_minus_2eme_etage",
		"SWITCH_cd1",
		"SWITCH_helicopter",
	});

	SetAvailableMapGoals(TEAM.ALLIES, true, {
		".*MG42_tower",
		"DEFEND_cd1.*",
		"DEFEND_cd2.*",
		"DEFEND_heli.*",
		"TRIPMINE_l1",
	});

	SetGoalPriority( "DYNAMITE_.*", 0.84);
	SetGoalPriority( "FLAG_.*", 0.6);
	SetGoalPriority( "SWITCH_cd1", 0.75);
	SetGoalPriority( "DEFEND_x.*", 0.62);

	foreach (goal in { ".*MG42.*", ".*Command_Post.*", "SWITCH_cd1", "DYNAMITE.*" }){
		Util.SetMaxUsers(1, goal);
	}

	SetMapGoalProperties("DEFEND_.*", {mincamptime=20, maxcamptime=60} );

	Wp.SetWaypointFlag("cd1up1", "closed", true);
	Wp.SetWaypointFlag("cd1up2", "closed", false);
	Wp.SetWaypointFlag("cd1", "closed", true);

	Util.AddUsePoint("DYNAMITE_cd3", { Vec3(-1532.882, -535.418, -239.829), Vec3(-1418.901, -545.022, -241.875) } );

	thread(Map.WatchMongolfier);

	MapRoutes =
	{
		CHECKPOINT_roadbunker = {
			ROUTE_axis = {
				ROUTE_grate_axis = {
					ROUTE_grate_flag = {
						ROUTE_desk = {
							ROUTE_desk1 = {},
							ROUTE_desk2 = {},
						}
					},
					ROUTE_allied_north = { ROUTE_desk = {}},
				},
				ROUTE_door1 = { Weight=2,
					ROUTE_tram_bottom = { ROUTE_desk = {}},
					ROUTE_tram_top = { ROUTE_desk = {}},
				},
			},
			ROUTE_allied = {
				ROUTE_minus2 = { ROUTE_desk = {}},
				ROUTE_allied_north = { Weight=1.5, ROUTE_desk = {}},
				ROUTE_grate_flag = { Weight=0.5 },
			},
		},
		SWITCH_helicopter = {
			ROUTE_axis = {
				ROUTE_grate_axis = { Weight=2,
					ROUTE_grate_flag = {},
					ROUTE_allied_north = {},
				},
				ROUTE_door1 = {
					ROUTE_tram_bottom = {},
					ROUTE_tram_top = {},
				},
			}
		},
		SWITCH_cd1 = {
			ROUTE_allied = {
				ROUTE_stairs2 = {},
				ROUTE_grate_axis = { Weight=2 },
			},
		},
		FLAG_cd1 = {
			ROUTE_axis = {
				ROUTE_cd1_0 = {
					ROUTE_cd1_1 = {},
					ROUTE_cd1_2 = {},
					ROUTE_cd1_4 = {},
				}
			},
			ROUTE_flag = {
				ROUTE_cd1_0 = {},
			},
		},
		FLAG_cd2 = {
			ROUTE_axis = {
				ROUTE_grate_cd2 = { Weight=2 },
				ROUTE_door2 = {
					ROUTE_lift1 = { ROUTE_cd2_floor = {}},
					ROUTE_stairs3 = {},
				},
			},
			ROUTE_flag = {
				ROUTE_tomjerry = { ROUTE_stairs3 = {}},
				ROUTE_door2 = { Weight=2 },
			},
		},
		MOUNTMG42_tower = {
			ROUTE_flag = {
				ROUTE_cd1_0 = {
					ROUTE_cd1_1 = {},
					ROUTE_cd1_2 = {},
					ROUTE_cd1_4 = {},
				}
			},
			ROUTE_allied = {
				ROUTE_grate_axis = {},
				ROUTE_stairs2 = { ROUTE_cd1_0 = {}},
			},
		},
	};
	MapRoutes.PLANT_porte_de_minus_2eme_etage = MapRoutes.SWITCH_helicopter;
	MapRoutes.GRENADE_pc = MapRoutes.CHECKPOINT_roadbunker;
	Util.Routes(MapRoutes);

	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};
