//==========================================================================================
//
//	flame-guards.gm
//
//	Who      	When		What
//------------------------------------------------------------------------------------------
//	Qiki		19 August 2012	Initial Script
//	Native12	16.12.2012 	Ready to test
//	Native12	25.12.2012 	Added Routes and more improvements
//	Native12	20.04.2017 	Fixed: switches near generator, navigates, stuckages, spawns (stupid NQ mod),
//					Build and Plant CP at last phase of game, and a lot of minor changes.....
//
//==========================================================================================
//

global Map =
{
	Debug = 0,
	
	Barricade_Dyno = 0,
	Barricade_1_Dyno = 0,
	Command_Post_Dyno = 0,
	Generator_Dyno = 0,
	GeneratorDestroyed = false,
	Generator_Protection_Net_Dyno = 0,
	Side_Gate_Dyno = 0,
	basement_gate_Dyno = 0,
	basement_gate_1_Dyno = 0,
	BasementGate_Destroyed = false,
	blast_door_Dyno = 0,
	blastdoor_Destroyed = false,
	gun_Dyno = 0,
	sewer_exit_gate_Dyno = 0,
	warehouse_blast_door_Dyno = 0,
	gunm = 0,
	gunmTaken = 0,
	gun = 0,
	gun_ready = 0,
	Explosive = 0,
	WoodenBarrier1_Exploded = false,
	WoodenBarrier2_Exploded = false,
	Phase_1 = true,
	Phase_2 = false,
	Phase_3 = false,
	Phase_4 = false,
	Phase_5 = false,
	Phase_6 = false,
	WarehouseBlastDoorDestroyed = false,
	Axis_InPhase2 = 0,
	Gunmaterial_Secured = false,
	GunBarricadeDestroyed = true,
	FlagAlliesCaptured = true,
	FlagAxisCaptured = false,
	AmmoTaken = false,
	AmmoSecured = false,
	GeneratorProtectionNetBuilt = false,
	AlliedCP = false,
	TrainyardTunnel_Destroyed = false,
	Door_opened = false,
	Door_opening = false,
	Door_closing = false,
	KT_InsideNet = 0,
	KeyCardTaken = false,
	RocketDestroyed = false,
	Somebody_Near_Inside_Switch = 0,
	KT_SomebodyNearInsideSwitch = 0,
	Somebody_Near_Outside_Switch = 0,
	KT_SomebodyNearOutsideSwitch = 0,
	HatchExploded = false,
	HatchToFlagExploded = false,
	KT_NQMod_FirstSpawn = 0,
	KT_NQMod_Tunnel = 0,
	KT_NQMod_BlastDoor = 0,
	KT_NQMod_basement = 0,
	KT_NQMod_1 = 0,
	KT_NQMod_2 = 0,
	KT_NQMod_3 = 0,
	KT_NQMod_4 = 0,
	
	Switches =
	{
		//	/bot waypoint_setproperty paththrough UseSwitch_PT:outside_switch
		outside_switch =
		{
			AimPosition = Vec3(-832.125, 6293.736, -92.361),	///bot aim_pos
			Enabled = true,
			LimitTeam = (1<<TEAM.AXIS) | (1<<TEAM.ALLIES),
			Priority = 0.0,
			WaypointName = "outside_switch",
			LimitBots = 1,
			Timeout = 390,
			
			ExitConditions =
			{
				f = function(bot)
				{
					return Map.Door_opening;
				}
			},
			
			Wait = function()
			{
				return Map.Door_opened;
			},
		},
		
		//	/bot waypoint_setproperty paththrough UseSwitch_PT:inside_switch
		inside_switch =
		{
			AimPosition = Vec3(-1087.751, 6207.875, -97.529),	///bot aim_pos
			Enabled = true,
			LimitTeam = (1<<TEAM.AXIS) | (1<<TEAM.ALLIES),
			Priority = 0.0,
			WaypointName = "inside_switch",
			LimitBots = 1,
			Timeout = 300,
			
			ExitConditions =
			{
				f = function(bot)
				{
					return Map.Door_opening;
				}
			},
			
			Wait = function()
			{
				return Map.Door_opened;
			},
		},
	},
	
	Navigation =
	{
		//  	/bot waypoint_setproperty paththrough Navigation_PT:ladderinaxisspawn
		ladderinaxisspawn =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("ladderinaxisspawn", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					yield();
					yield();
					_this.Bot.HoldButton(BTN.FORWARD, 1.5);
					sleep(1.5);
				}
			},
		},
		//	/bot waypoint_setproperty paththrough Navigation_PT:jump_
		jump_ =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.JUMP, 0.55);
				sleep(0.55);
			},
		},
		//	/bot waypoint_setproperty paththrough Navigation_PT:crate_jump
		crate_jump =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.JUMP, 0.55);
				sleep(0.2);
				_this.Bot.HoldButton(BTN.CROUCH, 0.3);
				sleep(0.3);
			},
		},
		
		//	/bot waypoint_setproperty paththrough Navigation_PT:jump_a
		jump_a =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.SPRINT, 1.25);
				_this.Bot.HoldButton(BTN.FORWARD, 1.25);
				_this.Bot.PressButton(BTN.JUMP);
				sleep(1.25);
			},
		},
		//  	/bot waypoint_setproperty paththrough Navigation_PT:ladderinaxisspawn_1
		ladderinaxisspawn_1 =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("ladderinaxisspawn_1", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					yield();
					yield();
					_this.Bot.HoldButton(BTN.FORWARD, 2.5);
					sleep(2.5);
				}
			},
		},
		//  	/bot waypoint_setproperty paththrough Navigation_PT:ladderinaxisspawn_2
		ladderinaxisspawn_2 =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("ladderinaxisspawn_2", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					yield();
					yield();
					_this.Bot.HoldButton(BTN.FORWARD, 2.5);
					sleep(2.5);
				}
			},
		},
		//  	/bot waypoint_setproperty paththrough Navigation_PT:spawnbox
		spawnbox =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("spawnbox", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					yield();
					_this.Bot.HoldButton(BTN.FORWARD, 0.55);
					_this.Bot.HoldButton(BTN.JUMP, 0.55);
					sleep(0.55);
				}
			},
		},
		//  	/bot waypoint_setproperty paththrough Navigation_PT:elevator_rope
		elevator_rope =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Elevator_Rope", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					yield();
					_this.Bot.HoldButton(BTN.FORWARD, 2.7);
					sleep(2.7);
					_this.Bot.HoldButton(BTN.STRAFE_L, 1);
					_this.Bot.HoldButton(BTN.FORWARD, 0.5);
					sleep(1);
				}
			},
		},
		//  	/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.15);
					_this.Bot.HoldButton(BTN.JUMP, 1.1);
					_this.Bot.HoldButton(BTN.FORWARD, 1.1);
					sleep(2.5);
					_this.Bot.HoldButton(BTN.JUMP, 1.1);
					_this.Bot.HoldButton(BTN.FORWARD, 1.1);
					sleep(1.1);
					_this.Bot.HoldButton(BTN.STRAFE_L, 0.8);
					sleep(0.8);
				}
			},
		},
		//  	/bot waypoint_setproperty paththrough Navigation_PT:hatchover_generator
		hatchover_generator =
		{
			EvalFunc = function() // if this function returns false, navigation will not run
			{
				return !Map.HatchExploded;
			},
			
			navigate = function(_this)
			{
				if ( Map.HatchExploded )
				{
					yield();
					return;
				}
				
				_this.AddWeaponRequest(Priority.High, WEAPON.KNIFE);
				_this.AddAimRequest(Priority.High, "facing", Vector3(0.042744,0.057507,-0.997430));
				
				while( !Map.HatchExploded )
				{
					_this.Bot.HoldButton(BTN.CROUCH, 1);
					_this.Bot.HoldButton(BTN.ATTACK1, 1);
					yield();
				}
				
				_this.ReleaseAimRequest();
			},
		},
		//  	/bot waypoint_setproperty paththrough Navigation_PT:hatch_toflagexploded
		hatch_toflagexploded =
		{
			gotowp = "Hatch", // waypoint for the bot to go to before doing anything else
			EvalFunc = function() // if this function returns false, navigation will not run
			{
				return !Map.HatchToFlagExploded;
			},
			
			navigate = function(_this)
			{
				if ( Map.HatchToFlagExploded )
				{
					yield();
					return;
				}
				
				_this.AddWeaponRequest(Priority.High, WEAPON.LUGER);
				_this.AddAimRequest(Priority.High, "facing", Vector3(0.003915,-0.972331,0.233576));

				while( !Map.HatchToFlagExploded )
				{
					_this.Bot.PressButton(BTN.ATTACK1);
					yield();
				}
				
				_this.ReleaseAimRequest();
				sleep(0.5);
			},
		},
		//  	/bot waypoint_setproperty paththrough Navigation_PT:jumptotunnel
		jumptotunnel =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Tunnel", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.High, "facing", Vector3(0.003915,-0.972331,0.233576));
					sleep(0.3);
					_this.Bot.HoldButton(BTN.FORWARD, 0.5);
					_this.Bot.HoldButton(BTN.JUMP, 0.5);
					sleep(0.3);
					_this.Bot.HoldButton(BTN.CROUCH, 0.5);
					_this.Bot.HoldButton(BTN.FORWARD, 0.5);
					sleep(0.5);
				}
			},
		},
	},
	
	Wooden_Barrier_1_Exploded = function( trigger )
	{
		if ( Map.Phase_1 )
		{
			Map.WoodenBarrier1_Exploded = true;
			
			SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_WoodenBarrier_1" );
			
			if ( !Map.WoodenBarrier2_Exploded )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_Under_Ladders" );
				
				sleep(1.5);
				
				SetAvailableMapGoals( TEAM.AXIS, false, "CAMP_Axis_Start_.*" );
				
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"PLANT_sewer_exit_gate",
					".*_Axis_SewerExitGate_.*",
				});
			}
		}
		
		Util.MapDebugPrint( "^3Wooden_Barrier_1_Exploded" );
	},
	
	Wooden_Barrier_2_Exploded = function( trigger )
	{
		if ( Map.Phase_1 )
		{
			Map.WoodenBarrier2_Exploded = true;
			
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"ROUTE_WoodenBarrier_2",
				"ROUTE_WaterTunnel",
			});
			
			if ( !Map.WoodenBarrier1_Exploded )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_Under_Ladders" );
				
				sleep(1.5);
				
				SetAvailableMapGoals( TEAM.AXIS, false, "CAMP_Axis_Start_.*" );
				
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"PLANT_sewer_exit_gate",
					".*_Axis_SewerExitGate_.*",
				});
			}
		}
		
		Util.MapDebugPrint( "^3Wooden_Barrier_2_Exploded" );
	},
	
	sewer_exit_gate_Planted = function( trigger )
	{
		Map.sewer_exit_gate_Dyno += 1;
		
		Util.MapDebugPrint( "^3sewer_exit_gate_Planted" );
	},
	
	sewer_exit_gate_Defused = function( trigger )
	{
		Map.sewer_exit_gate_Dyno -= 1;
		
		Util.MapDebugPrint( "^3sewer_exit_gate_Defused" );
	},
	
	sewer_exit_gate_Destroyed = function( trigger )
	{
		if ( Map.Phase_1 )
		{
			if ( Map.sewer_exit_gate_Dyno > 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_sewer_exit_gate_.*" );
			}
			
			Map.sewer_exit_gate_Dyno = 0;
			
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"DEFEND_Allies_SewerExitGate_06",
				"DEFEND_Allies_SewerExitGate_07",
				"DEFEND_Allies_SewerExitGate_08",
				"DEFEND_Allies_SewerExitGate_10",
			});
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_BasementGate_.*" );
			
			sleep(2);
			
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"ATTACK_Axis_SewerExitGate_01",
				"ATTACK_Axis_SewerExitGate_02",
				"ATTACK_Axis_SewerExitGate_08",
				"ATTACK_Axis_SewerExitGate_09",
			});
			
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"PLANT_basement_gate",
				"ATTACK_Axis_BasementGate_.*",
			});
		}
		
		Util.MapDebugPrint( "^3sewer_exit_gate_Destroyed" );
	},
	
	AmbusherTrigger =
	{
		Name = "AmbusherTrigger",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( !Map.BasementGate_Destroyed )
			{
				bot = Util.IsBot(ent);
				if(bot)
				{
					bot.SetRoles(ROLE.AMBUSHER);
				}
			}
			
			Util.MapDebugPrint( "^5Setting role Ambusher" );
		},
		OnExit = function(ent)
		{
			if ( !Map.BasementGate_Destroyed )
			{
				bot = Util.IsBot(ent);
				if(bot)
				{
					bot.ClearRoles(ROLE.AMBUSHER);
				}
			}
			
			Util.MapDebugPrint( "^5Clearing role Ambusher" );
		},
	},
	
	basement_gate_Planted = function( trigger )
	{
		if ( Map.Phase_1 )
		{
			Map.basement_gate_Dyno += 1;
			
			Util.MapDebugPrint( "^3basement_gate_Planted" );
		}
	},
	
	basement_gate_Defused = function( trigger )
	{
		if ( Map.Phase_1 )
		{
			Map.basement_gate_Dyno -= 1;
			
			Util.MapDebugPrint( "^3basement_gate_Defused" );
		}
	},
	
	basement_gate_Destroyed = function( trigger )
	{
		DeleteTriggerRegion("AmbusherTrigger");
		
		Map.BasementGate_Destroyed = true;
		
		if ( Map.basement_gate_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_basement_gate_.*" );
		}
		
		Map.basement_gate_Dyno = 0;
		
		if ( Map.Phase_1 )
		{
			OnTriggerRegion(AABB(-5600.870,3199.128,-702.875,-3999.210,3840.870,-1.125), Map.KT_NQMod_FirstSpawn);	//first axis spawn
			
			ETUtil.SuicideSpawn( TEAM.ALLIES, 1, -1, 0 );	//Courtyard exit
			
			Map.Phase_1 = false;
			Map.Phase_2 = true;
			
			print( "^3Phase 2" );
			
			sleep(2);
			
			Util.DisableGoal( ".*", true );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_Allies_GunMaterial_01",
				"BUILD_Barricade",
				"AMMOCAB_north_ammocabinet_1",
				"AMMOCAB_north_ammocabinet_2",
				"HEALTHCAB_north_healthcabinet_2",
				"HEALTHCAB_north_healthcabinet_4",
				".*_Forward_Spawn",
				".*_Courtryard",
				"DEFEND_Allies_CourtyYard_.*",
				"MOBILEMG42_Allies_CourtyYard_.*",
			});
			
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"CHECKPOINT_flag1",
				".*_Forward_Spawn",
				"AMMOCAB_north_ammocabinet_1",
				"AMMOCAB_north_ammocabinet_2",
				"HEALTHCAB_north_healthcabinet_2",
				"HEALTHCAB_north_healthcabinet_4",
				"PLANT_warehouse_blast_door",
				"FLAG_gunm",
				".*_Axis_CourtyYard_.*",
				"ATTACK_Flag_.*",
			});
			
			Util.MapDebugPrint( "^3basement_gate_Destroyed" );
		}
	},
	
	Axis_In_Phase_2 =
	{
		Name = "Axis_In_Phase_2",
		TriggerOnClass = CLASS.ANYPLAYER,
		
		OnEnter = function(ent)
		{
			if ( Map.Phase_2 )
			{
				if( GetEntTeam(ent) == TEAM.AXIS )
				{
					Map.Axis_InPhase2 += 1;
					
					if ( Map.FlagAlliesCaptured )
					{
						if ( Map.Axis_InPhase2 == 1 )	//it will run only once
						{
							Util.MapDebugPrint( "^5Axis entered into trigger Axis_In_Phase_2" );
							
							sleep(5);
							
							if ( Map.Gunmaterial_Secured )	//Map.gunm == 3 => wall destroyed
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, ".*_Allies_CourtyYard_.*" );
								
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									"DEFEND_Allies_Gun_.*",
									"MOBILEMG42_Allies_Gun_05",
									"AMMOCAB_north_ammocabinet_1",
									"AMMOCAB_north_ammocabinet_2",
									"HEALTHCAB_north_healthcabinet_2",
									"HEALTHCAB_north_healthcabinet_4",
									".*_Forward_Spawn",
									".*_Courtryard",
									"DEFEND_Allies_CourtyYard_2",
									"DEFEND_Allies_CourtyYard_3",
									"DEFEND_Allies_CourtyYard_4",
									"DEFEND_Allies_CourtyYard_12",
								});
								
								if ( !Map.AmmoSecured and !Map.AmmoTaken )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_Ammo_.*" );
									
									Util.MapDebugPrint( "^5Axis entered into trigger Axis_In_Phase_2, Gunmaterial_Secured, AmmoNotSecured, AmmoNotTaken" );
								}
							}
							else
							{
								if ( Map.gunmTaken > 0 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, {
										"DEFEND_Allies_Gun_01",
										"DEFEND_Allies_Gun_02",
										"AMMOCAB_north_ammocabinet_1",
										"AMMOCAB_north_ammocabinet_2",
										"HEALTHCAB_north_healthcabinet_2",
										"HEALTHCAB_north_healthcabinet_4",
										".*_Forward_Spawn",
										".*_Courtryard",
										"DEFEND_Allies_CourtyYard_.*",
										"MOBILEMG42_Allies_CourtyYard_.*",
									});
									
									if ( Map.WarehouseBlastDoorDestroyed )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_GunMaterial_.*" );
										
										SetAvailableMapGoals( TEAM.ALLIES, false, {
											"DEFEND_Allies_CourtyYard_05",
											"DEFEND_Allies_CourtyYard_06",
											"DEFEND_Allies_CourtyYard_07",
											"DEFEND_Allies_CourtyYard_08",
											"DEFEND_Allies_CourtyYard_09",
										});
										
										Util.MapDebugPrint( "^5Axis entered into trigger Axis_In_Phase_2, GunmaterialNotSecured, gunmTaken, WarehouseBlastDoorDestroyed" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_GunMaterial_01" );
										
										SetAvailableMapGoals( TEAM.ALLIES, false, {
											"DEFEND_Allies_CourtyYard_05",
											"DEFEND_Allies_CourtyYard_06",
										});
										
										Util.MapDebugPrint( "^5Axis entered into trigger Axis_In_Phase_2, GunmaterialNotSecured, gunmTaken, WarehouseBlastDoorNotDestroyed" );
									}
								}
								else
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, {
										"AMMOCAB_north_ammocabinet_1",
										"AMMOCAB_north_ammocabinet_2",
										"HEALTHCAB_north_healthcabinet_2",
										"HEALTHCAB_north_healthcabinet_4",
										".*_Forward_Spawn",
										".*_Courtryard",
										"DEFEND_Allies_CourtyYard_.*",
										"MOBILEMG42_Allies_CourtyYard_.*",
									});
									
									if ( Map.WarehouseBlastDoorDestroyed )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_GunMaterial_.*" );
										
										SetAvailableMapGoals( TEAM.ALLIES, false, {
											"DEFEND_Allies_CourtyYard_07",
											"DEFEND_Allies_CourtyYard_08",
											"DEFEND_Allies_CourtyYard_09",
										});
										
										Util.MapDebugPrint( "^5Axis entered into trigger Axis_In_Phase_2, GunmaterialNotSecured, gunmNotTaken, WarehouseBlastDoorDestroyed" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_GunMaterial_01" );
										
										Util.MapDebugPrint( "^5Axis entered into trigger Axis_In_Phase_2, GunmaterialNotSecured, gunmNotTaken, WarehouseBlastDoorNotDestroyed" );
									}
								}
							}
						}
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( Map.Phase_2 )
			{
				if( GetEntTeam(ent) == TEAM.AXIS )
				{
					Map.Axis_InPhase2 -= 1;
					
					if ( Map.Axis_InPhase2 == 0 )
					{
						if ( Map.FlagAlliesCaptured )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );
							
							SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_.*" );
							
							if ( Map.warehouse_blast_door_Dyno > 0 and !Map.WarehouseBlastDoorDestroyed )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "DEFUSE_warehouse_blast_door_.*" );
							}
							
							if ( !Map.GunBarricadeDestroyed and Map.Barricade_Dyno > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "DEFUSE_Barricade_.*" );
							}
							
							if ( Map.GunBarricadeDestroyed )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Barricade" );
							}
							
							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"AMMOCAB_north_ammocabinet_1",
								"AMMOCAB_north_ammocabinet_2",
								"HEALTHCAB_north_healthcabinet_2",
								"HEALTHCAB_north_healthcabinet_4",
								".*_Forward_Spawn",
								".*_Courtryard",
								"DEFEND_Allies_CourtyYard_.*",
								"MOBILEMG42_Allies_CourtyYard_.*",
							});
							
							Util.MapDebugPrint( "^5Axis left trigger Axis_In_Phase_2" );
						}
					}
				}
			}
		},
	},
	
	Hatch_To_Flag_Exploded = function( trigger )
	{
		Map.HatchToFlagExploded = true;
		
		Util.MapDebugPrint( "^3Hatch_To_Flag_Exploded" );
	},

	Gun_Barricade_Built = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.GunBarricadeDestroyed = false;
			
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Barricade" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Barricade" );
			
			Util.MapDebugPrint( "^3Gun_Barricade_Built" );
		}
	},
	
	Gun_Barricade_Planted = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.Barricade_Dyno += 1;
			
			Util.MapDebugPrint( "^3Gun_Barricade_Planted" );
		}
	},
	
	Gun_Barricade_Defused = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.Barricade_Dyno -= 1;
			
			Util.MapDebugPrint( "^3Gun_Barricade_Defused" );
		}
	},
	
	Gun_Barricade_Destroyed = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.GunBarricadeDestroyed = true;
			
			if ( Map.Barricade_Dyno > 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Barricade_.*" );
			}
			
			Map.Barricade_Dyno = 0;
			
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Barricade" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Barricade" );
			
			Util.MapDebugPrint( "^3Gun_Barricade_Destroyed" );
		}
	},
	
	flag1_Allies_Captured = function( trigger )
	{
		Map.FlagAxisCaptured = false;
		Map.FlagAlliesCaptured = true;
		
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"CHECKPOINT_flag1",
			"ATTACK_Flag_.*",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, false, "SMOKEBOMB_Axis_CourtyYardFlag_10" );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_Allies_CourtyYard_02",
			"DEFEND_Allies_CourtyYard_03",
			"DEFEND_Allies_CourtyYard_04",
			".*_Forward_Spawn",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"SMOKEBOMB_Axis_CourtyYard_.*",
			"CHECKPOINT_flag1",
			"ATTACK_Flag_.*",
		});
		
		Util.MapDebugPrint( "^3flag1_Allies_Captured" );
	},
	
	flag1_Axis_Captured = function( trigger )
	{
		Map.FlagAlliesCaptured = false;
		Map.FlagAxisCaptured = true;
		
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Allies_CourtyYard_02",
			"DEFEND_Allies_CourtyYard_03",
			"DEFEND_Allies_CourtyYard_04",
			".*_Forward_Spawn",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CHECKPOINT_flag1",
			"ATTACK_Flag_.*",
			"SMOKEBOMB_Axis_CourtyYard_.*",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, true, "SMOKEBOMB_Axis_CourtyYardFlag_10" );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"CHECKPOINT_flag1",
			"ATTACK_Flag_.*",
		});
		
		Util.MapDebugPrint( "^3flag1_Axis_Captured" );
	},
	
	warehouse_blast_door_Planted = function( trigger )
	{
		Map.warehouse_blast_door_Dyno += 1;
		
		Util.MapDebugPrint( "^3warehouse_blast_door_Planted" );
	},
	
	warehouse_blast_door_Defused = function( trigger )
	{
		Map.warehouse_blast_door_Dyno -= 1;
		
		Util.MapDebugPrint( "^3warehouse_blast_door_Defused" );
	},
	
	warehouse_blast_door_Destroyed = function( trigger )
	{
		if ( Map.warehouse_blast_door_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_warehouse_blast_door_.*" );
		}
		
		Map.WarehouseBlastDoorDestroyed = true;
		Map.warehouse_blast_door_Dyno = 0;
		
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Allies_CourtyYard_07",
			"DEFEND_Allies_CourtyYard_08",
			"DEFEND_Allies_CourtyYard_09",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, true, "ROUTE_Warehouse" );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_GunMaterial_.*" );
		
		Util.MapDebugPrint( "^3warehouse_blast_door_Destroyed" );
	},
	
	gunm_Taken = function( trigger )
	{
		Map.gunmTaken += 1;
		
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Allies_CourtyYard_05",
			"DEFEND_Allies_CourtyYard_06",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_GunMat" );
		
		if ( Map.gunmTaken < 3 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_Allies_Gun_01",
				"DEFEND_Allies_Gun_02",
			});
			
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"ATTACK_Axis_Gun_01",
				"ATTACK_Axis_Gun_04",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Allies_GunMaterial_.*" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_Gun_.*" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Axis_Gun_.*" );
		}
		
		Util.MapDebugPrint( "^3gunm_Taken" );
	},
	
	gunm_Returned = function( trigger )
	{
		Map.gunmTaken -= 1;
		
		if ( Map.WarehouseBlastDoorDestroyed )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_GunMaterial_.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_GunMaterial_01" );
		}
		
		if ( Map.gunmTaken == 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Allies_Gun_.*" );
			
			SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Axis_Gun_.*" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_Allies_CourtyYard_05",
				"DEFEND_Allies_CourtyYard_06",
			});
		}
		
		Util.MapDebugPrint( "^3gunm_Returned" );
	},
	
	gunm_Secured = function( trigger )
	{
		Map.gunm += 1;
		
		if ( Map.gunm == 3 )
		{
			Map.Gunmaterial_Secured = true;
			
			SetAvailableMapGoals( TEAM.ALLIES, false, "MOBILEMG42_Allies_CourtyYard_01" );
			
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"FLAG_gunm",
				"CAPPOINT_GunMat",
			});
			
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_gun" );
			
			sleep(2);
			
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"MOBILEMG42_Allies_Gun_05",
				"DEFEND_Allies_Ammo_.*",
			});
			
			SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_ammo" );
		}
		
		Util.MapDebugPrint( "^3gunm_Secured" );
	},
	
	gun_Built = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.gun = 1;
			
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_gun" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_gun" );
			
			if ( Map.AmmoTaken )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_Gun" );
			}
			
			if ( Map.gun_ready == 1 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Gun" );
			}
			
			Util.MapDebugPrint( "^3gun_Built" );
		}
	},
	
	gun_Planted = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.gun_Dyno += 1;
			
			Util.MapDebugPrint( "^3gun_Planted" );
		}
	},
	
	gun_Defused = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.gun_Dyno -= 1;
			
			Util.MapDebugPrint( "^3gun_Defused" );
		}
	},
	
	gun_Destroyed = function( trigger )
	{
		if ( Map.Phase_2 )
		{
			Map.gun_Dyno = 0;
			Map.gun = 0;
			
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_gun" );
			
			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Gun" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_gun" );
			
			if ( Map.AmmoTaken )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_Gun" );
			}
			
			Util.MapDebugPrint( "^3gun_Destroyed" );
		}
	},
	
	ammo_Taken = function( trigger )
	{
		Map.AmmoTaken = true;
		
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Allies_Ammo_.*" );
		
		if ( Map.gun == 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_Gun" );
		}
		
		Util.MapDebugPrint( "^3ammo_Taken" );
	},
	
	ammo_Returned = function( trigger )
	{
		Map.AmmoTaken = false;
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_Ammo_.*" );
		
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_Gun" );
		
		Util.MapDebugPrint( "^3ammo_Returned" );
	},
	
	ammo_Secured = function( trigger )
	{
		Map.AmmoSecured = true;
		Map.AmmoTaken = false;
		
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_Gun" );
		
		Util.MapDebugPrint( "^3ammo_Secured" );
	},
	
	Gun_Ready = function( trigger )
	{
		Map.gun_ready = 1;
		
		if ( Map.gun == 1 )	//built
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Gun" );
		}
		
		Util.MapDebugPrint( "^3Gun_Ready" );
	},
	
	Trainyard_Tunnel_Destroyed = function( trigger )
	{
		DeleteTriggerRegion( "KT_NQMod_Tunnel" );
		
		Map.TrainyardTunnel_Destroyed = true;
		
		Map.Phase_2 = false;
		Map.Phase_3 = true;
		
		sleep(1);
		
		ETUtil.SuicideSpawn( TEAM.ALLIES, 3, -1, 0 );	//Train depot spawn
		
		sleep(2);
		
		Util.DisableGoal( ".*", true );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"GRENADE_Barrels",
			"GRENADE_Elevator_Cover",
			".*_t382_1",
			".*_t382_3",
			"BUILD_Side_Gate",
			"BUILD_Barricade_1",
			".*_Allies_BlastDoor_.*",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"PLANT_blast_door",
			"GRENADE_Fence",
			".*_Axis_BlastDoor_.*",
		});
		
		Util.MapDebugPrint( "^3Trainyard_Tunnel_Destroyed" );
	},
	
	Trainyard_Barricade_Built = function( trigger )
	{
		if ( Map.Phase_3 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Barricade_1" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Barricade_1" );
			
			Util.MapDebugPrint( "^3Trainyard_Barricade_Built" );
		}
	},
	
	Trainyard_Barricade_Planted = function( trigger )
	{
		if ( Map.Phase_3 )
		{
			Map.Barricade_1_Dyno += 1;
			
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Barricade_1_.*" );
			
			Util.MapDebugPrint( "^3Trainyard_Barricade_Planted" );
		}
	},
	
	Trainyard_Barricade_Defused = function( trigger )
	{
		if ( Map.Phase_3 )
		{
			Map.Barricade_1_Dyno -= 1;
			
			Util.MapDebugPrint( "^3Trainyard_Barricade_Defused" );
		}
	},
	
	Trainyard_Barricade_Destroyed = function( trigger )
	{
		if ( Map.Phase_3 )
		{
			Map.Barricade_1_Dyno = 0;
			
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Barricade_1" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Barricade_1" );
			
			Util.MapDebugPrint( "^3Trainyard_Barricade_Destroyed" );
		}
	},
	
	Side_Gate_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Side_Gate" );
		
		if ( Map.Phase_3 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Side_Gate" );
		}
		
		Util.MapDebugPrint( "^3Side_Gate_Built" );
	},
	
	Side_Gate_Planted = function( trigger )
	{
		Map.Side_Gate_Dyno += 1;
		
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Side_Gate_.*" );
		
		Util.MapDebugPrint( "^3Side_Gate_Planted" );
	},
	
	Side_Gate_Defused = function( trigger )
	{
		Map.Side_Gate_Dyno -= 1;
		
		Util.MapDebugPrint( "^3Side_Gate_Defused" );
	},

	Side_Gate_Destroyed = function( trigger )
	{
		Map.Side_Gate_Dyno = 0;
		
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Side_Gate" );
		
		if ( Map.Phase_3 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Side_Gate" );
		}
		
		Util.MapDebugPrint( "^3Side_Gate_Destroyed" );
	},
	
	Fence_Exploded = function( trigger )
	{
		if ( Map.Phase_3 )
		{
			Util.MapDebugPrint( "^3Fence_Exploded" );
		}
	},
	
	blast_door_Planted = function( trigger )
	{
		Map.blast_door_Dyno += 1;
		
		Util.MapDebugPrint( "^3blast_door_Planted" );
	},
	
	blast_door_Defused = function( trigger )
	{
		Map.blast_door_Dyno -= 1;
		
		Util.MapDebugPrint( "^3blast_door_Defused" );
	},
	
	blast_door_Destroyed = function( trigger )
	{
		DeleteTriggerRegion( "KT_NQMod_BlastDoor" );
		
		Map.blast_door_Dyno = 0;
		Map.blastdoor_Destroyed = true;
		
		Map.Phase_3 = false;
		Map.Phase_4 = true;
		
		sleep(1);
		
		foreach ( id and bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.ALLIES )
			{
				if ( bot.GetReinforceTime() < 10 )
				{
					ETUtil.SuicideSpawn( TEAM.ALLIES, 6, -1, 0 );	//Allied basement spawn
				}
			}
		}
		
		sleep(2);
		
		Util.DisableGoal( ".*", true );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_Allies_InsideNet_01",
			".*_Allies_Generator_.*",
			"BUILD_Generator_Protection_Net",
			"BUILD_Command_Post",
			".*_t382_2",
			"HEALTHCAB_north_healthcabinet",
			"AMMOCAB_north_ammocabinet",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ATTACK_Axis_Generator_.*",
			"PLANT_Generator",
			"BUILD_Command_Post",
			"HEALTHCAB_north_healthcabinet",
			"AMMOCAB_north_ammocabinet",
		});
		
		Util.MapDebugPrint( "^3blast_door_Destroyed" );
	},
	
	Allied_CP_Built = function( trigger )
	{
		if ( Map.Phase_4 or Map.Phase_5 or Map.Phase_6 )
		{
			Map.AlliedCP = true;
			
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );
			
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Command_Post" );
			
			Util.MapDebugPrint( "^3Allied_CP_Built" );
		}
	},
	
	Axis_CP_Built = function( trigger )
	{
		if ( Map.Phase_4 or Map.Phase_5 or Map.Phase_6 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );
			
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Command_Post" );
			
			Util.MapDebugPrint( "^3Axis_CP_Built" );
		}
	},
	
	Command_Post_Planted = function( trigger )
	{
		Map.Command_Post_Dyno += 1;
		
		if ( Map.Phase_4 or Map.Phase_5 or Map.Phase_6 )
		{
			if ( Map.AlliedCP )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Command_Post_.*" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Command_Post_.*" );
			}
			
			Util.MapDebugPrint( "^3Command_Post_Planted" );
		}
	},
	
	Command_Post_Defused = function( trigger )
	{
		if ( Map.Phase_4 or Map.Phase_5 or Map.Phase_6 )
		{
			Map.Command_Post_Dyno -= 1;
			
			Util.MapDebugPrint( "^3Command_Post_Defused" );
		}
	},
	
	Allied_CP_Destroyed = function( trigger )
	{
		if ( Map.Phase_4 or Map.Phase_5 or Map.Phase_6 )
		{
			Map.AlliedCP = false;
			
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Command_Post" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
			
			Util.MapDebugPrint( "^3Allied_CP_Destroyed" );
		}
	},
	
	Axis_CP_Destroyed = function( trigger )
	{
		if ( Map.Phase_4 or Map.Phase_5 or Map.Phase_6 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
			
			Util.MapDebugPrint( "^3Axis_CP_Destroyed" );
		}
	},
	
	Generator_Protection_Net_Built = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			Map.GeneratorProtectionNetBuilt = true;
			
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"BUILD_Generator_Protection_Net",
				"DEFEND_Allies_InsideNet_01",
			});
			
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Generator" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Generator_Protection_Net" );
			
			Util.MapDebugPrint( "^3Generator_Protection_Net_Built" );
			
			while ( Map.Generator_Dyno > 0 )
			{
				yield();
			}
			
			Map.KT_InsideNet = OnTriggerRegion(AABB(-2112.596,6214.298,-310.875,-1683.455,6600.875,-110.689), RegionTrigger.KillTrigger );
			
			Util.MapDebugPrint( "^3KillTrigger created" );
			
			sleep(1);
			
			DeleteTriggerRegion( Map.KT_InsideNet );
			
			Util.MapDebugPrint( "^3KillTrigger deleted" );
		}
	},
	
	Generator_Protection_Net_Planted = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			Map.Generator_Protection_Net_Dyno += 1;
			
			Util.MapDebugPrint( "^3Generator_Protection_Net_Planted" );
		}
	},
	
	Generator_Protection_Net_Defused = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			Map.Generator_Protection_Net_Dyno -= 1;
			
			Util.MapDebugPrint( "^3Generator_Protection_Net_Defused" );
		}
	},
	
	Generator_Protection_Net_Destroyed = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			Map.Generator_Protection_Net_Dyno = 0;
			
			Map.GeneratorProtectionNetBuilt = false;
			
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Generator_Protection_Net" );
			
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Allies_Generator_.*" );
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_InsideNet_01" );
			
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Generator" );
			
			if ( Map.Generator_Dyno == 0 )
			{
				if ( Map.Axis_Inside_GeneratorProtectionNet == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Generator_Protection_Net" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Generator_Protection_Net" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Generator_Protection_Net" );
			}
			
			yield();
			
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_Generator_.*" );
			
			Util.MapDebugPrint( "^3Generator_Protection_Net_Destroyed" );
		}
	},
	
	Axis_InsideGeneratorProtectionNet =
	{
		Name = "Axis_InsideGeneratorProtectionNet",
		TriggerOnClass = CLASS.ANYPLAYER,
		
		OnEnter = function(ent)
		{
			if ( Map.Phase_4 )
			{
				if( GetEntTeam(ent) == TEAM.AXIS )
				{
					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.Axis_Inside_GeneratorProtectionNet += 1;
						
						Util.BotChat( TEAM.ALLIES, "sayteam", "^1Axis engs are near generator! Defend generator!", 2 );
						
						if ( !Map.GeneratorProtectionNetBuilt )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Generator_Protection_Net" );
						}
						
						Util.MapDebugPrint( "^3Axis engs are inside protection net" );
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( Map.Phase_4 )
			{
				if( GetEntTeam(ent) == TEAM.AXIS )
				{
					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.Axis_Inside_GeneratorProtectionNet -= 1;
					}
					
					if ( Map.Axis_Inside_GeneratorProtectionNet == 0 )
					{
						Util.BotChat( TEAM.ALLIES, "sayteam", "^5Generator is safe.", 2 );
						
						if ( !Map.GeneratorProtectionNetBuilt and Map.Generator_Dyno == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Generator_Protection_Net" );
						}
						
						Util.MapDebugPrint( "^3Generator is safe" );
					}
				}
			}
		},
	},
	
	Lever_used = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			Util.MapDebugPrint( "^3Lever_used" );
			
			Map.Switches.outside_switch.Enabled = false;
			Map.Switches.inside_switch.Enabled = false;
			
			vel1 = ToVector(trigger.Action);
			
			if ( vel1[ 2 ] == -16 )
			{
				Map.Door_closing = false;
				Map.Door_opening = true;
				
				Util.MapDebugPrint( "^3Door_opening" );
			}
			else if ( vel1[ 2 ] == 16 )
			{
				Map.Door_opening = false;
				Map.Door_closing = true;
				
				Map.Door_opened = false;
				
				SetAvailableMapGoals( TEAM.ALLIES, false, {
					"SWITCH_Inside",
					"SWITCH_Outside",
				});
				
				Util.MapDebugPrint( "^3Door_closing" );
			}
		}
	},
	
	Door_open = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			vel = ToVector(trigger.Action);
			
			if ( vel[ 0 ] == 15 )
			{
				sleep(2.5);
				
				if ( Map.Door_opening )
				{
					Map.Door_opened = true;
				}
				else
				{
					Map.Door_opened = false;
				}
				
				sleep(2);
				
				if ( Map.Door_opening )
				{
					if ( !Map.GeneratorDestroyed )
					{
						SetAvailableMapGoals( TEAM.ALLIES, true, {
							"SWITCH_Inside",
							"SWITCH_Outside",
						});
					}
					
					Util.MapDebugPrint( "^3Door_opened" );
				}
			}
			else if ( vel[ 0 ] == -15 )
			{
				sleep(3);
				
				if ( Map.Door_closing )
				{
					Map.Switches.outside_switch.Enabled = true;
					Map.Switches.inside_switch.Enabled = true;
					
					Util.MapDebugPrint( "^3Door_closed" );
				}
			}
		}
	},
	
	Hatch_Exploded = function( trigger )
	{
		Map.HatchExploded = true;
		
		Util.MapDebugPrint( "^3hatchover_generator exploded" );
	},
	
	Generator_Planted = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			Map.Generator_Dyno += 1;
			
			if ( !Map.GeneratorProtectionNetBuilt )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Generator_Protection_Net" );
			}
			
			Util.MapDebugPrint( "^3Generator_Planted" );
		}
	},
	
	Generator_Defused = function( trigger )
	{
		if ( Map.Phase_4 )
		{
			Map.Generator_Dyno -= 1;
			
			if ( Map.Generator_Dyno == 0 and !Map.GeneratorProtectionNetBuilt and Map.Axis_Inside_GeneratorProtectionNet == 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Generator_Protection_Net" );
			}
			
			Util.MapDebugPrint( "^3Generator_Defused" );
		}
	},
	
	Generator_Destroyed = function( trigger )
	{
		DeleteTriggerRegion( "KT_NQMod_basement" );
		
		Map.GeneratorDestroyed = true;
		Map.Generator_Dyno = 0;
		
		Map.Phase_4 = false;
		Map.Phase_5 = true;
		
		Util.SetMaxUsers( 1, "PLANT_Command_Post" );
		Util.SetMaxUsers( 1, "BUILD_Command_Post" );
		
		sleep(7);
		
		Util.DisableGoal( ".*", true );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"HEALTHCAB_north_healthcabinet_1",
			".*_Allies_KeyCard_.*",
			"BUILD_Command_Post",
			"PLANT_Command_Post",
		});
		
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"PLANT_basement_gate_1",
			"HEALTHCAB_north_healthcabinet_1",
			".*_Axis_KeyCard_.*",
			"BUILD_Command_Post",
			"PLANT_Command_Post",
		});
		
		Util.MapDebugPrint( "^3Generator_Destroyed" );
	},
	
	basement_gate_1_Planted = function( trigger )
	{
		if ( Map.Phase_5 )
		{
			Map.basement_gate_1_Dyno += 1;
			
			Util.MapDebugPrint( "^3basement_gate_1_Planted" );
		}
	},
	
	basement_gate_1_Defused = function( trigger )
	{
		if ( Map.Phase_5 )
		{
			Map.basement_gate_1_Dyno -= 1;
			
			Util.MapDebugPrint( "^3basement_gate_1_Defused" );
		}
	},
	
	basement_gate_1_Destroyed = function( trigger )
	{
		if ( Map.basement_gate_1_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_basement_gate_1_.*" );
		}
		
		Map.basement_gate_1_Dyno = 0;
		
		Map.Phase_5 = false;
		Map.Phase_6 = true;
		
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_gold2" );
		
		Util.MapDebugPrint( "^3basement_gate_1_Destroyed" );
	},
	
	KeyCard_Taken = function( trigger )
	{
		Map.KeyCardTaken = true;
		
		SetAvailableMapGoals( TEAM.AXIS, false, "FLAG_gold2" );
		
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_Armory" );
		
		Util.MapDebugPrint( "^3KeyCard_Taken" );
		
		sleep(2);
		
		if ( Map.KeyCardTaken )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Allies_KeyCard_.*" );
		}
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Armory_.*" );
	},
	
	KeyCard_Returned = function( trigger )
	{
		Map.KeyCardTaken = false;
		
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allies_Armory_.*" );
		
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_Armory" );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_KeyCard_.*" );
		
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_gold2" );
		
		Util.MapDebugPrint( "^3KeyCard_Returned" );
	},
	
	KeyCard_Secured = function( trigger )
	{
		Map.Phase_6 = false;
		
		sleep(2);
		
		Util.DisableGoal( ".*", true );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, ".*_Allies_Rocket_.*" );
		
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"FLAG_gold",
			".*_Axis_Rocket_.*",
		});
		
		Util.MapDebugPrint( "^3KeyCard_Secured" );
	},
	
	gold_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_Detonator" );
		
		Util.MapDebugPrint( "^3gold_Taken" );
	},
	
	gold_Returned = function( trigger )
	{
		Util.MapDebugPrint( "^3gold_Returned" );
	},
	
	gold_Secured = function( trigger )
	{
		Map.Explosive += 1;
		
		if ( Map.Explosive == 5 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"FLAG_gold",
				"CAPPOINT_Detonator",
			});
			
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Detonator" );
		}
		
		Util.MapDebugPrint( "^3gold_Secured" );
	},
	
	Bomb_Ready = function( trigger )
	{
		Util.MapDebugPrint( "^3Bomb_Ready" );
	},
	
	Countdown_Activated = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Allies_Rocket_.*" );
		
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Detonator" );
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_Detonator" );
		
		yield();
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allies_Rocket_.*" );
		
		Util.MapDebugPrint( "^3Countdown_Activated" );
	},
	
	Countdown_Interrupted = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_Detonator" );
		
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Axis_Rocket_.*" );
		
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Detonator" );
		
		yield();
		
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Axis_Rocket_.*" );
		
		Util.MapDebugPrint( "^3Countdown_Interrupted" );
	},
	
	Rocket_Destroyed = function( trigger )
	{
		Map.RocketDestroyed = true;
		
		Util.MapDebugPrint( "^5Axis_Win" );
		
		sleep(1);
		
		ETUtil.WinningChat( TEAM.AXIS );
		sleep(1.5);
		ETUtil.LosingChat( TEAM.ALLIES );
		
		Util.MapDebugPrint( "^3Rocket_Destroyed" );
	},
	
	Thirty_second = function( trigger )
	{
		Util.MapDebugPrint( "^5Thirty_second" );
		
		sleep(30);
		
		if ( !Map.RocketDestroyed )
		{
			Util.MapDebugPrint( "^5Allies_Win" );
			
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );
		}
	},
	
	KT_NQMod_FirstSpawn =
	{
		Name = "KT_NQMod_FirstSpawn",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			sleep(1);
			
			b = Util.IsBot(ent);
			if( !Map.GeneratorDestroyed )
			{
				b.ExecCommand( "kill" );
				Util.MapDebugPrint( "^5Killing in First spawn" );
				
				if( !Map.blastdoor_Destroyed )
				{
					if( !Map.TrainyardTunnel_Destroyed )
					{
						if ( b.GetTeam() == TEAM.AXIS )
						{
							if ( Map.FlagAxisCaptured )
							{
								b.ChangeSpawnPoint(0);
							}
							else
							{
								b.ChangeSpawnPoint(2);
							}
						}
					}
					else
					{
						if ( b.GetTeam() == TEAM.AXIS )
						{
							b.ChangeSpawnPoint(1);
						}
					}
				}
				else
				{
					if ( b.GetTeam() == TEAM.AXIS )
					{
						b.ChangeSpawnPoint(3);
					}
				}
			}
			else
			{
				if ( b.GetTeam() == TEAM.AXIS )
				{
					b.ChangeSpawnPoint(6);
				}
			}
			
			Util.MapDebugPrint( "^5Killing in KT_NQMod_FirstSpawn" );
		},
		OnExit = function(ent)
		{
			
		},
	},
	
	KT_NQMod_Tunnel =
	{
		Name = "KT_NQMod_Tunnel",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if( Map.TrainyardTunnel_Destroyed )
			{
				DeleteTriggerRegion( "KT_NQMod_Tunnel" );
			}
			else
			{
				sleep(1);
				
				b = Util.IsBot(ent);
				if( !Map.GeneratorDestroyed )
				{
					b.ExecCommand( "kill" );
					Util.MapDebugPrint( "^5Killing behind Trainyard tunnel" );
					
					if( !Map.blastdoor_Destroyed )
					{
						if( !Map.TrainyardTunnel_Destroyed )
						{
							if ( b.GetTeam() == TEAM.ALLIES )
							{
								b.ChangeSpawnPoint(1);
								yield();
								b.ChangeSpawnPoint(0);
							}
							else
							{
								if ( Map.FlagAxisCaptured )
								{
									b.ChangeSpawnPoint(0);
								}
								else
								{
									b.ChangeSpawnPoint(2);
								}
							}
						}
						else
						{
							if ( b.GetTeam() == TEAM.ALLIES )
							{
								b.ChangeSpawnPoint(3);
							}
							else
							{
								b.ChangeSpawnPoint(1);
							}
						}
					}
					else
					{
						if ( b.GetTeam() == TEAM.ALLIES )
						{
							b.ChangeSpawnPoint(6);
						}
						else
						{
							b.ChangeSpawnPoint(3);
						}
					}
				}
				else
				{
					if ( b.GetTeam() == TEAM.ALLIES )
					{
						b.ChangeSpawnPoint(7);
					}
					else
					{
						b.ChangeSpawnPoint(6);
					}
				}
			}
			
			Util.MapDebugPrint( "^5Killing in KT_NQMod_Tunnel" );
		},
		OnExit = function(ent)
		{
			
		},
	},
	
	KT_NQMod_BlastDoor =
	{
		Name = "KT_NQMod_BlastDoor",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if( Map.blastdoor_Destroyed )
			{
				DeleteTriggerRegion( "KT_NQMod_BlastDoor" );
			}
			else
			{
				sleep(1);
				
				b = Util.IsBot(ent);
				if( !Map.GeneratorDestroyed )
				{
					b.ExecCommand( "kill" );
					Util.MapDebugPrint( "^5Killing behind blast door" );
					
					if( !Map.blastdoor_Destroyed )
					{
						if( !Map.TrainyardTunnel_Destroyed )
						{
							if ( b.GetTeam() == TEAM.ALLIES )
							{
								b.ChangeSpawnPoint(1);
								yield();
								b.ChangeSpawnPoint(0);
							}
							else
							{
								if ( Map.FlagAxisCaptured )
								{
									b.ChangeSpawnPoint(0);
								}
								else
								{
									b.ChangeSpawnPoint(2);
								}
							}
						}
						else
						{
							if ( b.GetTeam() == TEAM.ALLIES )
							{
								b.ChangeSpawnPoint(3);
							}
							else
							{
								b.ChangeSpawnPoint(1);
							}
						}
					}
					else
					{
						if ( b.GetTeam() == TEAM.ALLIES )
						{
							b.ChangeSpawnPoint(6);
						}
						else
						{
							b.ChangeSpawnPoint(3);
						}
					}
				}
				else
				{
					if ( b.GetTeam() == TEAM.ALLIES )
					{
						b.ChangeSpawnPoint(7);
					}
					else
					{
						b.ChangeSpawnPoint(6);
					}
				}
			}
			
			Util.MapDebugPrint( "^5Killing in KT_NQMod_BlastDoor" );
		},
		OnExit = function(ent)
		{
			
		},
	},
	
	KT_NQMod_basement =
	{
		Name = "KT_NQMod_basement",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if( Map.GeneratorDestroyed )
			{
				DeleteTriggerRegion( "KT_NQMod_basement" );
			}
			else
			{
				sleep(1);
				
				b = Util.IsBot(ent);
				if( !Map.GeneratorDestroyed )
				{
					b.ExecCommand( "kill" );
					Util.MapDebugPrint( "^5Killing behind generator door" );
					
					if( !Map.blastdoor_Destroyed )
					{
						if( !Map.TrainyardTunnel_Destroyed )
						{
							if ( b.GetTeam() == TEAM.ALLIES )
							{
								b.ChangeSpawnPoint(1);
								yield();
								b.ChangeSpawnPoint(0);
							}
							else
							{
								if ( Map.FlagAxisCaptured )
								{
									b.ChangeSpawnPoint(0);
								}
								else
								{
									b.ChangeSpawnPoint(2);
								}
							}
						}
						else
						{
							if ( b.GetTeam() == TEAM.ALLIES )
							{
								b.ChangeSpawnPoint(3);
							}
							else
							{
								b.ChangeSpawnPoint(1);
							}
						}
					}
					else
					{
						if ( b.GetTeam() == TEAM.ALLIES )
						{
							b.ChangeSpawnPoint(6);
						}
						else
						{
							b.ChangeSpawnPoint(3);
						}
					}
				}
				else
				{
					if ( b.GetTeam() == TEAM.ALLIES )
					{
						b.ChangeSpawnPoint(7);
					}
					else
					{
						b.ChangeSpawnPoint(6);
					}
				}
			}
			
			Util.MapDebugPrint( "^5Killing in KT_NQMod_basement" );
		},
		OnExit = function(ent)
		{
			
		},
	},
};

