//==========================================================================================
//
//	axislab_final.gm
//
//	Who      	When			What
//------------------------------------------------------------------------------------------
//	d00d					revision of script for OB 0.71/0.8x
//			03.03.2013		supplemented and modified by Qiki and Native12
//	native12	07.04.2013		ready to test
//			08.04.2013		added triggers for N!tmod
//			12.04.2013		minor adjustments
//			23.12.2018		fixed stuckages, fixed plant goal "PLANT_Main_Entrance.*" for Nitmod
//==========================================================================================
//

global Map =
{
	Allied_Command_Post_Dyno = 0,
	Allied_mg_Nest_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	Axis_mg_Nest_Dyno = 0,
	Back_Door_Dyno = 0,
	Cart_Ramp_Dyno = 0,
	Elevator_Generator_Dyno = 0,
	Main_Entrance_to_the_Nuke_Dyno = 0,
	Root_Cellar_Dyno = 0,
	Sewers_Dyno = 0,
	Truck_Barrier_Dyno = 0,

	DefendingTeam = TEAM.AXIS,

	Talk = true,
	Elevator = true,
	NukeIsInTheCabin = false,
	NukeIsOnTheTruck = false,
	NukeTaken = false,
	DoorIsOpen = false,
	Phase1 = true,
	BarrierIsBuilt = false,
	TruckIsAtBarrier = false,
	ElevatorAtLevel = 3,
	RockOpen = 0,
	sewers = true,
	root_cellar = true,
	back_door = true,
	Hill_Top = false,
	truckatdoor = false,
	Axis_MG = false,
	Cart_Ramp = false,
	Allied_MG = false,
	Allied_CP = false,
	Axis_CP = false,
	Truck_Past_Barrier_1 = false,
	Truck_Past_Barrier_2 = false,
	BookcaseOpened = false,
	Allies_Win = false,
	NukeLeftRoom = false,
	Nuke_atElevatorDoor = false,
	LowestDoor_closed = true,
	TopDoor_closed = true,
	NukeAtCartRamp = false,
	hillflag_Allies = false,
	SewerHatchExploded = false,
	RockOpened = false,
	RockClosing = false,
	RockOpening = false,

	// region triggers
	iw1 = 0,
	iw2 = 0,
	iw3 = 0,
	iw4 = 0,
	iw5 = 0,
	ac1 = 0,

	Roles =
	{
		AXIS =
		{
			DEFENDER =
			{
				spawnpt = 3,
				numbots = 4,
				crucialClass = CLASS.COVERTOPS,
			},
		},
	},

	Movers =
	{
		// retain these movers
		"MOVER_truck",
		"MOVER_cart",
		"MOVER_elevator",
		//added:
		"MOVER_b3door3",
		"MOVER_cabindoor1",
	},

	Switches =
	{
		wall_switch =
		{
			AimPosition = Vec3(984, 2244, 515),
			Enabled = true,
			Priority = 0.0,
			WaypointName = "wall_switch",
			Timeout = 1500,

			ExitConditions =
			{
				f = function(bot)
				{
					return Map.RockOpened;
				}
			},

			Wait = function()
			{
				return Map.RockOpened;
			},
		},
		house_switch =
		{
			AimPosition = Vec3(-912, 2352, 1158),
			Enabled = false,
			//			Priority = 0.7,
			Timeout = 1500,
			WaypointName = "house_switch",
			LimitTeam = (1<<TEAM.ALLIES),
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 700,
		},
		bookshelf_switch =
		{
			Enabled = false,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "bookshelf_switch",
			LimitTeam = (1<<TEAM.ALLIES),
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 1000,
		},
		elevator_door =
		{
			Enabled = false,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "elevator_door",
			LimitTeam = 0,
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 100,
		},
		elevator_switch_up_0 =
		{
			AimPosition = Vec3(-928, 2336, 130),
			Enabled = false,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "elevator_switch_up_0",
			LimitTeam = (1<<TEAM.ALLIES | 1<<TEAM.AXIS),
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 1000,
		},
		elevator_switch_up_1 =
		{
			Enabled = true,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "elevator_switch_up_1",
			LimitTeam = 0,
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 1500,
		},
		elevator_switch_up_2 =
		{
			Enabled = true,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "elevator_switch_up_2",
			LimitTeam = 0,
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 1500,
		},
		elevator_switch_up_3 =
		{
			Enabled = true,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "elevator_switch_up_3",
			LimitTeam = 0,
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 1500,
		},
		elevator_switch_level_1 =	//Generator
		{
			//	/bot aim_pos
			AimPosition = Vec3(-928.875, 2336.179, 765.575),
			Enabled = false,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "elevator_switch_level_1",
			LimitTeam = (1<<TEAM.AXIS),
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 1500,
		},
		elevator_switch_level_2 =	//Axis spawn
		{
			//	/bot aim_pos
			AimPosition = Vec3(-928.875, 2336.101, 507.321),
			Enabled = false,
			//			Priority = 0.8,
			Timeout = 1500,
			WaypointName = "elevator_switch_level_2",
			LimitTeam = (1<<TEAM.AXIS),
			LimitClass = Util.AllClasses,
			LimitBots = 1,
			LimitDistance = 2000,
		},
	},

	Navigation =
	{
		//  	/bot waypoint_setproperty paththrough Navigation_PT:rockwait
		rockwait =
		{
			EvalFunc = function() // if this function returns false, navigation will not run
			{
				return !Map.RockOpened;
			},

			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Rock_wait_wp", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					if ( Map.RockOpening or Map.RockClosing )
					{
						while ( Map.RockOpening or Map.RockClosing )
						{
							yield();
						}
						yield();
						_this.AddAimRequest(Priority.High, "facing", wpTable.facing);
						sleep(0.1);
						_this.Bot.HoldButton(BTN.FORWARD, 0.1);
						sleep(0.1);
						_this.ReleaseAimRequest();
					}
					else
					{
						_this.AddAimRequest(Priority.High, "facing", wpTable.facing);
						sleep(0.1);
						_this.Bot.HoldButton(BTN.FORWARD, 0.1);
						sleep(0.1);
						_this.ReleaseAimRequest();
					}
				}
			},
		},

		//  	/bot waypoint_setproperty paththrough Navigation_PT:jump
		jump =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Jump", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					sleep(0.1);
					_this.Bot.HoldButton(BTN.FORWARD, 0.55);
					_this.Bot.HoldButton(BTN.JUMP, 0.55);
					sleep(0.55);
				}
			},
		},

		//  	/bot waypoint_setproperty paththrough Navigation_PT:hill
		hill =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Hill_Jump", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					sleep(0.2);
					_this.Bot.HoldButton(BTN.FORWARD, 0.25);
					_this.Bot.HoldButton(BTN.JUMP, 0.1);
					sleep(0.25);
					_this.AddAimRequest(Priority.VeryHigh, "facing", Vector3(-0.032678,-0.367910,-0.929287));
					_this.Bot.HoldButton(BTN.FORWARD, 0.2);
					sleep(1);
				}
			},
		},

		//  	/bot waypoint_setproperty paththrough Navigation_PT:metal_shelf
		metal_shelf =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Metal_Shelf", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					sleep(0.25);
					_this.Bot.HoldButton(BTN.FORWARD, 0.55);
					_this.Bot.HoldButton(BTN.JUMP, 0.55);
					sleep(0.3);
					_this.Bot.HoldButton(BTN.CROUCH, 0.25);
					sleep(0.25);
				}
			},
		},

		//  	/bot waypoint_setproperty paththrough Navigation_PT:hatch
		hatch =
		{
			EvalFunc = function() // if this function returns false, navigation will not run
			{
				return !Map.SewerHatchExploded;
			},

			gotowp = "SewerHatch", // waypoint for the bot to go to before doing anything else

			navigate = function(_this)
			{
				if ( !Map.SewerHatchExploded )
				{
					_this.AddWeaponRequest(WEAPON.KNIFE);

					_this.AddAimRequest(Priority.High, "position", Vector3(-80.666, 350.651, 233.125));
					_this.AddAimRequest(Priority.High, "facing", Vector3(-0.385, 0.019, -0.923));

					while( !Map.SewerHatchExploded )
					{
						_this.Bot.HoldButton(BTN.CROUCH, 1);
						_this.Bot.HoldButton(BTN.ATTACK1, 1);
						yield();
					}

					_this.ReleaseWeaponRequest();
					_this.Bot.HoldButton(BTN.CROUCH, 1);
					_this.Bot.HoldButton(BTN.FORWARD, 1);
					sleep(1);
					_this.ReleaseAimRequest();
				}
				else
				{
					//_this.AddAimRequest(Priority.High, "facing", Vector3(-0.279, 0.001, -0.960));
					_this.AddAimRequest(Priority.High, "facing", Vector3(-0.264501,0.006747,-0.964362));
					yield();
					_this.Bot.HoldButton(BTN.CROUCH, 1.5);
					_this.Bot.HoldButton(BTN.FORWARD, 1.5);
					sleep(1.5);
					_this.ReleaseAimRequest();
				}
			},
		},
	},

	Truck_Barrier_Built = function( trigger )
	{

		Map.BarrierIsBuilt = true;

		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Truck_Barrier" );

		if ( Map.TruckIsAtBarrier )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"ESCORT_truck",
				"BUILD_Truck",
			});

			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Truck_Barrier" );
		}

		if ( Map.Phase1 and !Map.Truck_Past_Barrier_1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Truck_Barrier" );
		}

		if ( Map.NukeIsOnTheTruck and !Map.Truck_Past_Barrier_2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Truck_Barrier" );
		}

		Util.MapDebugPrint( "^5Truck_Barrier_Built" );
	},

	Truck_Barrier_Planted = function( trigger )
	{

		Map.Truck_Barrier_Dyno += 1;

		Util.MapDebugPrint( "^5Truck_Barrier_Planted" );
	},

	Truck_Barrier_Defused = function( trigger )
	{

		Map.Truck_Barrier_Dyno -= 1;

		Util.MapDebugPrint( "^5Truck_Barrier_Defused" );
	},

	Truck_Barrier_Destroyed = function( trigger )
	{

		if ( Map.Truck_Barrier_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Truck_Barrier_.*" );
		}

		Map.Truck_Barrier_Dyno = 0;
		Map.BarrierIsBuilt = false;

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Truck_Barrier" );

		if ( Map.TruckIsAtBarrier )
		{
			if ( Map.Truck )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Truck" );
			}
		}
		if ( Map.Phase1 and !Map.Truck_Past_Barrier_1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Truck_Barrier" );
		}

		if ( ( !Map.Phase1 and !Map.Truck_Past_Barrier_2 ) and ( Map.NukeSecured or Map.NukeIsInTheCabin or Map.NukeIsOnTheTruck ) )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Truck_Barrier" );
		}

		Util.MapDebugPrint( "^5Truck_Barrier_Destroyed" );
	},

	truck_near_barrier = function( trigger )
	{

		SetAvailableMapGoals( TEAM.AXIS, true, "AIRSTRIKE_Axis_TruckNearBarrier" );

		ETUtil.SetExcludeIndexes( "BUILD_Truck", { 2, 3 } );

		Util.MapDebugPrint( "^5truck_near_barrier" );
	},

	truck_at_barrier = function( trigger )
	{
		Map.TruckIsAtBarrier = true;

		SetAvailableMapGoals( TEAM.AXIS, false, "AIRSTRIKE_Axis_TruckNearBarrier" );

		SetAvailableMapGoals( TEAM.AXIS, true, "AIRSTRIKE_Axis_TruckAtBarrier" );

		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_TruckAtBarrier1_.*" );

		if ( Map.BarrierIsBuilt )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Truck_Barrier" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Truck" );
		}

		Util.MapDebugPrint( "^5truck at barrier" );
	},

	Truck_past_b1 =
	{
		Name = "Truck_past_b1",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
		OnEnter = function(ent)
		{

		},
		OnExit = function(ent)
		{
			Map.TruckIsAtBarrier = false;
			Map.Truck_Past_Barrier_1 = true;

			ETUtil.SetExcludeIndexes( "BUILD_Truck", { 1, 2, 3 } );

			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"PLANT_Truck_Barrier",
				"ATTACK_Allies_TruckAtBarrier1_.*",
			});

			SetAvailableMapGoals( TEAM.AXIS, false, {
				"BUILD_Truck_Barrier",
				"AIRSTRIKE_Axis_TruckAtBarrier",
			});

			if ( !Map.Hill_Top )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "AIRSTRIKE_Axis_TruckPastBarrier" );
			}

			Util.MapDebugPrint( "^5Truck_past_b1" );
		}
	},

	Truck_Built = function( trigger )
	{

		Map.Truck = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Truck" );

		if ( Map.TruckIsAtBarrier )
		{
			if ( Map.BarrierIsBuilt )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );
			}
		}
		else if ( Map.truckatdoor and !Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );
		}

		Util.MapDebugPrint( "^5Truck_Built" );
	},

	Truck_Destroyed = function( trigger )
	{

		Map.Truck = false;

		Util.SetPositionGoal( "BUILD_Truck", "MOVER_truck" );

		SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );

		if ( Map.TruckIsAtBarrier )
		{
			if ( Map.BarrierIsBuilt )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Truck" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Truck" );
			}
		}
		else if ( Map.truckatdoor and !Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Truck" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Truck" );
		}

		Util.MapDebugPrint( "^5Truck_Destroyed" );
	},

	Allied_Command_Post_Built = function( trigger )
	{

		Map.Allied_CP = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Command_Post" );

		if ( Map.Phase1 )
		{
			if ( !Map.hillflag_Allies )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, {
					".*_Axis_Start_.*",
					"AMMOCAB_cabin_ammocabinet",
					"HEALTHCAB_cabin_healthcabinet",
				});

				SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_HillTop_.*" );
			}

			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Allied_Command_Post" );
		}

		Util.MapDebugPrint( "^5Allied_Command_Post_Built" );
	},

	Allied_Command_Post_Planted = function( trigger )
	{

		Map.Allied_Command_Post_Dyno += 1;

		if ( Map.Phase1 or Map.NukeIsOnTheTruck or Map.Truck_Past_Barrier_2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFUSE_Allied_Command_Post_.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Allied_Command_Post_.*" );
		}

		Util.MapDebugPrint( "^5Allied_Command_Post_Planted" );
	},

	Allied_Command_Post_Defused = function( trigger )
	{

		Map.Allied_Command_Post_Dyno -= 1;

		Util.MapDebugPrint( "^5Allied_Command_Post_Defused" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{

		Map.Allied_Command_Post_Dyno = 0;

		Map.Allied_CP = false;

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Command_Post" );

		if ( Map.Phase1 )
		{
			if ( !Map.hillflag_Allies )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_HillTop_.*" );

				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_Start_.*",
					"AMMOCAB_cabin_ammocabinet",
					"HEALTHCAB_cabin_healthcabinet",
				});
			}

			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Command_Post" );
		}

		Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed" );
	},

	Allied_mg_Nest_Built = function( trigger )
	{

		Map.Allied_MG = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_mg_Nest" );

		if ( Map.Phase1 or Map.NukeIsOnTheTruck or Map.Truck_Past_Barrier_2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"MOUNTMG42_Allied_mg_Nest",
				"REPAIRMG42_Allied_mg_Nest",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Allied_mg_Nest" );
		}

		Util.MapDebugPrint( "^5Allied_mg_Nest_Built" );
	},

	Allied_mg_Nest_Planted = function( trigger )
	{

		Map.Allied_mg_Nest_Dyno += 1;

		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Allied_mg_Nest_.*" );

		Util.MapDebugPrint( "^5Allied_mg_Nest_Planted" );
	},

	Allied_mg_Nest_Defused = function( trigger )
	{

		Map.Allied_mg_Nest_Dyno -= 1;

		Util.MapDebugPrint( "^5Allied_mg_Nest_Defused" );
	},

	Allied_mg_Nest_Destroyed = function( trigger )
	{

		Map.Allied_mg_Nest_Dyno = 0;

		Map.Allied_MG = false;

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNTMG42_Allied_mg_Nest",
			"REPAIRMG42_Allied_mg_Nest",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_mg_Nest" );

		if ( Map.Phase1 or Map.NukeIsOnTheTruck or Map.Truck_Past_Barrier_2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_mg_Nest" );
		}

		Util.MapDebugPrint( "^5Allied_mg_Nest_Destroyed" );
	},

	Axis_Command_Post_Built = function( trigger )
	{

		Map.Axis_CP = true;

		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Axis_Command_Post" );

		if ( ( !Map.root_cellar or !Map.back_door ) and !Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_Command_Post" );
		}

		Util.MapDebugPrint( "^5Axis_Command_Post_Built" );
	},

	Axis_Command_Post_Planted = function( trigger )
	{

		Map.Axis_Command_Post_Dyno += 1;

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Axis_Command_Post_.*" );

		Util.MapDebugPrint( "^5Axis_Command_Post_Planted" );
	},

	Axis_Command_Post_Defused = function( trigger )
	{

		Map.Axis_Command_Post_Dyno -= 1;

		Util.MapDebugPrint( "^5Axis_Command_Post_Defused" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{

		Map.Axis_Command_Post_Dyno = 0;

		Map.Axis_CP = false;

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_Command_Post" );

		if ( ( !Map.root_cellar or !Map.back_door ) and !Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_Command_Post" );
		}

		Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed" );
	},

	Axis_mg_Nest_Built = function( trigger )
	{

		Map.Axis_MG = true;

		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Axis_mg_Nest" );

		if ( Map.NukeSecured and !Map.NukeIsInTheCabin )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"MOUNTMG42_Axis_mg_Nest",
				"REPAIRMG42_Axis_mg_Nest",
			});

			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_mg_Nest" );
		}

		Util.MapDebugPrint( "^5Axis_mg_Nest_Built" );
	},

	Axis_mg_Nest_Planted = function( trigger )
	{

		Map.Axis_mg_Nest_Dyno += 1;

		if ( Map.NukeSecured and !Map.NukeIsInTheCabin )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFUSE_Axis_mg_Nest_.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Axis_mg_Nest_.*" );
		}

		Util.MapDebugPrint( "^5Axis_mg_Nest_Planted" );
	},

	Axis_mg_Nest_Defused = function( trigger )
	{

		Map.Axis_mg_Nest_Dyno -= 1;

		Util.MapDebugPrint( "^5Axis_mg_Nest_Defused" );
	},

	Axis_mg_Nest_Destroyed = function( trigger )
	{

		Map.Axis_mg_Nest_Dyno = 0;
		Map.Axis_MG = false;

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_mg_Nest" );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_Axis_mg_Nest",
			"REPAIRMG42_Axis_mg_Nest",
		});

		if ( Map.NukeSecured and !Map.NukeIsInTheCabin )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_mg_Nest" );
		}

		Util.MapDebugPrint( "^5Axis_mg_Nest_Destroyed" );
	},

	hill_flag_Allies_Captured = function( trigger )
	{

		Map.hillflag_Allies = true;

		if ( !Map.Allied_CP )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				".*_Axis_Start_.*",
				"MOUNTMG42_Hill",
				"AMMOCAB_cabin_ammocabinet",
				"HEALTHCAB_cabin_healthcabinet",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_HillTop_.*" );
		}

		Util.MapDebugPrint( "^5hill_flag_Allies_Captured" );
	},

	hill_flag_Axis_Captured = function( trigger )
	{

		Map.hillflag_Allies = false;

		if ( !Map.Allied_CP )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_HillTop_.*" );

			SetAvailableMapGoals( TEAM.AXIS, true, {
				".*_Axis_Start_.*",
				"MOUNTMG42_Hill",
				"AMMOCAB_cabin_ammocabinet",
				"HEALTHCAB_cabin_healthcabinet",
			});
		}

		Util.MapDebugPrint( "^5hill_flag_Axis_Captured" );
	},

	Sewers_Planted = function( trigger )
	{

		Map.Sewers_Dyno += 1;

		if ( Map.DoorIsOpen or Map.Hill_Top )	//more important is the defense of nuke (IMO)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Sewers_.*" );
		}

		Util.MapDebugPrint( "^5Sewers_Planted" );
	},

	Sewers_Defused = function( trigger )
	{

		Map.Sewers_Dyno -= 1;

		Util.MapDebugPrint( "^5Sewers_Defused" );
	},

	Sewers_Destroyed = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Sewers" );

		if ( Map.Sewers_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Sewers_.*" );
		}

		Map.Sewers_Dyno = 0;

		Map.sewers = false;

		Util.EnableGoal ( "ROUTE_Sewerexit" );
		Util.EnableGoal ( "ROUTE_Sewer" );

		SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_Sewers_.*" );

		if ( !Map.Hill_Top )
		{
			if ( !Map.DoorIsOpen )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Axis_Main_Entrance_04",
					"DEFEND_Axis_Main_Entrance_06",
				});

				sleep(1.5);

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"PLANT_Main_Entrance.*",
					"ATTACK_Allies_Main_Entrance_05",
					"ATTACK_Allies_Main_Entrance_07",
				});
			}
		}

		Util.MapDebugPrint( "^5Sewers_Destroyed" );
	},

	Sewer_Hatch_Exploded = function( trigger )
	{

		Map.SewerHatchExploded = true;

		Util.MapDebugPrint( "^5Sewer_Hatch_Exploded" );
	},

	Back_Door_Planted = function( trigger )
	{

		Map.Back_Door_Dyno += 1;

		if ( Map.DoorIsOpen or Map.Hill_Top )	//more important is the defense of nuke (IMO)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Back_Door_.*" );
		}

		Util.MapDebugPrint( "^5Back_Door_Planted" );
	},

	Back_Door_Defused = function( trigger )
	{

		Map.Back_Door_Dyno -= 1;

		Util.MapDebugPrint( "^5Back_Door_Defused" );
	},

	Back_Door_Destroyed = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Back_Door" );

		if ( Map.Back_Door_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Back_Door_.*" );
		}

		Map.Back_Door_Dyno = 0;

		Map.back_door = false;
		Map.Hill_Top = true;
		Map.Phase1 = false;

		Wp.SetWaypointFlag( "axis-door", "closed", true );
		Wp.SetWaypointFlag( "axis-door2", "closed", true );

		Util.EnableGoal ( "ROUTE_Back_Door" );

		Map.iw3 = OnTriggerRegion( AABB(-309.076,2746.820,641.883,-25.581,2952.365,817.419), RegionTrigger.IntrusionWarning );

		SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_Back_Door" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_Back_Door" );

		if ( !Map.DoorIsOpen )
		{
			if ( Map.root_cellar )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_Allies_RockExit_.*" );

				sleep(2);

				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Hill_Top_.*" );

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"AMMOCAB_north_ammocabinet",
					"HEALTHCAB_north_healthcabinet",
				});

				if ( Map.Axis_CP )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_Command_Post" );
				}

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"ATTACK_Allies_Main_Entrance_.*",
					"PLANT_Main_Entrance.*",
				});

				if ( !Map.Elevator )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Generator" );
				}

				if ( Map.Axis_MG )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_mg_Nest" );
				}
			}
		}

		Util.MapDebugPrint( "^5Back_Door_Destroyed" );
	},

	Root_Cellar_Planted = function( trigger )
	{

		Map.Root_Cellar_Dyno += 1;

		if ( Map.DoorIsOpen or Map.Hill_Top )	//more important is the defense of nuke (IMO)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Root_Cellar_.*" );
		}

		Util.MapDebugPrint( "^5Root_Cellar_Planted" );
	},

	Root_Cellar_Defused = function( trigger )
	{

		Map.Root_Cellar_Dyno -= 1;

		Util.MapDebugPrint( "^5Root_Cellar_Defused" );
	},

	Root_Cellar_Destroyed = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Root_Cellar" );

		if ( Map.Root_Cellar_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Root_Cellar_.*" );
		}

		Map.Root_Cellar_Dyno = 0;
		Map.root_cellar = false;
		Map.Hill_Top = true;
		Map.Phase1 = false;

		Util.EnableGoal ( "ROUTE_Root_Cellar" );

		DeleteTriggerRegion( Map.iw1 );

		Map.iw2 = OnTriggerRegion( AABB(223.186,2108.287,812.667,323.402,2302.091,949.582), RegionTrigger.IntrusionWarning );

		SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_Root_Cellar" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_Root_Cellar" );

		if ( !Map.DoorIsOpen )
		{
			if ( Map.back_door )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_Allies_RockExit_.*" );

				sleep(2);

				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Hill_Top_.*" );

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"AMMOCAB_north_ammocabinet",
					"HEALTHCAB_north_healthcabinet",
				});

				if ( Map.Axis_CP )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_Command_Post" );
				}

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"ATTACK_Allies_Main_Entrance_.*",
					"PLANT_Main_Entrance_to_Nuke.*",
				});

				if ( !Map.Elevator )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Generator" );
				}

				if ( Map.Axis_MG )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_mg_Nest" );
				}
			}
		}

		Util.MapDebugPrint( "^5Root_Cellar_Destroyed" );
	},

	truck_at_door =
	{
		Name = "truck_at_door",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
		OnEnter = function(ent)
		{
			Map.Phase1 = false;
			Map.truckatdoor = true;

			ETUtil.SetExcludeIndexes( "BUILD_Truck", { 0 } );

			if ( Map.NukeIsInTheCabin )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Cart_Ramp" );
			}

			if ( !Map.NukeIsOnTheTruck )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );
			}
			if ( !Map.NukeIsOnTheTruck && !Map.NukeIsInTheCabin && !Map.NukeSecured )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Truck" );
			}

			Util.MapDebugPrint( "^5truck at door" );
		},
		OnExit = function(ent)
		{
			if ( Map.NukeIsOnTheTruck )
			{
				ETUtil.SetExcludeIndexes( "BUILD_Truck", { 0, 2, 3} );

				SetAvailableMapGoals( TEAM.AXIS, false, {
					"MOBILEMORTAR_Axis_Nuke_Hill_1",
					"AIRSTRIKE_Axis_NukeOnHillTop",
				});

				SetAvailableMapGoals( TEAM.AXIS, true, {
					"AIRSTRIKE_Axis_NukeLeftHillTop",
					"MOBILEMORTAR_Axis_Nuke_Hill_2",
				});

				Util.MapDebugPrint( "^5Nuke left hill" );
			}
		}
	},

	hill_top_Secured = function( trigger )
	{

		Map.hillflag_Allies = true;
		Map.Hill_Top = true;
		Map.Phase1 = false;

		Util.DisableGoal ( "AMMOCAB_.*" );
		Util.DisableGoal ( "HEALTHCAB_.*" );

		if ( !Map.DoorIsOpen )
		{
			Util.RandomSpawn( TEAM.AXIS, 4 );

			SetAvailableMapGoals( TEAM.AXIS, false, {
				".*_Axis_HillTop_.*",
				".*_Axis_Sewers_.*",
				"ATTACK_barrier_.*",
				"MOUNTMG42_Hill",
				".*_Axis_Start_.*",
				"REPAIRMG42_Hill",
				"AIRSTRIKE_.*",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"AMMOCAB_north_ammocabinet",
				"HEALTHCAB_north_healthcabinet",
			});

			if ( Map.Allied_MG )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_mg_Nest" );
			}

			if ( Map.Allied_CP )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Command_Post" );
			}

			if ( !Map.Axis_CP )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_Command_Post" );
			}

			SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_Main_Entrance_.*" );

			if ( Map.Elevator )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Generator" );
			}

			if ( Map.Axis_MG )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "REPAIRMG42_Axis_mg_Nest" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_mg_Nest" );
			}

			sleep(1.5);

			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"AMMOCAB_cabin_ammocabinet",
				"HEALTHCAB_cabin_healthcabinet",
				"GRENADE_hill_mg",
			});

			if ( Map.Allied_MG )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, {
					"MOUNTMG42_Allied_mg_Nest",
					"REPAIRMG42_Allied_mg_Nest",
				});
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_mg_Nest" );
			}

			if ( !Map.Allied_CP )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Command_Post" );
			}
		}

		Util.MapDebugPrint( "^5Allies_Secured_HillTop" );
	},

	Main_Entrance_to_the_Nuke_Planted = function( trigger )
	{

		Map.Main_Entrance_to_the_Nuke_Dyno += 1;

		if ( Map.Truck_Barrier_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Truck_Barrier_.*" );
		}

		if ( Map.Axis_mg_Nest_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Axis_mg_Nest_.*" );
		}

		if ( Map.Sewers_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Sewers_.*" );
		}

		if ( Map.Back_Door_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Back_Door_.*" );
		}

		if ( Map.Root_Cellar_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Root_Cellar_.*" );
		}

		Util.MapDebugPrint( "^5Main_Entrance_to_the_Nuke_Planted" );
	},

	Main_Entrance_to_the_Nuke_Defused = function( trigger )
	{

		Map.Main_Entrance_to_the_Nuke_Dyno -= 1;

		Util.MapDebugPrint( "^5Main_Entrance_to_the_Nuke_Defused" );
	},

	Main_Entrance_to_the_Nuke_Destroyed = function( trigger )
	{

		if ( Map.Main_Entrance_to_the_Nuke_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Main_Entrance_to_the_Nuke_.*" );
		}

		Map.Main_Entrance_to_the_Nuke_Dyno = 0;

		Map.DoorIsOpen = true;
		Map.Hill_Top = true;

		Util.DisableGoal( ".*", true );

		WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );

		if ( Map.ElevatorAtLevel != 4 and Map.ElevatorAtLevel != -1 and Map.Elevator )
		{
			Map.Switches.elevator_switch_up_0.LimitTeam = 1<<TEAM.ALLIES;
			Map.Switches.elevator_switch_up_0.Enabled = true;
		}

		Util.EnableGoal( {
			"AMMOCAB_north_ammocabinet",
			"HEALTHCAB_north_healthcabinet",
		});

		DeleteTriggerRegion( Map.iw2 );
		DeleteTriggerRegion( Map.iw3 );

		Map.iw4 = OnTriggerRegion( AABB(-926.238,2065.573,45.765,-752.265,2307.669,230.476), RegionTrigger.IntrusionWarning );
		Map.iw5 = OnTriggerRegion( AABB(-1691.597,2013.335,-34.178,-1401.510,2478.028,151.430), RegionTrigger.IntrusionWarning );
		Map.ac1 = OnTriggerRegion( AABB(-1691.597,2016.323,1.870,-1436.138,2478.028,215.381), RegionTrigger.AllClear );

		if ( Map.sewers )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Sewers" );
		}

		if ( Map.root_cellar )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Root_Cellar" );
		}

		if ( Map.back_door )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Back_Door" );
		}

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Nuke_.*",
			"MOBILEMG42_war_room.*",
		});

		if ( Map.Elevator )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Generator" );
		}

		if ( !Map.Axis_MG )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_mg_Nest" );
		}

		if ( !Map.Axis_CP )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_Command_Post" );
		}

		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_Allies_RockExit_.*" );

		if ( Map.Talk && MAP_TALK )
		{
			rand = Server.Team[ TEAM.AXIS ].NumPlayers * 2;
			rand2 = Server.Team[ TEAM.ALLIES ].NumPlayers * 2;
			foreach ( gameId and bot in BotTable )
			{
				if (bot.GetTeam() == TEAM.AXIS && RandInt(0,rand) < 2 && GetGameTimeLeft()>120)
				{
					sleep(RandRange(1,2.5));
					bot.SayVoice(VOICE.DEFEND_OBJECTIVE);
				}
				else if (bot.GetTeam() == TEAM.AXIS && RandInt(0,rand) < 2 && GetGameTimeLeft()>120)
				{
					sleep(RandRange(1,2.0));
					bot.ExecCommand("vsay_team FTFallBack");
				}
				else if (bot.GetTeam() == TEAM.AXIS && RandInt(0,rand) < 2 && GetGameTimeLeft()>120)
				{
					sleep(RandRange(1,2.0));
					bot.SayVoice(VOICE.REINFORCE_DEF);
				}
				if (bot.GetTeam() == TEAM.ALLIES && RandInt(0,rand2) < 2 && GetGameTimeLeft()>120)
				{
					sleep(RandRange(1,2.8));
					bot.SayVoice(VOICE.REINFORCE_OFF);
				}
				else if (bot.GetTeam() == TEAM.ALLIES && RandInt(1,rand2) < 2 && GetGameTimeLeft()>300)
				{
					sleep(1.5);
					bot.SayVoice(VOICE.G_CHEER);
				}
				else if (bot.GetTeam() == TEAM.ALLIES && RandInt(1,rand2) < 2 && GetGameTimeLeft()>120)
				{
					sleep(1.5);
					bot.ExecCommand("vsay_team FTAttack");
				}
			}
		}

		Util.MapDebugPrint( "^5Main_Entrance_to_the_Nuke_Destroyed" );

		sleep(1.5);

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Nuke_.*",
			"SMOKEBOMB_Nuke",
			"MOVER_cart",
			"ESCORT_cart_allies",
		});

		if ( !Map.Elevator )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Generator" );
		}

		if ( Map.Axis_MG )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_mg_Nest" );
		}

		if ( Map.Axis_CP )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_Command_Post" );
		}
	},

	Elevator_Generator_Built = function( trigger )
	{

		Map.Elevator = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Elevator_Generator" );

		if ( !Map.NukeIsInTheCabin or !Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Generator" );
		}

		if ( Map.DoorIsOpen and !Map.NukeSecured and !Map.NukeIsInTheCabin and Map.ElevatorAtLevel != 4 and !Map.NukeIsOnTheTruck )
		{
			Map.Switches.elevator_switch_up_0.LimitTeam = 1<<TEAM.ALLIES;
			Map.Switches.elevator_switch_up_0.Enabled = true;
		}

		if ( Map.DoorIsOpen and !Map.NukeSecured and !Map.NukeIsInTheCabin and Map.ElevatorAtLevel == 4 and !Map.NukeIsOnTheTruck )
		{
			Map.Switches.elevator_switch_level_2.Enabled = true;	//allies can not load the nuke
		}

		if ( Map.NukeSecured )
		{
			//until the elevator is moving allies canīt do anything :o)

			Map.Switches.elevator_switch_up_0.Enabled = false;	//too long way from axis spawn to the switch

			if ( Map.ElevatorAtLevel == 1 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Cabin_01" );

				SetAvailableMapGoals(TEAM.ALLIES, true, "ATTACK_elevator_nuke" );

				Map.Switches.elevator_switch_level_1.Enabled = true;
				Map.Switches.elevator_switch_level_2.Enabled = true;
			}

			if ( Map.ElevatorAtLevel == 2 )
			{
				Map.Switches.elevator_switch_level_2.Enabled = true;

				Map.Switches.house_switch.Enabled = true;

				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );
			}

			if ( Map.ElevatorAtLevel == 3 )
			{
				Map.Switches.elevator_switch_level_1.Enabled = true;

				Map.Switches.house_switch.Enabled = true;

				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );
			}

			if ( Map.ElevatorAtLevel == 4 )
			{
				Map.Switches.elevator_switch_level_1.Enabled = true;
				Map.Switches.elevator_switch_level_2.Enabled = true;

				Map.Switches.house_switch.Enabled = true;

				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );
			}

			sleep(1);

			Util.BotChat(TEAM.ALLIES, "vsay", VOICE.G_CHEER, 2);
		}

		if ( Map.Nuke_atElevatorDoor and !Map.LowestDoor_closed and !Map.NukeSecured )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_cart_allies" );
		}

		if ( Map.NukeSecured and Map.ElevatorAtLevel == 1 and !Map.TopDoor_closed )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Cabin_01" );

			SetAvailableMapGoals(TEAM.ALLIES, true, "ATTACK_elevator_nuke" );
		}

		Util.MapDebugPrint( "^5Elevator_Generator_Built" );
	},

	Elevator_Generator_Planted = function( trigger )
	{

		Map.Elevator_Generator_Dyno += 1;

		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Elevator_Generator_.*" );

		if ( !Map.Phase1 and ( !Map.root_cellar or !Map.back_door ) )
		{
			if ( Map.DoorIsOpen and !Map.NukeIsInTheCabin )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "DEFUSE_Elevator_Generator_.*" );
			}
		}

		if ( Map.NukeIsInTheCabin or Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Elevator_Generator_.*" );
		}

		Util.MapDebugPrint( "^5Elevator_Generator_Planted" );
	},

	Elevator_Generator_Defused = function( trigger )
	{

		Map.Elevator_Generator_Dyno -= 1;

		Util.MapDebugPrint( "^5Elevator_Generator_Defused" );
	},

	Elevator_Generator_Destroyed = function( trigger )
	{

		Map.Elevator_Generator_Dyno = 0;

		Map.Elevator = false;
		Map.Switches.elevator_switch_up_0.Enabled = false;
		Map.Switches.house_switch.Enabled = false;
		Map.Switches.elevator_switch_level_1.Enabled = false;
		Map.Switches.elevator_switch_level_2.Enabled = false;

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Elevator_Generator" );

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Elevator_Generator" );

		if ( !Map.Phase1 and ( !Map.root_cellar or !Map.back_door ) )
		{
			if ( Map.DoorIsOpen and !Map.NukeIsInTheCabin )
			{
				if ( !Map.NukeSecured )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Generator" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Cabin_01" );

					if ( !Map.TopDoor_closed )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Elevator_Generator" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Generator" );
					}
				}
			}
		}

		if ( Map.NukeIsInTheCabin or Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Elevator_Generator" );
		}

		Util.MapDebugPrint( "^5Elevator_Generator_Destroyed" );

		if ( Map.NukeSecured )
		{
			while ( !Map.Elevator and !Map.NukeIsInTheCabin and Map.TopDoor_closed )
			{
				Util.BotChat( TEAM.ALLIES, "sayteam", "^1Repair the Generator!!!", 1 );

				Util.MapDebugPrint( "^5Say team - repair generator" );
				sleep(10);
			}
		}
	},

	Cart_Ramp_Built = function( trigger )
	{

		Map.Cart_Ramp = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Cart_Ramp" );

		if ( Map.NukeSecured and !Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Cart_Ramp" );
		}

		if ( Map.NukeAtCartRamp )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_cart_allies" );
		}

		Util.MapDebugPrint( "^5Cart_Ramp_Built" );
	},

	Cart_Ramp_Planted = function( trigger )
	{

		Map.Cart_Ramp_Dyno += 1;

		if ( Map.NukeSecured and !Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFUSE_Cart_Ramp_.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Cart_Ramp_.*" );
		}

		Util.MapDebugPrint( "^5Cart_Ramp_Planted" );
	},

	Cart_Ramp_Defused = function( trigger )
	{

		Map.Cart_Ramp_Dyno -= 1;

		Util.MapDebugPrint( "^5Cart_Ramp_Defused" );
	},

	Cart_Ramp_Destroyed = function( trigger )
	{

		Map.Cart_Ramp_Dyno = 0;

		Map.Cart_Ramp = false;

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Cart_Ramp" );

		if ( Map.truckatdoor and !Map.NukeIsOnTheTruck and ( Map.NukeSecured or Map.NukeIsInTheCabin ) )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Cart_Ramp" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Cart_Ramp" );
		}

		if ( Map.NukeAtCartRamp )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_cart_allies" );
		}

		Util.MapDebugPrint( "^5Cart_Ramp_Destroyed" );
	},

	nuke_Taken = function( trigger )
	{

		Map.NukeTaken = true;

		if ( Map.ElevatorAtLevel != 4 and Map.ElevatorAtLevel != -1 and Map.Elevator )
		{
			Map.Switches.elevator_switch_up_0.LimitTeam = 1<<TEAM.ALLIES;
			Map.Switches.elevator_switch_up_0.Enabled = true;
		}

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"MOVER_cart",
			"ESCORT_cart_axis",
		});

		Util.MapDebugPrint( "^5nuke_Taken" );
	},

	nuke_Returned = function( trigger )
	{

		Map.NukeTaken = false;

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOVER_cart",
			"ESCORT_cart_axis",
		});

		Util.MapDebugPrint( "^5nuke_Returned" );
	},

	Nuke_Left_Room =
	{
		Name = "Nuke_Left_Room",
		TriggerOnEntity = GetGoal("MOVER_cart").GetEntity(),
		OnEnter = function(ent)
		{
			Map.NukeLeftRoom = true;

			if ( !Map.NukeSecured )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, {
					"DEFEND_Nuke_.*",
					"MOBILEMG42_war_room",
				});

				SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_Main_Entrance_.*" );

				SetAvailableMapGoals( TEAM.ALLIES, false, {
					"ATTACK_Nuke_.*",
					"SMOKEBOMB_Nuke",
				});

				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Main_Entrance_.*" );

				Util.MapDebugPrint( "^5Nuke_Left_Room" );
			}
		},
		OnExit = function(ent)
		{
			Map.NukeLeftRoom = false;

			if ( !Map.NukeSecured )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_Main_Entrance_.*" );

				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Nuke_.*",
					"MOBILEMG42_war_room",
				});

				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Main_Entrance_.*" );

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"ATTACK_Nuke_.*",
					"SMOKEBOMB_Nuke",
				});

				Util.MapDebugPrint( "^5Nuke_Returned_to_Room" );
			}
		}
	},

	Nuke_at_ElevatorDoor =
	{
		Name = "Nuke_at_ElevatorDoor",
		TriggerOnEntity = GetGoal("MOVER_cart").GetEntity(),
		OnEnter = function(ent)
		{
			if ( !Map.NukeSecured )
			{
				Map.Nuke_atElevatorDoor = true;

				if ( Map.LowestDoor_closed )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_cart_allies" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_cart_allies" );
				}

				Util.MapDebugPrint( "^5Nuke_at_Lowest_ElevatorDoor" );
			}
		},
		OnExit = function(ent)
		{
			if ( !Map.NukeSecured )
			{
				Map.Nuke_atElevatorDoor = false;

				SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_cart_allies" );

				Util.MapDebugPrint( "^5Nuke_not_at_ElevatorDoor" );
			}
		}
	},

	trigger_LowestDoor =
	{
		Name = "trigger_LowestDoor",
		TriggerOnEntity = GetGoal("MOVER_b3door3").GetEntity(),
		OnEnter = function(ent)
		{
			Map.LowestDoor_closed = true;

			if ( Map.Nuke_atElevatorDoor and !Map.NukeSecured )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_cart_allies" );
			}

			Util.MapDebugPrint( "^5Trigger - Lowest door closing" );
		},
		OnExit = function(ent)
		{
			Map.LowestDoor_closed = false;

			if ( Map.Nuke_atElevatorDoor and !Map.NukeSecured )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_cart_allies" );
			}

			Util.MapDebugPrint( "^5Trigger - Lowest door is opened" );
		}
	},

	nuke_In_the_Elevator = function( trigger )
	{

		DeleteTriggerRegion( Map.iw4 );
		DeleteTriggerRegion( Map.iw5 );
		DeleteTriggerRegion( Map.ac1 );

		Map.NukeSecured = true;
		Map.NukeTaken = false;
		Map.Switches.elevator_switch_up_0.Enabled = false;
		Map.Switches.bookshelf_switch.Enabled = true;

		Util.ChangeSpawn(TEAM.AXIS, 0);

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_.*",
			"DEFEND_.*",
			"ESCORT_.*",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"ATTACK_.*",
			"DEFEND_.*",
			"ESCORT_.*",
			"MOBILEMG42_.*",
		});

		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Elevator_Generator_.*" );

		SetAvailableMapGoals( TEAM.AXIS, true, {
			".*_Axis_Elevator_Generator_.*",
			"PLANTMINE_Axis_TruckRoad_.*",
		});

		//until the elevator is moving allies canīt do anything :o)
		Map.Switches.elevator_switch_level_1.Enabled = true;
		Map.Switches.elevator_switch_level_2.Enabled = true;

		if ( Map.Elevator )
		{
			Map.Switches.house_switch.Enabled = true;

			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Generator" );

			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Generator" );
		}

		if ( Map.BarrierIsBuilt )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Truck_Barrier" );

			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Truck_Barrier" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Truck_Barrier" );

			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Truck_Barrier" );
		}

		if ( Map.Axis_MG )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_mg_Nest" );

			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Axis_mg_Nest" );

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"MOUNTMG42_Axis_mg_Nest",
				"REPAIRMG42_Axis_mg_Nest",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"MOUNTMG42_Axis_mg_Nest",
				"REPAIRMG42_Axis_mg_Nest",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_mg_Nest" );

			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_mg_Nest" );
		}

		if ( Map.truckatdoor )
		{
			if ( !Map.Cart_Ramp )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Cart_Ramp" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Cart_Ramp" );
			}
		}

		Util.MapDebugPrint( "^5nuke_In_the_Elevator" );
	},

	trigger_TopDoor =
	{
		Name = "trigger_TopDoor",
		TriggerOnEntity = GetGoal("MOVER_cabindoor1").GetEntity(),
		OnEnter = function(ent)
		{
			Map.TopDoor_closed = true;

			if ( Map.NukeSecured )
			{
				SetAvailableMapGoals(TEAM.ALLIES, false, "ATTACK_elevator_nuke" );
			}

			Util.MapDebugPrint( "^5Trigger - Top door closing" );
		},
		OnExit = function(ent)
		{
			Map.TopDoor_closed = false;

			if ( Map.NukeSecured and Map.BookcaseOpened and Map.ElevatorAtLevel == 1 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Cabin_01" );

				SetAvailableMapGoals(TEAM.ALLIES, true, "ATTACK_elevator_nuke" );
			}
			if ( !Map.Elevator )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Elevator_Generator" );
			}

			Util.MapDebugPrint( "^5Trigger - Top door is opened" );
		}
	},

	bookcase_trigger = function( trigger )
	{
		//turn the trigger action string into a vector for referencing
		vec = ToVector(trigger.Action);
		//reference the changing value to determine the direction
		if ( vec.y > 0 )
		{
			Util.MapDebugPrint("bookcase opening", true);
			Map.Switches.bookshelf_switch.Enabled = false;

			sleep(4);

			Map.BookcaseOpened = true;

			if ( Map.NukeSecured and Map.ElevatorAtLevel == 1 and !Map.TopDoor_closed )
			{
				SetAvailableMapGoals(TEAM.ALLIES, true, "ATTACK_elevator_nuke" );
			}

			Util.MapDebugPrint("bookcase opened", true);
		}
		else if ( vec.y < 0 )
		{
			Util.MapDebugPrint("bookcase closing", true);
			Map.BookcaseOpened = false;

			if ( Map.NukeSecured )
			{
				SetAvailableMapGoals(TEAM.ALLIES, false, "ATTACK_elevator_nuke" );
			}

			sleep(4);

			if(Map.NukeSecured)
			{
				Map.Switches.bookshelf_switch.Enabled = true;
			}

			Util.MapDebugPrint("bookcase closed", true);
		}
	},

	nuke_In_the_Cabin = function( trigger )
	{

		Map.NukeIsInTheCabin = true;

		Map.NukeSecured = false;
		Map.Switches.bookshelf_switch.Enabled = false;
		Map.Switches.elevator_door.Enabled = false;
		Map.Switches.house_switch.Enabled = false;
		Map.Switches.elevator_switch_up_0.Enabled = false;
		Map.Switches.elevator_switch_up_1.Enabled = false;
		Map.Switches.elevator_switch_up_2.Enabled = false;
		Map.Switches.elevator_switch_up_3.Enabled = false;
		Map.Switches.elevator_switch_level_1.Enabled = false;
		Map.Switches.elevator_switch_level_2.Enabled = false;

		Util.DisableGoal( ".*", true );

		Util.ChangeSpawn(TEAM.AXIS, 0);

		WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );

		ClearGoalRole("MOUNTMG42_Hill", ROLE.DEFENDER);

		// Swap y offsets for escort goals when cart is in the cabin
		SetMapGoalProperties( "ESCORT_cart_allies", { Offsets={Vec3(10, 70, 5),Vec3(-10, 70, 5)} } );

		WeaponTable.SetWeaponTeamAvailability ( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MOBILE_MG42, false );

		WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MORTAR, true );

		if ( ETUtil.CountClass( TEAM.AXIS, CLASS.SOLDIER ) > 1 )
		{
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, true );
		}

		foreach ( id and bot in BotTable )
		{
			if ( bot.GetTeam()  == TEAM.AXIS )
			{
				if ( bot.HasWeapon(WEAPON.MOBILE_MG42) )
				{
					ETUtil.SuicideSpawn( TEAM.AXIS, 0, -1, CLASS.SOLDIER );

					Util.MapDebugPrint( "^5I have wrong weapon" );
				}
			}
		}

		if ( Map.Cart_Ramp )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Cart_Ramp" );
		}
		else
		{
			if ( Map.truckatdoor )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Cart_Ramp" );
			}
		}

		if ( !Map.Truck )
		{
			if ( Map.TruckIsAtBarrier )
			{
				if ( !Map.BarrierIsBuilt )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Truck" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Truck" );
			}
		}

		if ( !Map.BarrierIsBuilt )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Truck_Barrier" );
		}

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ATTACK_Axis_Barrier2_.*",
			"MOUNTMG42_Hill",
			"REPAIRMG42_Hill",
			"AIRSTRIKE_Axis_NukeOnHillTop",
			"PLANTMINE_Axis_TruckRoad_.*",
			"MOBILEMORTAR_Axis_Nuke_Hill_1",
		});

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANTMINE_Allies_RockExit_.*",
			"ATTACK_Allies_Hill_Top_.*",
			"ATTACK_barrier_.*",
			"ESCORT_cart_allies",
		});

		if ( Map.Allied_CP )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Allied_Command_Post" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Command_Post" );
		}

		Util.OnTriggerPosition( "MOVER_truck", "Nuke_on_truck", 250.0, Map.Nuke_near_barrier );
		Util.OnTriggerPosition( "MOVER_truck", "barrier_trigger2", 250.0, Map.truck_at_barrier );

		Util.MapDebugPrint( "^5nuke_In_the_Cabin" );
	},

	trigger_CartRamp =
	{
		Name = "trigger_CartRamp",
		TriggerOnEntity = GetGoal("MOVER_cart").GetEntity(),
		OnEnter = function(ent)
		{
			Map.NukeAtCartRamp = true;

			if ( !Map.Cart_Ramp )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_cart_allies" );

				if ( Map.truckatdoor )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Cart_Ramp" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_cart_allies" );

				SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Cart_Ramp" );
			}

			Util.MapDebugPrint( "^5Nuke at cart ramp" );
		},
		OnExit = function(ent)
		{

		}
	},

	nuke_On_the_Truck = function( trigger )
	{

		Map.NukeIsOnTheTruck = true;
		Map.NukeIsInTheCabin = false;
		Map.Switches.bookshelf_switch.Enabled = false;
		Map.Switches.house_switch.Enabled = false;

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"PLANT_Cart_Ramp",
			"MOVER_cart",
		});

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"BUILD_Cart_Ramp",
			"MOVER_cart",
			"ESCORT_cart_allies",
			"ATTACK_Allies_Hill_Top_.*",
		});

		SetAvailableMapGoals( TEAM.ALLIES, true, "GRENADE_hill_mg" );

		if ( Map.BarrierIsBuilt )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Truck_Barrier" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Truck_Barrier" );
		}

		if ( Map.Truck )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_truck" );
		}

		Util.MapDebugPrint( "^5nuke_On_the_Truck" );
	},

	Nuke_near_barrier = function( trigger )
	{

		if ( Map.NukeIsOnTheTruck )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"AIRSTRIKE_Axis_NukeLeftHillTop",
				"MOBILEMORTAR_Axis_Nuke_Hill_2",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"AIRSTRIKE_Axis_NukeNearBarrier",
				".*_Axis_PastB2_.*",
				"MOBILEMORTAR_Axis_Nuke_Hill_3",
			});

			Util.MapDebugPrint( "^5Nuke_near_barrier" );
		}
	},

	past_Barrier2 = function( trigger )
	{

		Map.TruckIsAtBarrier = false;
		Map.Truck_Past_Barrier_2 = true;

		Util.RandomSpawn( TEAM.ALLIES, 2 );

		ETUtil.SetExcludeIndexes( "BUILD_Truck", { 0, 2 } );

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"GRENADE_hill_mg",
			"PLANT_Truck_Barrier",
			"PLANTMINE_Allies_RockExit_.*",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Truck_Barrier",
			"AIRSTRIKE_Axis_NukeNearBarrier",
			"PLANTMINE_Axis_TruckRoad_.*",
			"MOUNTMG42_Hill",
			"REPAIRMG42_Hill",
			"MOBILEMORTAR_Axis_Nuke_Hill_3",
		});

		SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_Axis_PastBridge_09_1" );

		Util.MapDebugPrint( "^5past b. 2" );
	},

	Truck_At_Bridge =
	{
		Name = "Truck_At_Bridge",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
		OnEnter = function(ent)
		{
			ETUtil.SetExcludeIndexes( "BUILD_Truck", { 0, 2 } );

			SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_Axis_PastBridge_09_1" );

			SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_Axis_PastBridge_09_2" );

			Util.MapDebugPrint( "^5Truck_At_Bridge" );
		},
		OnExit = function(ent)
		{

		}
	},

	Truck_On_Bridge =
	{
		Name = "Truck_On_Bridge",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
		OnEnter = function(ent)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_Barrier2_.*" );

			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_barrier_.*" );

			SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Axis_PastBridge_.*" );

			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_PastBridge_.*" );

			SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_Axis_PastBridge_09_2" );

			SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_Axis_PastBridge_09_3" );

			Util.MapDebugPrint( "^5Truck_On_Bridge" );
		},
		OnExit = function(ent)
		{

		}
	},

	Truck_On_Bridge1 =
	{
		Name = "Truck_On_Bridge1",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
		OnEnter = function(ent)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_Axis_PastBridge_09_3" );

			SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_Axis_PastBridge_09_4" );

			Util.MapDebugPrint( "^5Truck_On_Bridge1" );
		},
		OnExit = function(ent)
		{

		}
	},

	Truck_Past_Bridge2 =
	{
		Name = "Truck_Past_Bridge2",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
		OnEnter = function(ent)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_Axis_PastBridge_09_4" );

			SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_Axis_PastBridge_09_5" );

			Util.MapDebugPrint( "^5Truck_Past_Bridge2" );
		},
		OnExit = function(ent)
		{

		}
	},

	AlliesWin = function( trigger )
	{
		Util.MapDebugPrint( "^5Allies_Win" );

		Map.Allies_Win = true;
		sleep(1);
		ETUtil.WinningChat( TEAM.ALLIES );
		sleep(1.5);
		ETUtil.LosingChat( TEAM.AXIS );
	},

	Thirty_second = function( trigger )
	{

		Util.MapDebugPrint( "^5Thirty_second" );

		sleep(30);

		if ( !Map.Allies_Win )
		{
			Util.MapDebugPrint( "^5Axis_Win" );

			sleep(1);
			ETUtil.WinningChat( TEAM.AXIS );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.ALLIES );
		}
	},

	elevator_trigger = function( trigger )
	{
		//turn the trigger action string into a vector for referencing
		vec = ToVector(trigger.Action);
		//reference the changing value to determine elevator direction
		if ( vec.z > 0 )
		{
			Util.MapDebugPrint("elevator going up", true);
			if(Map.NukeSecured)
			{
				Map.Switches.house_switch.Enabled = false;
				Map.Switches.elevator_switch_up_1.Enabled = false;
				Map.Switches.elevator_switch_up_2.Enabled = false;
				Map.Switches.elevator_switch_up_3.Enabled = false;
			}
		}
		else if ( vec.z < 0 )
		{
			Util.MapDebugPrint("elevator going down", true);
			if(Map.NukeTaken)
			{
				Map.Switches.elevator_switch_up_0.Enabled = false;
			}
		}
	},

	rock_trigger = function( trigger )
	{
		//turn the trigger action string into a vector for referencing
		vec = ToVector(trigger.Action);
		//reference the changing value to determine the direction
		if ( vec.x > 0 )
		{
			Util.MapDebugPrint("rock opening", true);
			Map.RockOpen = 1;
			Map.RockOpening = true;
			Map.Switches.wall_switch.Enabled = false;
			sleep(4.5);
			Map.RockOpened = true;
			DynamicPathsUpdated();
			sleep(1.5);
			Map.RockOpening = false;
			DynamicPathsUpdated();
		}
		else if ( vec.x < 0 )
		{
			Util.MapDebugPrint("rock closing", true);
			Map.RockOpened = false;
			Map.RockClosing = true;
			Map.RockOpen = 0;
			Map.Switches.wall_switch.Enabled = true;
			sleep(3);
			DynamicPathsUpdated();
			sleep(3);
			Map.RockClosing = false;
			DynamicPathsUpdated();
		}
	},

	LowestBunkerElevatorDoorMoving = function( trigger )
	{
		//turn the trigger action string into a vector for referencing
		vec = ToVector(trigger.Action);
		//reference the changing value to determine the direction
		if ( vec.y > 0 )
		{
			Util.MapDebugPrint("Lowest elevator door opening", true);

		}
		else if ( vec.y < 0 )
		{
			Util.MapDebugPrint("Lowest elevator door closing", true);

		}
	},

	TopElevatorDoorMoving = function( trigger )
	{
		//turn the trigger action string into a vector for referencing
		vec = ToVector(trigger.Action);
		//reference the changing value to determine the direction
		if ( vec.y < 0 )
		{
			Util.MapDebugPrint("Top elevator door opening", true);

		}
		else if ( vec.y > 0 )
		{
			Util.MapDebugPrint("Top elevator door closing", true);

		}
	},

};