global OnMapLoad = function()
{
	OnTrigger( "GRENADE_Wooden_Barrier_1 Exploded.", Map.Wooden_Barrier_1_Exploded );
	OnTrigger( "GRENADE_Wooden_Barrier_2 Exploded.", Map.Wooden_Barrier_2_Exploded );
	
	OnTrigger( "Planted at the sewer exit gate.", Map.sewer_exit_gate_Planted );
	OnTrigger( "Planted at sewer exit gate.", Map.sewer_exit_gate_Planted );	//for N!tmod
	OnTrigger( "Defused at the sewer exit gate.", Map.sewer_exit_gate_Defused );
	OnTrigger( "Defused at sewer exit gate.", Map.sewer_exit_gate_Defused );	//for N!tmod
	OnTrigger( "^dAxis have breached the sewer gate!", Map.sewer_exit_gate_Destroyed );
	
	OnTrigger( "Planted at the basement gate.", Map.basement_gate_Planted );
	OnTrigger( "Planted at basement gate.", Map.basement_gate_Planted );	//for N!tmod
	OnTrigger( "Defused at the basement gate.", Map.basement_gate_Defused );
	OnTrigger( "Defused at basement gate.", Map.basement_gate_Defused );	//for N!tmod
	OnTrigger( "^dAxis have breached the basement gate!", Map.basement_gate_Destroyed );
	
	OnTrigger( "GRENADE_Hatch_To_Flag Exploded.", Map.Hatch_To_Flag_Exploded );
	
	OnTrigger( "Barricade constructed", Map.Gun_Barricade_Built );
	OnTrigger( "Planted at Barricade.", Map.Gun_Barricade_Planted );
	OnTrigger( "Defused at Barricade.", Map.Gun_Barricade_Defused );
	OnTrigger( "^1WARNING: ^3Barricade destroyed", Map.Gun_Barricade_Destroyed );
	
	OnTrigger( "^3Axis have captured the forward spawn", Map.flag1_Axis_Captured );
	OnTrigger( "^3Allies have reclaimed the forward spawn", Map.flag1_Allies_Captured );
	
	OnTrigger( "Planted at the warehouse blast door.", Map.warehouse_blast_door_Planted );
	OnTrigger( "Planted at warehouse blast door.", Map.warehouse_blast_door_Planted );	//for N!tmod
	OnTrigger( "Defused at the warehouse blast door.", Map.warehouse_blast_door_Defused );
	OnTrigger( "Defused at warehouse blast door.", Map.warehouse_blast_door_Defused );	//for N!tmod
	OnTrigger( "^dAxis have breached the warehouse blast door!", Map.warehouse_blast_door_Destroyed );
	
	OnTrigger( "Axis have stolen The Gun Materials!", Map.gunm_Taken );
	OnTrigger( "^4Allies have returned the gun materials !", Map.gunm_Returned );
	OnTrigger( "^1Axis have installed a set of gun materials !", Map.gunm_Secured );
	
	OnTrigger( "^dAxis team has built the Gun!", Map.gun_Built );
	OnTrigger( "Planted at gun.", Map.gun_Planted );
	OnTrigger( "Defused at gun.", Map.gun_Defused );
	OnTrigger( "^dAllied team has destroyed the Gun!", Map.gun_Destroyed );
	
	OnTrigger( "Axis have stolen The Gun Ammo!", Map.ammo_Taken );
	OnTrigger( "^4Allies have returned the ammo !", Map.ammo_Returned );
	OnTrigger( "^1Axis have loaded the gun !", Map.ammo_Secured );
	
	OnTrigger( "^dThe gun is ready to fire!", Map.Gun_Ready );
	
	OnTrigger( "^4The trainyard access tunnel has been breached", Map.Trainyard_Tunnel_Destroyed );
	
	OnTrigger( "Trainyard Barricade constructed", Map.Trainyard_Barricade_Built );
	OnTrigger( "Planted at Barricade.", Map.Trainyard_Barricade_Planted );
	OnTrigger( "Defused at Barricade.", Map.Trainyard_Barricade_Defused );
	OnTrigger( "^1WARNING: ^3Trainyard Barricade destroyed", Map.Trainyard_Barricade_Destroyed );
	
	OnTrigger( "GRENADE_Fence Exploded.", Map.Fence_Exploded );
	
	OnTrigger( "Trainyard Side Gate constructed", Map.Side_Gate_Built );
	OnTrigger( "Planted at Side Gate.", Map.Side_Gate_Planted );
	OnTrigger( "Defused at Side Gate.", Map.Side_Gate_Defused );
	OnTrigger( "^1WARNING: ^3Trainyard Side Gate destroyed", Map.Side_Gate_Destroyed );
	
	OnTrigger( "Planted at the blast door.", Map.blast_door_Planted );
	OnTrigger( "Planted at blast door.", Map.blast_door_Planted );	//for N!tmod
	OnTrigger( "Defused at the blast door.", Map.blast_door_Defused );
	OnTrigger( "Defused at blast door.", Map.blast_door_Defused );	//for N!tmod
	OnTrigger( "^dAxis have breached the trainyard depot blast door!", Map.blast_door_Destroyed );
	
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_CP_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_CP_Built );
	OnTrigger( "Planted at the Command Post.", Map.Command_Post_Planted );
	OnTrigger( "Planted at Command Post.", Map.Command_Post_Planted );	//for N!tmod
	OnTrigger( "Defused at the Command Post.", Map.Command_Post_Defused );
	OnTrigger( "Defused at Command Post.", Map.Command_Post_Defused );	//for N!tmod
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_CP_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_CP_Destroyed );
	
	OnTrigger( "Generator protection constructed", Map.Generator_Protection_Net_Built );
	OnTrigger( "Planted at Generator Protection Net.", Map.Generator_Protection_Net_Planted );
	OnTrigger( "Defused at Generator Protection Net.", Map.Generator_Protection_Net_Defused );
	OnTrigger( "^1WARNING: ^3Generator protection destroyed", Map.Generator_Protection_Net_Destroyed );
	
	OnTrigger( "portedouble_lever1_goto", Map.Lever_used );
	OnTrigger( "portedouble_droite_goto", Map.Door_open );
	
	OnTrigger( "GRENADE_HatchOverGenerator Exploded.", Map.Hatch_Exploded );
	
	OnTrigger( "Planted at the Generator.", Map.Generator_Planted );
	OnTrigger( "Planted at Generator.", Map.Generator_Planted );	//for N!tmod
	OnTrigger( "Defused at the Generator.", Map.Generator_Defused );
	OnTrigger( "Defused at Generator.", Map.Generator_Defused );	//for N!tmod
	OnTrigger( "Allies have destroyed the power generator!!!!", Map.Generator_Destroyed );
	
	OnTrigger( "Planted at the basement gate.", Map.basement_gate_1_Planted );
	OnTrigger( "Planted at basement gate.", Map.basement_gate_1_Planted );	//for N!tmod
	OnTrigger( "Defused at the basement gate.", Map.basement_gate_1_Defused );
	OnTrigger( "Defused at basement gate.", Map.basement_gate_1_Defused );	//for N!tmod
	OnTrigger( "Allies have destroyed the keycard room gate!!!!", Map.basement_gate_1_Destroyed );
	
	OnTrigger( "Axis have stolen the armory keycard!", Map.KeyCard_Taken );
	OnTrigger( "^6The keycard have been returned!!!!", Map.KeyCard_Returned );
	OnTrigger( "^6The armory has been opened!!!!", Map.KeyCard_Secured );
	
	OnTrigger( "Axis have stolen The explosive charge!", Map.gold_Taken );
	OnTrigger( "Flag returned gold!", Map.gold_Returned );
	OnTrigger( "Axis captured goldbar_holder", Map.gold_Secured );
	
	OnTrigger( "^6The bomb is ready to be armed!!!!", Map.Bomb_Ready );
	
	OnTrigger( "^6Countdown activated", Map.Countdown_Activated );
	OnTrigger( "^6Countdown interrupted", Map.Countdown_Interrupted );
	
	OnTrigger( "^6The rocket has been blown to pieces !!!", Map.Rocket_Destroyed );
	
	OnTrigger( "thirty second warning.", Map.Thirty_second );
	
	DCM1 = OnTriggerRegion(AABB(-4970.875,3626.056,-702.875,-4667.292,3738.317,-76.012), RegionTrigger.DisableCombatMovement);
	DCM2 = OnTriggerRegion(AABB(-5248.873,-1472.875,-590.875,-4871.125,-1279.125,286.508), RegionTrigger.DisableCombatMovement);
	DCM3 = OnTriggerRegion(AABB(-3345.883,483.544,385.125,-3213.369,647.250,504.639), RegionTrigger.DisableCombatMovement);
	DCM4 = OnTriggerRegion(AABB(-3176.710,1226.645,412.528,-2983.613,1369.710,587.125), RegionTrigger.DisableCombatMovement);
	DCM5 = OnTriggerRegion(AABB(-1214.934,1444.258,65.125,-1094.545,1822.689,355.125), RegionTrigger.DisableCombatMovement);
	DCM6 = OnTriggerRegion(AABB(-1812.839,1663.126,281.125,-1687.127,1876.412,523.125), RegionTrigger.DisableCombatMovement);
	DCM7 = OnTriggerRegion(AABB(-1928.872,1413.297,61.835,-1635.626,1748.877,400.339), RegionTrigger.DisableCombatMovement);
	DCM8 = OnTriggerRegion(AABB(1335.336,-618.909,257.125,1584.875,-327.350,395.125), RegionTrigger.DisableCombatMovement);
	DCM9 = OnTriggerRegion(AABB(-5450.875,3475.781,-702.875,-5143.493,3741.505,-116.872), RegionTrigger.DisableCombatMovement);
	DCM10 = OnTriggerRegion(AABB(-6136.875,-1400.874,-702.875,-5700.385,734.896,-584.803), RegionTrigger.DisableCombatMovement);
	DCM11 = OnTriggerRegion(AABB(294.771,610.241,1.125,432.962,837.270,201.669), RegionTrigger.DisableCombatMovement);
	DCM12A = OnTriggerRegion(AABB(-2074.825,6025.766,-246.875,-1507.487,6238.606,66.784), RegionTrigger.DisableCombatMovement);
	DCM113 = OnTriggerRegion(AABB(-1143.423,6116.362,-142.875,-1038.339,6208.868,-68.861), RegionTrigger.DisableCombatMovement);
	DCM114 = OnTriggerRegion(AABB(-982.319,6231.125,-190.865,-831.132,6343.794,-68.871), RegionTrigger.DisableCombatMovement);
	NP1 = OnTriggerRegion(AABB(-4970.875,3626.056,-702.875,-4667.292,3738.317,-76.012), RegionTrigger.DisableBotPush);
	NP2 = OnTriggerRegion(AABB(-5248.873,-1472.875,-590.875,-4871.125,-1279.125,286.508), RegionTrigger.DisableBotPush);
	NP3 = OnTriggerRegion(AABB(-3345.883,483.544,385.125,-3213.369,647.250,504.639), RegionTrigger.DisableBotPush);
	NP4 = OnTriggerRegion(AABB(-3176.710,1226.645,412.528,-2983.613,1369.710,587.125), RegionTrigger.DisableBotPush);
	NP5 = OnTriggerRegion(AABB(-1214.934,1444.258,65.125,-1094.545,1822.689,355.125), RegionTrigger.DisableBotPush);
	NP6 = OnTriggerRegion(AABB(-1812.839,1663.126,281.125,-1687.127,1876.412,523.125), RegionTrigger.DisableBotPush);
	NP7 = OnTriggerRegion(AABB(-1928.872,1413.297,61.835,-1635.626,1748.877,400.339), RegionTrigger.DisableBotPush);
	NP8 = OnTriggerRegion(AABB(1335.336,-618.909,257.125,1584.875,-327.350,395.125), RegionTrigger.DisableBotPush);
	NP9 = OnTriggerRegion(AABB(-5450.875,3475.781,-702.875,-5143.493,3741.505,-116.872), RegionTrigger.DisableBotPush);
	NP10 = OnTriggerRegion(AABB(-6136.875,-1400.874,-702.875,-5700.385,734.896,-584.803), RegionTrigger.DisableBotPush);
	NP11 = OnTriggerRegion(AABB(294.771,610.241,1.125,432.962,837.270,201.669), RegionTrigger.DisableBotPush);
	NP12 = OnTriggerRegion(AABB(-2461.896,1663.127,1.125,-2348.951,1776.376,168.760), RegionTrigger.DisableBotPush);
	NP12A = OnTriggerRegion(AABB(-2074.825,6025.766,-246.875,-1507.487,6238.606,66.784), RegionTrigger.DisableBotPush);
	NP13 = OnTriggerRegion(AABB(-1408.871,6648.639,-302.875,-1241.300,6968.815,51.919), RegionTrigger.DisableBotPush);	//boxes to generator tunnel
	DCM13 = OnTriggerRegion(AABB(-1408.871,6648.639,-302.875,-1241.300,6968.815,51.919), RegionTrigger.DisableCombatMovement);	//boxes to generator tunnel
	NP14 = OnTriggerRegion(AABB(2153.956,4002.589,169.125,2336.858,4192.875,370.869), RegionTrigger.DisableBotPush);	//boxes to blast door tunnel
	DCM14 = OnTriggerRegion(AABB(2153.956,4002.589,169.125,2336.858,4192.875,370.869), RegionTrigger.DisableCombatMovement);	//boxes to blast door tunnel
	
	KT_BasementShelf = OnTriggerRegion(AABB(-2625.311,6175.075,-254.238,-2585.592,6230.943,-163.206), RegionTrigger.KillTrigger);
	
	AmbTrigger = OnTriggerRegion(AABB(-4889.271,-1472.875,81.125,-3076.891,1456.871,504.884), Map.AmbusherTrigger );
	AxisInPhase2 = OnTriggerRegion(AABB(-2536.869,-1904.282,-174.875,1652.349,2624.875,432.704), Map.Axis_In_Phase_2 );
	AxisInsideGeneratorProtectionNet = OnTriggerRegion(AABB(-2112.596,6214.298,-310.875,-1683.455,6600.875,-110.689), Map.Axis_InsideGeneratorProtectionNet );
	
	OnTriggerRegion(AABB(2511.130,831.125,-94.867,4352.875,4576.869,549.637), Map.KT_NQMod_Tunnel);	//behid tunnel
	OnTriggerRegion(AABB(-2240.867,4551.028,-446.875,1038.522,6848.833,258.875), Map.KT_NQMod_BlastDoor);	//behind blast door
	OnTriggerRegion(AABB(-5009.233,5311.125,-302.875,-3047.125,7856.875,144.322), Map.KT_NQMod_basement);	//behind generator door
	
	Util.DisableGoal( ".*", true );
	
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"ROUTE_Under_Ladders",
		"ROUTE_WoodenBarrier_1",
		"ROUTE_WoodenBarrier_2",
		"ROUTE_WaterTunnel",
	});
	
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"GRENADE_Wooden_Barrier_.*",
		"HEALTHCAB_north_healthcabinet_3",
		"CAMP_Axis_Start_.*",
	});
	
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"REPAIRMG42_t382",
		"MOUNTMG42_t382",
		"PLANTMINE_Allies_Start_.*",
		".*_Allies_SewerExitGate_.*",
	});
	
	Util.LimitToClass("PLANT_Side_Gate", TEAM.AXIS, CLASS.ENGINEER);
	
	Util.AddUseWp( "PLANT_sewer_exit_gate", "WP_sewer_exit_gate" );
	Util.AddUseWp( "PLANT_basement_gate", "Plant_basementGate" );
	Util.AddUseWp( "PLANT_Barricade", "Barricade_Plant_WP_1" );
	Util.AddUseWp( "PLANT_Barricade", "Barricade_Plant_WP_2" );
	Util.AddUseWp( "PLANT_Side_Gate", "Side_Gate_Plant_WP_1" );
	Util.AddUseWp( "PLANT_Side_Gate", "Side_Gate_Plant_WP_2" );
	Util.AddUseWp( "PLANT_gun", "Gun_Plant_WP" );
	Util.AddUseWp( "BUILD_Generator_Protection_Net", "Generator_Protection_Net_Plant_WP" );
	Util.AddUseWp( "PLANT_Generator_Protection_Net", "Generator_Protection_Net_Plant_WP" );
	Util.AddUseWp( "PLANT_Generator_Protection_Net", "PlantProtection_1" );
	Util.AddUseWp( "PLANT_Generator_Protection_Net", "PlantProtection_2" );
	Util.AddUseWp( "PLANT_Generator", "Generator_Plant_WP" );
	
	SetGoalRole( "DEFEND_Allies_BasementGate_3", ROLE.AMBUSHER );
	
	SetGoalPriority( "GRENADE_.*", 0.99, 0, 0 );
	SetGoalPriority( "GRENADE_.*", 0.75, 0, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Command_Post", 0.52, 0, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Command_Post", 0.53, 0, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK_Flag_.*", 0.52, 0, 0 );
	
	SetGoalPriority( "ATTACK_Axis_SewerExitGate_01", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_SewerExitGate_03", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_SewerExitGate_04", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_BasementGate_1", 0.54, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_BasementGate_2", 0.54, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_BasementGate_3", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( "CHECKPOINT_flag1", 0.8, TEAM.AXIS, 0 );
	SetGoalPriority( "FLAG_gunm", 0.79, TEAM.AXIS, 0 );
	SetGoalPriority( "SMOKEBOMB_Axis_CourtyYard_.*", 0.82, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "ATTACK_Axis_CourtyYard_08", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_Gun_.*", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "PLANT_Barricade", 0.55, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Barricade_1", 0.55, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Generator_Protection_Net", 0.56, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK_Axis_BlastDoor_04", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_BlastDoor_09", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_Generator_04", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_Generator_01", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "ATTACK_Axis_Generator_03", 0.52, TEAM.AXIS, 0 );
	
	SetGoalPriority( "DEFEND_Allies_SewerExitGate_02", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_SewerExitGate_04", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_SewerExitGate_04", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_BasementGate_1", 0.54, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_BasementGate_3", 0.54, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_BasementGate_2", 0.53, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_CourtyYard_02", 0.53, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_CourtyYard_04", 0.53, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_CourtyYard_03", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_CourtyYard_12", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_GunMaterial_01", 0.72, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_GunMaterial_02", 0.7, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Gun_01", 0.55, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Gun_02", 0.55, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Gun_03", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Gun_04", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Ammo_.*", 0.53, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_BlastDoor_04", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_BlastDoor_05", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_BlastDoor_11", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Generator_09", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Generator_01", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Generator_02", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "SWITCH_Outside", 0.5, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_InsideNet_01", 0.53, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_KeyCard_03", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_KeyCard_02", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_KeyCard_04", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Rocket_10", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Rocket_02", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_Rocket_03", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "MOUNTMG42_t382_1", 0.71, TEAM.ALLIES, 0 );
	SetGoalPriority( "BUILD_Generator_Protection_Net", 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "SWITCH_.*" );
	Util.SetMaxUsers( 2, "SWITCH_Detonator" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 3, "FLAG_gunm" );
	Util.SetMaxUsers( 1, "FLAG_gold" );
	Util.SetMaxUsers( 2, "FLAG_ammo" );
	Util.SetMaxUsers( 2, "CHECKPOINT_flag1" );
	Util.SetMaxUsers( 1, "BUILD_Barricade" );
	
	Util.UpdateSwitchData();
	
	MapRoutes =
	{
		CAMP_Axis_Start_01 =
		{
			ROUTE_Axis_Spawn =
			{
				ROUTE_Ladder_In_Axis_Spawn_2 =
				{

				},
				ROUTE_Ladder_In_Axis_Spawn_3 =
				{

				},
				ROUTE_Ladder_In_Axis_Spawn_1 =
				{

				},
			},

			ROUTE_Axis_spawn_Exit =
			{
				ROUTE_Ladder_In_Axis_Spawn_2 =
				{

				},
				ROUTE_Ladder_In_Axis_Spawn_3 =
				{

				},
				ROUTE_Ladder_In_Axis_Spawn_1 =
				{

				},
			},
		},

		ATTACK_Axis_SewerExitGate_01 =
		{
			ROUTE_Under_Ladders =
			{
				ROUTE_WoodenBarrier_1 =
				{

				},
				ROUTE_WoodenBarrier_2 =
				{
					ROUTE_WaterTunnel =
					{

					},
				},
			},

			ROUTE_Axis_Spawn =
			{
				ROUTE_Ladder_In_Axis_Spawn_2 =
				{
					ROUTE_WoodenBarrier_1 =
					{

					},
					ROUTE_WoodenBarrier_2 =
					{
						ROUTE_WaterTunnel =
						{

						},
					},
				},
				ROUTE_Ladder_In_Axis_Spawn_3 =
				{
					ROUTE_WoodenBarrier_1 =
					{

					},
					ROUTE_WoodenBarrier_2 =
					{
						ROUTE_WaterTunnel =
						{

						},
					},
				},
				ROUTE_Ladder_In_Axis_Spawn_1 =
				{
					ROUTE_WoodenBarrier_1 =
					{

					},
					ROUTE_WoodenBarrier_2 =
					{
						ROUTE_WaterTunnel =
						{

						},
					},
				},
			},

			ROUTE_Axis_spawn_Exit =
			{
				ROUTE_Ladder_In_Axis_Spawn_2 =
				{
					ROUTE_WoodenBarrier_1 =
					{

					},
					ROUTE_WoodenBarrier_2 =
					{
						ROUTE_WaterTunnel =
						{

						},
					},
				},
				ROUTE_Ladder_In_Axis_Spawn_3 =
				{
					ROUTE_WoodenBarrier_1 =
					{

					},
					ROUTE_WoodenBarrier_2 =
					{
						ROUTE_WaterTunnel =
						{

						},
					},
				},
				ROUTE_Ladder_In_Axis_Spawn_1 =
				{
					ROUTE_WoodenBarrier_1 =
					{

					},
					ROUTE_WoodenBarrier_2 =
					{
						ROUTE_WaterTunnel =
						{

						},
					},
				},
			},
		},

		CHECKPOINT_flag1 =
		{
			ROUTE_OutsideSpawn =
			{
				ROUTE_Direct =
				{
					ROUTE_Room1 =
					{
						Weight = 3,
						ROUTE_RoomTunnel =
						{

						},
					},
					ROUTE_Courtyard1 =
					{
						Weight = 2,
						ROUTE_Courtyard2 =
						{
							ROUTE_Courtyard3 =
							{

							},
						},
						ROUTE_Courtyard4 =
						{
							ROUTE_Courtyard3 =
							{

							},
						},
					},
					ROUTE_Window =
					{
						ROUTE_Courtyard3 =
						{

						},
					},
				},
				ROUTE_Detour =
				{
					ROUTE_Direct =
					{
						ROUTE_Room1 =
						{
							Weight = 3,
							ROUTE_RoomTunnel =
							{

							},
						},
						ROUTE_Courtyard1 =
						{
							Weight = 2,
							ROUTE_Courtyard2 =
							{
								ROUTE_Courtyard3 =
								{

								},
							},
							ROUTE_Courtyard4 =
							{
								ROUTE_Courtyard3 =
								{

								},
							},
						},
						ROUTE_Window =
						{
							ROUTE_Courtyard3 =
							{

							},
						},
					},
				},
			},
			ROUTE_OutsideSpawn1 =
			{
				ROUTE_Direct =
				{
					ROUTE_Room1 =
					{
						Weight = 3,
						ROUTE_RoomTunnel =
						{

						},
					},
					ROUTE_Courtyard1 =
					{
						Weight = 2,
						ROUTE_Courtyard2 =
						{
							ROUTE_Courtyard3 =
							{

							},
						},
						ROUTE_Courtyard4 =
						{
							ROUTE_Courtyard3 =
							{

							},
						},
					},
					ROUTE_Window =
					{
						ROUTE_Courtyard3 =
						{

						},
					},
				},
				ROUTE_Detour =
				{
					ROUTE_Direct =
					{
						ROUTE_Room1 =
						{
							Weight = 3,
							ROUTE_RoomTunnel =
							{

							},
						},
						ROUTE_Courtyard1 =
						{
							Weight = 2,
							ROUTE_Courtyard2 =
							{
								ROUTE_Courtyard3 =
								{

								},
							},
							ROUTE_Courtyard4 =
							{
								ROUTE_Courtyard3 =
								{

								},
							},
						},
						ROUTE_Window =
						{
							ROUTE_Courtyard3 =
							{

							},
						},
					},
				},
			},
		},

		CAPPOINT_GunMat =
		{
			ROUTE_FlagGunm =
			{
				ROUTE_Warehouse =
				{
					Weight = 2,
					ROUTE_LadderToGun =
					{

					},
				},
				ROUTE_AroundMG42 =
				{
					ROUTE_LadderToGun =
					{

					},
				},
			},
		},

		FLAG_ammo =
		{
			ROUTE_CourtyardSpawn =
			{
				ROUTE_Balcony =
				{
					ROUTE_UndergroundTunnel1 =
					{
						Weight = 2,
						ROUTE_UndergroundTunnelLadder =
						{

						},
						ROUTE_UndergroundTunnelExit =
						{

						},
					},
					ROUTE_Passage =
					{
						Weight = 2,
					},
					ROUTE_Courtyard3 =
					{
						ROUTE_Courtyard2 =
						{
							ROUTE_Courtyard5 =
							{

							},
						},
					},
				},
			},
		},

		CAPPOINT_Gun =
		{
			ROUTE_FlagAmmoMat =
			{
				ROUTE_Passage =
				{
					ROUTE_LadderToGun2 =
					{

					},
				},
				ROUTE_UndergroundTunnelExit =
				{
					ROUTE_UndergroundTunnel1 =
					{
						ROUTE_LadderToGun2 =
						{

						},
					},
				},
				ROUTE_Courtyard6 =
				{
					ROUTE_LadderToGun =
					{

					},
				},
			},
		},

		PLANT_Generator_Protection_Net =
		{
			ROUTE_BlastDoorSpawn =
			{
				ROUTE_UnderCP =
				{
					ROUTE_LowerVentilationShaft =
					{

					},
					ROUTE_UpperVentilationShaft =
					{

					},
				},
				ROUTE_AroundCP =
				{

				},
			},
		},
		
		CAPPOINT_Detonator =
		{
			ROUTE_FlagDetonator =
			{
				ROUTE_RightDetonatorWay =
				{

				},
				ROUTE_LeftDetonatorWay =
				{

				},
				ROUTE_UpperDetonatorWay =
				{

				},
			},
		},
		
		BUILD_Command_Post =
		{
			ROUTE_Allied_BasementSpawn =
			{
				ROUTE_Allies_SpawnDoor =
				{
					ROUTE_Allies_Build_CP_1 =
					{
						ROUTE_UpperDetonatorWay =
						{
							ROUTE_LastAxisSpawn = {},
						}
					}
				},
			},
			ROUTE_Allies_KeyCard_Place =
			{
				ROUTE_Allies_SpawnDoor =
				{
					ROUTE_Allies_Build_CP_1 =
					{
						ROUTE_UpperDetonatorWay =
						{
							ROUTE_LastAxisSpawn = {},
						}
					}
				},
			},
		},
	};

	MapRoutes["ATTACK_Axis_Generator_.*"] =
	{
		ROUTE_BlastDoorSpawn =
		{
			ROUTE_AroundCP =
			{
				Weight = 2,
			},
			ROUTE_UnderCP =
			{
				ROUTE_OutsideStairs =
				{

				},
			},
		},
	};

	MapRoutes[".*_Axis_CourtyYard_.*"] =
	{
		ROUTE_OutsideSpawn =
		{
			ROUTE_Direct =
			{
				ROUTE_Courtyard1 =
				{
					Weight = 2,
				},
				ROUTE_Window =
				{

				},
			},
			ROUTE_Detour =
			{
				ROUTE_Direct =
				{
					ROUTE_Courtyard1 =
					{
						Weight = 2,
					},
					ROUTE_Window =
					{

					},
				},
			},
		},
		ROUTE_OutsideSpawn1 =
		{
			ROUTE_Direct =
			{
				ROUTE_Courtyard1 =
				{
					Weight = 2,
				},
				ROUTE_Window =
				{

				},
			},
			ROUTE_Detour =
			{
				ROUTE_Direct =
				{
					ROUTE_Courtyard1 =
					{
						Weight = 2,
					},
					ROUTE_Window =
					{

					},
				},
			},
		},
	};

	MapRoutes["ATTACK_Axis_Rocket_.*"] =
	{
		ROUTE_LastAxisSpawn =
		{
			ROUTE_RightDetonatorWay =
			{

			},
			ROUTE_LeftDetonatorWay =
			{

			},
			ROUTE_UpperDetonatorWay =
			{

			},
		},
	};

	MapRoutes["CAMP_Axis_Start_.*"] = MapRoutes.CAMP_Axis_Start_01;
	MapRoutes["ATTACK_Axis_SewerExitGate_.*"] = MapRoutes.ATTACK_Axis_SewerExitGate_01;
	MapRoutes.PLANT_sewer_exit_gate = MapRoutes.ATTACK_Axis_SewerExitGate_01;
	MapRoutes.PLANT_Generator = MapRoutes.PLANT_Generator_Protection_Net;
	MapRoutes.PLANT_Command_Post = MapRoutes.BUILD_Command_Post;
	MapRoutes["ATTACK_Axis_Rocket_.*"] = MapRoutes.CAPPOINT_Detonator;

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

	Util.Routes(MapRoutes);
	
	print( "^3Omni-bot map script by ^1Q^2i^3k^4i^3 for " + GetMapName() + " executed." );
	Util.BotChat( 0, "say", "^3Omni-bot map script ^3by ^1Q^2i^3k^4i ^3and ^1n^2a^4t^8i^3v^5e12 ^3for ^3map ^7" + GetMapName(), 1 );
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 350.0;

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

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

	wpn = bot.GetWeapon(WEAPON.MOBILE_MG42);
	if(wpn)
	{
		wpn.PrimaryFire.LowAmmoPriority = 0.8;
	}
};