Map.WatchElevatorPosition = function()
{
	goal = GetGoal( "MOVER_elevator" );
	entity = goal.GetEntity();
	Util.MapDebugPrint("Elevator thread started", true);
	position1 = Vector3(-1018, 2428, 1171); // top
	position2 = Vector3(-1018, 2428, 771);
	position3 = Vector3(-1018, 2428, 515);
	position4 = Vector3(-1018, 2428, 143); // bottom
	tolerance = 30;
	while ( 1 )
	{
		if ( Map.Debug )
		{
			DrawDebugLine(position1 - Vector3(0,0,-10), position1 - Vector3(0,0,10), COLOR.CYAN, 2);
			DrawDebugLine(position2 - Vector3(0,0,-10), position2 - Vector3(0,0,10), COLOR.CYAN, 2);
			DrawDebugLine(position3 - Vector3(0,0,-10), position3 - Vector3(0,0,10), COLOR.CYAN, 2);
			DrawDebugLine(position4 - Vector3(0,0,-10), position4 - Vector3(0,0,10), COLOR.CYAN, 2);
		}
		entposition = GetEntPosition( entity );

		//until the elevator is moving allies canīt do anything :o)

		// just do one distance calculation
		distanceFromPosition1 = DistanceBetween( entposition, position1 );
		if ( distanceFromPosition1 < tolerance )
		{
			// elevator at top level
			if ( Map.ElevatorAtLevel != 1 )
			{
				Map.ElevatorAtLevel = 1;

				Map.Switches.house_switch.Enabled = false;

				if ( Map.NukeSecured and !Map.BookcaseOpened )
				{
					Map.Switches.bookshelf_switch.Enabled = true;
				}
				if ( Map.NukeSecured and Map.BookcaseOpened and !Map.TopDoor_closed )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Cabin_01" );

					SetAvailableMapGoals(TEAM.ALLIES, true, "ATTACK_elevator_nuke" );
				}
				if ( Map.DoorIsOpen and !Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator and !Map.NukeIsOnTheTruck )
				{
					Map.Switches.elevator_switch_up_0.LimitTeam = 1<<TEAM.ALLIES;
					Map.Switches.elevator_switch_up_0.Enabled = true;
				}

				if ( Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator )
				{
					Map.Switches.elevator_switch_up_0.Enabled = false;	//too long way from axis spawn to switch

					Map.Switches.elevator_switch_level_1.Enabled = true;	//allies can not take the nuke out of elevator
					Map.Switches.elevator_switch_level_2.Enabled = true;	//allies can not take the nuke out of elevator

					SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Elevator_Generator" );	//elevator shall not remain at the top with nuke
				}

				Util.MapDebugPrint( "^5elevator is at the top", true);
			}
		}
		else if ( distanceFromPosition1 > 400 - tolerance && distanceFromPosition1 < 400 + tolerance )
		{
			// elevator at -1 level
			if ( Map.ElevatorAtLevel != 2 )
			{
				Map.ElevatorAtLevel = 2;

				Map.Switches.elevator_switch_level_1.Enabled = false;

				if ( Map.DoorIsOpen and !Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator and !Map.NukeIsOnTheTruck )
				{
					Map.Switches.elevator_switch_up_0.LimitTeam = 1<<TEAM.ALLIES;
					Map.Switches.elevator_switch_up_0.Enabled = true;
				}

				if ( Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator )
				{
					Map.Switches.elevator_switch_up_0.Enabled = false;	//too long way from axis spawn to switch

					Map.Switches.elevator_switch_level_2.Enabled = true;	//allies can not take the nuke out of elevator

					Map.Switches.house_switch.Enabled = true;

					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );

					SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Generator" );
				}

				Util.MapDebugPrint( "^5elevator is near generator", true);
			}
		}
		else if ( distanceFromPosition1 > 656 - tolerance && distanceFromPosition1 < 656 + tolerance )
		{
			// elevator at -2 level
			if ( Map.ElevatorAtLevel != 3 )
			{
				Map.ElevatorAtLevel = 3;

				Map.Switches.elevator_switch_level_2.Enabled = false;

				if ( Map.DoorIsOpen and !Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator and !Map.NukeIsOnTheTruck )
				{
					Map.Switches.elevator_switch_up_0.LimitTeam = 1<<TEAM.ALLIES;
					Map.Switches.elevator_switch_up_0.Enabled = true;
				}

				if ( Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator )
				{
					Map.Switches.elevator_switch_up_0.Enabled = false;	//too long way from axis spawn to switch

					Map.Switches.elevator_switch_level_1.Enabled = true;	//allies can not take the nuke out of elevator

					Map.Switches.house_switch.Enabled = true;

					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );

					SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Generator" );
				}

				Util.MapDebugPrint( "^5elevator is near axis spawn", true);
			}
		}
		else if ( distanceFromPosition1 > 1024 - tolerance )
		{
			// elevator at lowest level
			if ( Map.ElevatorAtLevel != 4 )
			{
				Map.ElevatorAtLevel = 4;

				Map.Switches.elevator_switch_up_0.Enabled = false;

				if ( Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator )
				{
					Map.Switches.elevator_switch_level_1.Enabled = true;
					Map.Switches.elevator_switch_level_2.Enabled = true;

					Map.Switches.house_switch.Enabled = true;

					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );

					SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Generator" );
				}

				if ( Map.DoorIsOpen and !Map.NukeSecured and !Map.NukeIsInTheCabin and Map.Elevator and !Map.NukeIsOnTheTruck )
				{
					Map.Switches.elevator_switch_level_2.Enabled = true;	//allies can not load the nuke
				}

				if ( Map.Nuke_atElevatorDoor and !Map.LowestDoor_closed )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_cart_allies" );
				}

				Util.MapDebugPrint( "^5elevator is bottom near main entrance", true);
			}
		}
		else
		{
			Map.ElevatorAtLevel = -1;
			Map.Switches.elevator_switch_up_0.Enabled = false;
			Map.Switches.house_switch.Enabled = false;
			Map.Switches.elevator_switch_level_1.Enabled = false;
			Map.Switches.elevator_switch_level_2.Enabled = false;

			if ( Map.NukeSecured )
			{
				SetAvailableMapGoals(TEAM.ALLIES, false, "ATTACK_elevator_nuke" );

				if ( Map.Elevator )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Cabin_01" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Cabin_01" );
				}
			}

			if ( Map.Elevator )	//message will be displayed only when the generator is repaired
			{
				Util.MapDebugPrint("moving!", true);
			}
		}

		sleep(1);
	}
};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "axis_truckbar_constructed", Map.Truck_Barrier_Built );
	OnTrigger( "Planted at Truck Barrier.", Map.Truck_Barrier_Planted );
	OnTrigger( "Defused at Truck Barrier.", Map.Truck_Barrier_Defused );
	OnTrigger( "axis_truckbar_destroyed", Map.Truck_Barrier_Destroyed );

	OnTrigger( "^5Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Planted at the Allied Command Post.", Map.Allied_Command_Post_Planted );
	OnTrigger( "Planted at Allied Command Post.", Map.Allied_Command_Post_Planted );	//for Nitmod
	OnTrigger( "Defused at the Allied Command Post.", Map.Allied_Command_Post_Defused );
	OnTrigger( "Defused at Allied Command Post.", Map.Allied_Command_Post_Defused );	//for Nitmod
	OnTrigger( "^1Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );

	OnTrigger( "^1Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "Planted at the Axis Command Post.", Map.Axis_Command_Post_Planted );
	OnTrigger( "Planted at Axis Command Post.", Map.Axis_Command_Post_Planted );	//for Nitmod
	OnTrigger( "Defused at the Axis Command Post.", Map.Axis_Command_Post_Defused );
	OnTrigger( "Defused at Axis Command Post.", Map.Axis_Command_Post_Defused );	//for Nitmod
	OnTrigger( "^5Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );

	OnTrigger( "^5The Allied Cabin MG Nest has been constructed.", Map.Allied_mg_Nest_Built );
	OnTrigger( "Planted at Allied mg Nest.", Map.Allied_mg_Nest_Planted );
	OnTrigger( "Defused at Allied mg Nest.", Map.Allied_mg_Nest_Defused );
	OnTrigger( "^1The Allied Cabin MG Nest has been destroyed.", Map.Allied_mg_Nest_Destroyed );

	OnTrigger( "allies_capture_hill_flag", Map.hill_flag_Allies_Captured );

	OnTrigger( "axis_reclaims_hill_flag", Map.hill_flag_Axis_Captured );

	OnTrigger( "Planted at the Sewers.", Map.Sewers_Planted );
	OnTrigger( "Planted at Sewers.", Map.Sewers_Planted );	//for Nitmod
	OnTrigger( "Defused at the Sewers.", Map.Sewers_Defused );
	OnTrigger( "Defused at Sewers.", Map.Sewers_Defused );	//for Nitmod
	OnTrigger( "^5Allies have breached the Sewers", Map.Sewers_Destroyed );

	OnTrigger( "Planted at the Back Door.", Map.Back_Door_Planted );
	OnTrigger( "Planted at Back Door.", Map.Back_Door_Planted );	//for Nitmod
	OnTrigger( "Defused at the Back Door.", Map.Back_Door_Defused );
	OnTrigger( "Defused at Back Door.", Map.Back_Door_Defused );	//for Nitmod
	OnTrigger( "^5Allies have breached the Back Door", Map.Back_Door_Destroyed );

	OnTrigger( "Planted at the Root Cellar.", Map.Root_Cellar_Planted );
	OnTrigger( "Planted at Root Cellar.", Map.Root_Cellar_Planted );	//for Nitmod
	OnTrigger( "Defused at the Root Cellar.", Map.Root_Cellar_Defused );
	OnTrigger( "Defused at Root Cellar.", Map.Root_Cellar_Defused );	//for Nitmod
	OnTrigger( "^5Allies have breached the Root Cellar", Map.Root_Cellar_Destroyed );

	OnTrigger( "^1The Axis Bunker MG Nest has been constructed.", Map.Axis_mg_Nest_Built );
	OnTrigger( "Planted at the Axis mg Nest.", Map.Axis_mg_Nest_Planted );
	OnTrigger( "Planted at Axis mg Nest.", Map.Axis_mg_Nest_Planted );	//for Nitmod
	OnTrigger( "Defused at the Axis mg Nest.", Map.Axis_mg_Nest_Defused );
	OnTrigger( "Defused at Axis mg Nest.", Map.Axis_mg_Nest_Defused );	//for Nitmod
	OnTrigger( "^5The Axis Bunker MG Nest has been destroyed.", Map.Axis_mg_Nest_Destroyed );

	OnTrigger( "^5The Cart Ramp has been constructed.", Map.Cart_Ramp_Built );
	OnTrigger( "Planted at the Cart Ramp.", Map.Cart_Ramp_Planted );
	OnTrigger( "Planted at Cart Ramp.", Map.Cart_Ramp_Planted );	//for Nitmod
	OnTrigger( "Defused at the Cart Ramp.", Map.Cart_Ramp_Defused );
	OnTrigger( "Defused the Cart Ramp.", Map.Cart_Ramp_Defused );	//for Nitmod
	OnTrigger( "^1The Cart Ramp has been destroyed.", Map.Cart_Ramp_Destroyed );

	OnTrigger( "^5The Elevator Generator has been constructed.", Map.Elevator_Generator_Built );
	OnTrigger( "Planted at the Elevator Generator.", Map.Elevator_Generator_Planted );
	OnTrigger( "Planted at Elevator Generator.", Map.Elevator_Generator_Planted );	//for Nitmod
	OnTrigger( "Defused at the Elevator Generator.", Map.Elevator_Generator_Defused );
	OnTrigger( "Defused at Elevator Generator.", Map.Elevator_Generator_Defused );	//for Nitmod
	OnTrigger( "^1The Elevator Generator has been destroyed.", Map.Elevator_Generator_Destroyed );

	OnTrigger( "^5The Truck has been repaired!", Map.Truck_Built );
	OnTrigger( "^1The Truck has been damaged!", Map.Truck_Destroyed );

	OnTrigger( "Planted at the Main Entrance to the Nuke.", Map.Main_Entrance_to_the_Nuke_Planted );
	OnTrigger( "Planted at Main Entrance to Nuke.", Map.Main_Entrance_to_the_Nuke_Planted );	//for Nitmod
	OnTrigger( "Defused at the Main Entrance to the Nuke.", Map.Main_Entrance_to_the_Nuke_Defused );
	OnTrigger( "Defused at Main Entrance to Nuke.", Map.Main_Entrance_to_the_Nuke_Defused );	//for Nitmod
	OnTrigger( "^5Allies have breached the Main Entrance to the Nuke!", Map.Main_Entrance_to_the_Nuke_Destroyed );

	OnTrigger( "^5Allies have secured the Hill Top!", Map.hill_top_Secured );

	OnTrigger( "^5Allies have the Nuke!", Map.nuke_Taken );
	OnTrigger( "^1Axis have returned the Nuke!", Map.nuke_Returned );

	OnTrigger( "^5The Allies have secured the Nuke in the Elevator!", Map.nuke_In_the_Elevator );

	OnTrigger( "^5The Allies have moved the Nuke into the Cabin!", Map.nuke_In_the_Cabin );

	OnTrigger( "^5Allies have loaded the Nuke onto the truck!", Map.nuke_On_the_Truck );

	OnTrigger( "allies_truck_barrier2", Map.past_Barrier2 );

	OnTrigger( "^5Allied team have escaped with the Nuke!", Map.AlliesWin );

	OnTrigger( "elevator_goto", Map.elevator_trigger );
	OnTrigger( "bookcase_goto", Map.bookcase_trigger );
	OnTrigger( "rockbutton_goto", Map.rock_trigger );

	OnTrigger( "thirty second warning.", Map.Thirty_second );

	OnTrigger( "b3door3_goto", Map.LowestBunkerElevatorDoorMoving );
	OnTrigger( "cabindoor1_goto", Map.TopElevatorDoorMoving );

	OnTrigger( "GRENADE_Sewer_Hatch Exploded.", Map.Sewer_Hatch_Exploded );

	Util.SetGoalPosition(-2579.875, 172.423981, 372.125, "PLANT_Allied_mg_Nest");

	Util.AddUseWp( "PLANT_Back_Door", "dyno1" );
	Util.AddUseWp( "PLANT_Back_Door", "dyno2" );
	Util.AddUseWp( "PLANT_Root_Cellar", "Plant_WP_1" );
	Util.AddUseWp( "PLANT_Root_Cellar", "Plant_WP_2" );
	Util.AddUseWp( "PLANT_Truck_Barrier", "A" );
	Util.AddUseWp( "BUILD_Allied_mg_Nest", "Allied_mg_Nest_Build_WP" );
	Util.AddUseWp( "PLANT_Axis_mg_Nest", "Axis_mg_Nest_plant_WP" );
	Util.AddUseWp( "PLANT_Sewers", "Sewer_Plant_WP_1" );
	Util.AddUseWp( "PLANT_Sewers", "Sewer_Plant_WP_2" );
	Util.AddUseWp( "PLANT_Cart_Ramp", "Cart_Ramp_Plant_WP" );

	Util.LimitToClass( "PLANT_Cart_Ramp", TEAM.AXIS, CLASS.COVERTOPS );
	Util.LimitToClass( "PLANT_Allied_Command_Post", TEAM.AXIS, CLASS.COVERTOPS );
	Util.LimitToClass( "PLANT_Allied_mg_Nest", TEAM.AXIS, CLASS.COVERTOPS );
	Util.LimitToClass( "PLANT_Axis_Command_Post", TEAM.ALLIES, CLASS.COVERTOPS );
	Util.LimitToClass( "PLANT_Axis_mg_Nest", TEAM.ALLIES, CLASS.COVERTOPS );

	Util.DisableGoal( ".*", true );

	Util.ChangeSpawn(TEAM.AXIS, 0);

	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );

	SetGoalRole("MOUNTMG42_Hill", ROLE.DEFENDER);

	Util.EnableGoal( "CHECKPOINT_hill_flag" );

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ATTACK_Allies_Hill_Top_.*",
		"BUILD_Truck",
		"BUILD_Allied_Command_Post",
		"BUILD_Allied_mg_Nest",
		"AMMOCAB_cabin_ammocabinet",
		"HEALTHCAB_cabin_healthcabinet",
		"PLANT_Sewers",
		"PLANT_Back_Door",
		"PLANT_Root_Cellar",
		"GRENADE_hill_mg",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		".*_Axis_Start_.*",
		".*_Axis_Sewers_.*",
		"BUILD_Truck_Barrier",
		"MOUNTMG42_Hill",
		"REPAIRMG42_Hill",
		"AMMOCAB_cabin_ammocabinet",
		"HEALTHCAB_cabin_healthcabinet",
	});

	SetAvailableMapGoals( TEAM.AXIS, false, "MOVER_cabindoor1" );

	Util.DisableGoal( {
		"ROUTE_Back_Door",
		"ROUTE_Root_Cellar",
	});

	SetGoalPriority( "ATTACK_elevator_nuke", 0.81, TEAM.ALLIES, 0  );
	SetGoalPriority( "ATTACK_Allies_Cabin_01", 0.69, TEAM.ALLIES, 0  );
	SetGoalPriority( "ATTACK_Allies_Main_Entrance_.*", 0.51, TEAM.ALLIES, 0  );
	SetGoalPriority( "ATTACK_Allies_TruckAtBarrier1_.*", 0.51, TEAM.ALLIES, 0  );
	SetGoalPriority( "PLANT_Truck_Barrier", 0.82, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Allied_mg_Nest", 0.8, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Cart_Ramp", 0.8, TEAM.AXIS, CLASS.COVERTOPS );

	SetGoalPriority( "PLANT_Cart_Ramp", 0.82, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Elevator_Generator", 0.83, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Allied_Command_Post", 0.82, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "BUILD_Truck_Barrier", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Axis_mg_Nest", 0.8, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_Axis_Start_.*", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Start_13", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Sewers_01", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_HillTop_05", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_HillTop_06", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_HillTop_01", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_HillTop_04", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Sewers_02", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Main_Entrance_.*", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( "PLANT_Elevator_Generator", 0.78, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Axis_Command_Post", 0.78, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Axis_mg_Nest", 0.79, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "REPAIRMG42_Axis_mg_Nest", 0.79, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK_Axis_PastB2_.*", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_PastBridge_.*", 0.52, TEAM.AXIS, 0 );

	Wp.SetWaypointFlag( "axis-door", "closed", false );
	Wp.SetWaypointFlag( "axis-door2", "closed", false );

	Util.SetMaxUsers( 1, "MOUNTMG42.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 2, "BUILD_.*" );
	Util.SetMaxUsers( 1, "BUILD_Axis_mg_Nest" );
	Util.SetMaxUsers( 1, "BUILD_Allied_Command_Post" );
	Util.SetMaxUsers( 1, "BUILD_Axis_Command_Post" );
	Util.SetMaxUsers( 1, "PLANT_.*" );
	Util.SetMaxUsers( 3, "PLANT_Main_Entrance.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 2, "ESCORT_truck" );
	Util.SetMaxUsers( 4, "ESCORT_cart_allies" );

	Util.OnTriggerPosition( "MOVER_truck", "barrier_8", 150.0, Map.truck_at_barrier );
	Util.OnTriggerPosition( "MOVER_truck", "Near_Barrier", 200.0, Map.truck_near_barrier );

	Util.UpdateSwitchData();

	thread(Map.WatchElevatorPosition);

	truck1 = OnTriggerRegion( Vec3(-326,2374,1146), 80, Map.truck_at_door );
	TruckOnBridge = OnTriggerRegion( Vec3(625, -1088, 196), 80, Map.Truck_On_Bridge );
	TruckOnBridge1 = OnTriggerRegion( Vec3(877, -1733, 196), 80, Map.Truck_On_Bridge1 );
	TruckAtBridge = OnTriggerRegion( Vec3(349, -229, 273), 80, Map.Truck_At_Bridge );
	TruckPastBridge2 = OnTriggerRegion( Vec3(1271, -2220, 180), 80, Map.Truck_Past_Bridge2 );
	break1 = OnTriggerRegion( AABB(460.027,2350.292,886.800,654.336,2671.970,1010.041), RegionTrigger.BreakableDistance );
	break2 = OnTriggerRegion( AABB(-185.195,257.126,50.567,-66.612,417.956,201.734), RegionTrigger.BreakableDistance );
	break3 = OnTriggerRegion( AABB(180.130,2345.648,1081.125,323.944,2437.318,1222.285), RegionTrigger.BreakableDistance );	//window cabin
	break4 = OnTriggerRegion( AABB(-1265.605,2468.875,1039.647,-1152.239,2589.108,1225.800), RegionTrigger.BreakableDistance );	//window library
	break5 = OnTriggerRegion( AABB(-311.068,2396.165,741.125,-165.455,2638.976,875.299), RegionTrigger.BreakableDistance );	//window generator
	break6 = OnTriggerRegion( AABB(382.914,1183.125,445.125,472.875,1363.839,519.125), RegionTrigger.BreakableDistance );	//ventilation shaft 1
	break7 = OnTriggerRegion( AABB(139.125,1031.125,285.125,204.875,1156.135,495.125), RegionTrigger.BreakableDistance );	//ventilation shaft 2
	break8 = OnTriggerRegion( AABB(-604.975,1999.125,474.974,-515.126,2064.875,707.125), RegionTrigger.BreakableDistance );	//ventilation shaft cabinet 1
	break9 = OnTriggerRegion( AABB(-1052.875,2260.918,633.125,-987.125,2400.361,697.698), RegionTrigger.BreakableDistance );	//ventilation shaft cabinet 2
	break10 = OnTriggerRegion( AABB(-885.550,2679.595,77.125,-706.051,2765.127,195.348), RegionTrigger.BreakableDistance );	//window main entrance
	break11 = OnTriggerRegion( AABB(-755.405,1535.303,77.353,-614.441,1780.257,195.125), RegionTrigger.BreakableDistance );	//window hall to main entrance 1
	break12 = OnTriggerRegion( AABB(647.330,1589.424,77.125,790.661,1772.876,195.307), RegionTrigger.BreakableDistance );	//window hall to main entrance 2

	nukeatElevatorDoor = OnTriggerRegion( AABB(-934.874,2420.030,81.125,-896.874,2458.030,155.125), Map.Nuke_at_ElevatorDoor );
	nukeleftroom = OnTriggerRegion( AABB(-939.711,2147.449,77.125,-812.594,2465.877,190.125), Map.Nuke_Left_Room );
	triggerLowestDoor = OnTriggerRegion( AABB(-944.875,2443.144,81.125,-906.875,2491.608,155.125), Map.trigger_LowestDoor );
	triggerTopDoor = OnTriggerRegion( AABB(-957.911,2402.513,1105.125,-915.125,2465.898,1179.125), Map.trigger_TopDoor );
	triggerCartRamp = OnTriggerRegion( AABB(-563.677,2475.939,1105.125,-511.834,2516.085,1179.125), Map.trigger_CartRamp );
	truckpastb1 = OnTriggerRegion( AABB(235.697,182.212,446.042,286.727,235.515,498.987), Map.Truck_past_b1 );

	RegionTrigger.BreakableDistance.MinBreakableDist = 50;
	RegionTrigger.BreakableDistance.MaxBreakableDist = 150;

	Map.iw1 = OnTriggerRegion( AABB(283.959,2309.262,1078.865,560.409,2479.720,1253.359), RegionTrigger.IntrusionWarning );
	DCM1 = OnTriggerRegion(AABB(20.961,2279.125,1078.392,391.836,2466.315,1207.125), RegionTrigger.DisableCombatMovement);
	DCM2 = OnTriggerRegion(AABB(-58.399,2258.069,661.125,71.904,2447.305,890.842), RegionTrigger.DisableCombatMovement);
	DCM3 = OnTriggerRegion(AABB(-219.237,3048.363,651.392,-87.474,3274.409,1100.992), RegionTrigger.DisableCombatMovement);
	DCM4 = OnTriggerRegion(AABB(-766.875,2011.125,77.211,-586.345,2081.958,259.125), RegionTrigger.DisableCombatMovement);
	DCM5 = OnTriggerRegion(AABB(-712.338,3049.735,985.072,-530.914,3212.932,1102.731), RegionTrigger.DisableCombatMovement);
	DCM6 = OnTriggerRegion(AABB(135.031,2902.358,1001.073,380.559,3002.256,1127.740), RegionTrigger.DisableCombatMovement);
	DCM7 = OnTriggerRegion(AABB(-1031.348,2525.880,77.125,-813.857,2686.124,151.125), RegionTrigger.DisableCombatMovement);	//Axis door to the nuke
	DCM8 = OnTriggerRegion(AABB(-402.499,2507.421,709.125,-173.637,2625.281,842.580), RegionTrigger.DisableCombatMovement);	//Window near back door
	DCM9 = OnTriggerRegion(AABB(748.669,2111.125,445.125,1080.175,2256.875,539.125), RegionTrigger.DisableCombatMovement);	//Rock exit
	DCM10 = OnTriggerRegion(AABB(-75.123,2571.125,285.125,120.965,2696.875,519.125), RegionTrigger.DisableCombatMovement);	//Ladder near axis CP
	DCM11 = OnTriggerRegion(AABB(438.185,2082.869,217.125,680.945,2617.724,359.125), RegionTrigger.DisableCombatMovement);	//above the tank with poison
	DCM12 = OnTriggerRegion(AABB(1058.531,128.278,413.702,1281.551,307.337,499.199), RegionTrigger.DisableCombatMovement);	//attack_axis_pastb2_05
	DCM13 = OnTriggerRegion(AABB(860.815,303.888,482.067,946.244,384.054,568.110), RegionTrigger.DisableCombatMovement);	//attack_axis_pastb2_08
	DCM14 = OnTriggerRegion(AABB(-1505.270,2011.125,5.125,-959.126,2132.935,151.125), RegionTrigger.DisableCombatMovement);	//escort nuke to elevator
	DCM15 = OnTriggerRegion(AABB(-304.798,2375.127,741.125,-184.925,2504.875,859.711), RegionTrigger.DisableCombatMovement);	//ATTACK_Allies_Elevator_Generator_07
	DCM16 = OnTriggerRegion(AABB(-610.240,2011.127,285.125,-431.293,2136.875,381.523), RegionTrigger.DisableCombatMovement);	//Railing jump down near main entrance to the nuke
	DCM17 = OnTriggerRegion(AABB(-213.798,2571.125,285.125,-91.264,2696.875,382.487), RegionTrigger.DisableCombatMovement);	//Railing jump down near main entrance to the nuke
	NP1 = OnTriggerRegion(AABB(20.961,2279.125,1078.392,391.836,2466.315,1207.125), RegionTrigger.DisableBotPush);
	NP2 = OnTriggerRegion(AABB(-58.399,2258.069,661.125,71.904,2447.305,890.842), RegionTrigger.DisableBotPush);
	NP3 = OnTriggerRegion(AABB(-219.237,3048.363,651.392,-87.474,3274.409,1100.992), RegionTrigger.DisableBotPush);
	NP4 = OnTriggerRegion(AABB(-766.875,2011.125,77.211,-586.345,2081.958,259.125), RegionTrigger.DisableBotPush);
	NP5 = OnTriggerRegion(AABB(-712.338,3049.735,985.072,-530.914,3212.932,1102.731), RegionTrigger.DisableBotPush);
	NP6 = OnTriggerRegion(AABB(135.031,2902.358,1001.073,380.559,3002.256,1127.740), RegionTrigger.DisableBotPush);
	NP7 = OnTriggerRegion(AABB(133.705,2549.260,1090.669,214.875,2652.249,1171.408), RegionTrigger.DisableBotPush);	//Defend_axis_hilltop_04
	NP8 = OnTriggerRegion(AABB(-1035.700,2143.026,1267.509,-968.740,2209.198,1354.344), RegionTrigger.DisableBotPush);	//Defend_axis_hilltop_09
	NP9 = OnTriggerRegion(AABB(529.518,2000.648,1044.447,658.130,2092.994,1128.932), RegionTrigger.DisableBotPush);	//Defend_axis_hilltop_06
	NP10 = OnTriggerRegion(AABB(-402.499,2507.421,709.125,-173.637,2625.281,842.580), RegionTrigger.DisableBotPush);	//Window near back door
	NP11 = OnTriggerRegion(AABB(748.669,2111.125,445.125,1080.175,2256.875,539.125), RegionTrigger.DisableBotPush);	//Rock exit
	NP12 = OnTriggerRegion(AABB(-1659.780,2426.329,101.125,-1542.400,2495.031,175.125), RegionTrigger.DisableBotPush);	//Mobilemg42_war_room
	NP13 = OnTriggerRegion(AABB(-210.638,2976.241,121.125,-95.070,3064.874,195.125), RegionTrigger.DisableBotPush);	//Mobilemg42_main_entrance
	NP14 = OnTriggerRegion(AABB(-75.123,2571.125,285.125,120.965,2696.875,519.125), RegionTrigger.DisableBotPush);	//Ladder near axis CP
	NP15 = OnTriggerRegion(AABB(-216.240,287.053,209.125,17.837,428.815,322.057), RegionTrigger.DisableBotPush);	//Sewer hatch
	NP16 = OnTriggerRegion(AABB(-296.874,2896.071,661.125,-180.593,3088.875,736.125), RegionTrigger.DisableBotPush);	//Axis back door
	NP17 = OnTriggerRegion(AABB(1058.531,128.278,413.702,1281.551,307.337,499.199), RegionTrigger.DisableBotPush);	//attack_axis_pastb2_05
	NP18 = OnTriggerRegion(AABB(860.815,303.888,482.067,946.244,384.054,568.110), RegionTrigger.DisableBotPush);	//attack_axis_pastb2_08
	NP19 = OnTriggerRegion(AABB(-304.798,2375.127,741.125,-184.925,2504.875,859.711), RegionTrigger.DisableBotPush);	//ATTACK_Allies_Elevator_Generator_07

	print( "^3Omni-bot map script for ^8" + GetMapName() + " ^3executed. Corrected by ^1Q^2i^3k^4i ^3and ^1n^2a^4t^8i^3v^5e12^3." );

	Util.DisableGoal ( "ROUTE_Back_Door" );
	Util.DisableGoal ( "ROUTE_Root_Cellar" );
	Util.DisableGoal ( "ROUTE_Sewerexit" );
	Util.DisableGoal ( "ROUTE_Sewer" );

	Util.FixMoverPos("truck",  Vec3(-2906.500, -687.000, 412.500), Vec3(-3052.000, -688.000, 356.000));

	sleep( 2 );

	Util.AddInvVehicle( "MOVER_cart" );
};

global OnBotJoin = function( bot )
{
	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );

	WeaponTable.SetWeaponTeamAvailability( TEAM.ALLIES, CLASS.SOLDIER, WEAPON.MOBILE_MG42, false );
	WeaponTable.SetWeaponTeamAvailability( TEAM.ALLIES, CLASS.SOLDIER, WEAPON.MORTAR, false );

	if ( ETUtil.CountClass( TEAM.AXIS, CLASS.SOLDIER ) < 2 )
	{
		if ( Map.NukeIsInTheCabin or Map.NukeIsOnTheTruck )
		{
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MOBILE_MG42, false );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, false );

			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MORTAR, true );
		}
		else
		{
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MORTAR, false );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, false );

			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MOBILE_MG42, true );

			if ( bot.HasWeapon(WEAPON.FLAMETHROWER) or bot.HasWeapon(WEAPON.MORTAR) or bot.HasWeapon(WEAPON.PANZERFAUST) )
			{
				bot.ExecCommand("kill");
				Util.MapDebugPrint( "^5I have wrong weapon" );
			}
		}
	}
	else
	{
		if ( Map.NukeIsInTheCabin or Map.NukeIsOnTheTruck )
		{
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MOBILE_MG42, false );

			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MORTAR, true );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, true );
		}
		else
		{
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MORTAR, false );

			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.MOBILE_MG42, true );
			WeaponTable.SetWeaponTeamAvailability( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, true );
		}
	}

	bot.MaxViewDistance = 2300;

	yield();yield();

	if( bot.CanSnipe() )
	{
		bot.MaxViewDistance = 2500;
	}
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		CHECKPOINT_hill_flag =
		{
			ROUTE_allied_spawn =
			{
				ROUTE_river1 = {},
				ROUTE_bridge1 = {},
				ROUTE_bridge2 = {},
				ROUTE_cabin1 =
				{
					ROUTE_cabin2 = {},
					ROUTE_roof1 = {},
				},
			},
		},
		PLANT_Cart_Ramp =
		{
			ROUTE_Axis_Bunker =
			{
				ROUTE_Crossroads =
				{
					ROUTE_Water_Way_1 =
					{
						ROUTE_Hill_1 =
						{
							ROUTE_Hill_2 =
							{
								ROUTE_House_1 =
								{
									ROUTE_House_2 =
									{

									},
								},
							},
						},
					},
				},
			},
		},
		PLANT_Allied_Command_Post =
		{
			ROUTE_Spawn =
			{
				ROUTE_Water_Way_1 =
				{
					ROUTE_ToAllied_CP =
					{

					},
				},
			},
			ROUTE_Spawn_1 =
			{
				ROUTE_Water_Way_1 =
				{
					ROUTE_ToAllied_CP =
					{

					},
				},
			},
			ROUTE_Spawn_2 =
			{
				ROUTE_Water_Way_1 =
				{
					ROUTE_ToAllied_CP =
					{

					},
				},
			},
			ROUTE_Axis_Bunker =
			{
				ROUTE_Crossroads =
				{
					ROUTE_Water_Way_1 =
					{
						ROUTE_ToAllied_CP =
						{

						},
					},
				},
			},
			ROUTE_MG42_Hill =
			{
				ROUTE_Water_Way_1 =
				{
					ROUTE_ToAllied_CP =
					{

					},
				},
			},
		},
	};

	MapRoutes["ATTACK_Allies_Main_Entrance_.*"] =
	{
		ROUTE_Spawn =
		{
			ROUTE_Back_Door =
			{
				ROUTE_Crossroads =
				{
					ROUTE_Jump =
					{

					},
					ROUTE_Stairs =
					{
						Weight = 2,
					},
				},
			},
			ROUTE_Root_Cellar =
			{
				Weight = 2,
				ROUTE_Way_1 =
				{
					ROUTE_Crossroads =
					{
						ROUTE_Jump =
						{

						},
						ROUTE_Stairs =
						{
							Weight = 2,
						},
					},
				},
			},
		},
		ROUTE_Spawn_1 =
		{
			ROUTE_Back_Door =
			{
				ROUTE_Crossroads =
				{
					ROUTE_Jump =
					{

					},
					ROUTE_Stairs =
					{
						Weight = 2,
					},
				},
			},
			ROUTE_Root_Cellar =
			{
				Weight = 2,
				ROUTE_Way_1 =
				{
					ROUTE_Crossroads =
					{
						ROUTE_Jump =
						{

						},
						ROUTE_Stairs =
						{
							Weight = 2,
						},
					},
				},
			},
		},
		ROUTE_Spawn_2 =
		{
			ROUTE_Back_Door =
			{
				ROUTE_Crossroads =
				{
					ROUTE_Jump =
					{

					},
					ROUTE_Stairs =
					{
						Weight = 2,
					},
				},
			},
			ROUTE_Root_Cellar =
			{
				Weight = 2,
				ROUTE_Way_1 =
				{
					ROUTE_Crossroads =
					{
						ROUTE_Jump =
						{

						},
						ROUTE_Stairs =
						{
							Weight = 2,
						},
					},
				},
			},
		},
	};

	MapRoutes["ATTACK_Allies_Elevator_Generator_.*"] =
	{
		ROUTE_Spawn =
		{
			ROUTE_Back_Door =
			{
				ROUTE_Way_3 =
				{

				},
			},
			ROUTE_Root_Cellar =
			{
				ROUTE_Way_1 =
				{
					ROUTE_Way_2 =
					{
						ROUTE_Way_3 =
						{

						},
					},
				},
			},
		},
		ROUTE_Spawn_1 =
		{
			ROUTE_Back_Door =
			{
				ROUTE_Way_3 =
				{

				},
			},
			ROUTE_Root_Cellar =
			{
				ROUTE_Way_1 =
				{
					ROUTE_Way_2 =
					{
						ROUTE_Way_3 =
						{

						},
					},
				},
			},
		},
		ROUTE_Spawn_2 =
		{
			ROUTE_Back_Door =
			{
				ROUTE_Way_3 =
				{

				},
			},
			ROUTE_Root_Cellar =
			{
				ROUTE_Way_1 =
				{
					ROUTE_Way_2 =
					{
						ROUTE_Way_3 =
						{

						},
					},
				},
			},
		},
	};

	MapRoutes["ATTACK_Axis_Barrier2_.*"] =
	{
		ROUTE_Axis_Bunker =
		{
			ROUTE_Sewer =
			{
				Weight = 2,
				ROUTE_Sewerexit =
				{

				},
			},
			ROUTE_Crossroads =
			{
				ROUTE_Water_Way_1 =
				{

				},
				ROUTE_Rockexit =
				{
					Weight = 3,
				},
				ROUTE_Root_Cellar =
				{
					Weight = 3,
				},
				ROUTE_Back_Door =
				{

				},
			},
		},
	};

	MapRoutes["MOBILEMORTAR_.*"] =
	{
		ROUTE_Axis_Bunker =
		{
			ROUTE_Crossroads =
			{
				ROUTE_Back_Door =
				{
					Weight = 2,
					ROUTE_Back =
					{

					},
				},
				ROUTE_Rockexit =
				{

				},
			},
		},
	};

	MapRoutes["PLANTMINE_Axis_TruckRoad_.*"] =
	{
		ROUTE_Axis_Bunker =
		{
			ROUTE_Sewer =
			{
				Weight = 2,
				ROUTE_Sewerexit =
				{

				},
			},
			ROUTE_Crossroads =
			{
				ROUTE_Rockexit =
				{
					//Weight = 2,
				},
			},
		},
	};

	MapRoutes[".*_Axis_PastB2_.*"] =
	{
		ROUTE_Axis_Bunker =
		{
			ROUTE_Crossroads =
			{
				ROUTE_Rockexit =
				{
					Weight = 3,
					ROUTE_Along_River_1 =
					{
						ROUTE_Along_River_2 =
						{
							ROUTE_Along_River_3 =
							{
								ROUTE_Along_River_4 =
								{

								},
							},
						},
					},
				},
				ROUTE_Root_Cellar =
				{

				},
			},
			ROUTE_Sewer =
			{
				//Weight = 2,
				ROUTE_Sewerexit =
				{

				},
			},
		},
	};

	MapRoutes["PLANT_Main_Entrance.*"] = MapRoutes["ATTACK_Allies_Main_Entrance_.*"];
	MapRoutes["ATTACK_Nuke_.*"] = MapRoutes["ATTACK_Allies_Main_Entrance_.*"];
	MapRoutes.ESCORT_cart_allies = MapRoutes["ATTACK_Allies_Main_Entrance_.*"];
	MapRoutes.BUILD_Truck_Barrier = MapRoutes["PLANTMINE_Axis_TruckRoad_.*"];
	MapRoutes.PLANT_Allied_mg_Nest = MapRoutes.PLANT_Allied_Command_Post;

	Util.Routes(MapRoutes);
};
