//==========================================================================================
//
//	adlerhorst.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	^4Tardis	04 July 2010	Initial Script
// 	^4Tardis	28 July 2010    Ladders Fix // Thanks Bubba
//	^4Tardis	30 August 2010	Updated Script
//	^4Tardis	24 September 2010 Routeing added
// 	^4Tardis	08 October 2010 Updated Script
// 	^4Tardis	12 October 2010 Fixes
// 	^4Tardis	22 December 2010 Updated / Fixes
//==========================================================================================
// REPAIRMG42 is not enabled due to map bug will not repair !
// ADDED Navigation ladders Thanks Bubba

// TODO: ROUTEING AXIS 12/10/10 Tardis
// TODO: LIFT seems to WORK 30/07/10 NOT 100% Tardis

global Map =
{
	Debug = 0, // please set to zero before distributing your script

	Allied_Command_Post_Dyno = 0,
	Assault_Ramp_Dyno = 0,
	Bunker_Wall_Dyno = 0,
	Door_to_the_Stairs_Dyno = 0,
	Elevator_Controls_Dyno = 0,
	Elevator_Room_Door_Dyno = 0,
	Gate_MG42_Dyno = 0,
	Sewer_Entrance_Dyno = 0,
	Tank_Barrier_Dyno = 0,
	bridge_Dyno = 0,
	bridge_Built = false,
	Tank_Barrier_Built = false,
	tankzoneTrigger = false,
	beforebridgeTrigger = false,
	afterbridgeTrigger = false,
	barrierTrigger = false,
	tankendTrigger = false,
	Door_to_the_Stairs_Destroyed = false,
	Bunker_Wall_Destroyed = false,
	doortopstatus = false, //closed
	doorbotstatus = false, //closed
	lift1Pos = "bottom", //lift at bottom
	lift1Moving = false,
	docs_Taken = false,
	docs_Reurned = false,
	Tank_Built = true, //Built at Start

	Talk = true, //set Talk to false if you don't want the bots to cheer after winning game:

	Movers =
	{
		"MOVER_lift1",
		"MOVER_tank",
		"MOVER_chains",
		"MOVER_turret",
	},

	//Bubba
	BunkerLadderFacing = null,
	StairsLadderFacing = null,
	// Navigation ladders Bubba
	Navigation =
	{
		bunkerladderf =
		{
			navigate = function(_this)
			{
				Util.MapDebugPrint("bunkerladderf");

				if ( !Map.BunkerLadderFacing )
				{
					Map.BunkerLadderFacing = Util.WpNameInfo("LD1_a");
				}
				_this.AddAimRequest(Priority.High, "facing", Map.BunkerLadderFacing.facing);
				_this.Bot.HoldButton(BTN.FORWARD, 10.0);

				Map.BunkerLadderFacing = null;
				sleep(10); // for how ever long the bot should keep the aim request
			},
		},
		stairsladderc =
		{
			navigate = function(_this)
			{
				Util.MapDebugPrint("stairsladderc");

				if ( !Map.StairsLadderFacing )
				{
					Map.StairsLadderFacing = Util.WpNameInfo("LD2_a");
				}
				_this.AddAimRequest(Priority.High, "facing", Map.StairsLadderFacing.facing);
				_this.Bot.HoldButton(BTN.FORWARD, 10.0);

				Map.StairsLadderFacing = null;
				sleep(10); // for how ever long the bot should keep the aim request
			},
		},
	},
	//End Navigation ladders Bubba

	//lift switches
	Switches =
	{
		callup =
		{
			Enabled = true,
			Priority = 0,
			WaypointName = "callup",
			Timeout = 22000,
			AimPosition = Vec3(-4476.618, -7115.125 ,4064.090),
			// /bot waypoint_setproperty paththrough UseSwitch_PT:callup
			ExitConditions =
			{
				f = function(bot){
					return Map.lift1Moving && Map.lift1Pos == "bottom";
				}
			},
			Wait = function()
			{
				if(Map.lift1Moving){ return false; }
				sleep(2);
				return true;
			},
		},
		in_top =
		{
			Enabled = true,
			Priority = 0,
			WaypointName = "in_top",
			Timeout = 3500,
			AimPosition = Vec3(-4552.427, -6960.125, 4064.761),
			// /bot waypoint_setproperty paththrough UseSwitch_PT:in_top
			Wait = function()
			{
				return !Map.lift1Moving;
			},
		},
		calldown =
		{
			Enabled = true,
			Priority = 0,
			WaypointName = "calldown",
			Timeout = 22000,
			AimPosition = Vec3(-4601.875, -6887.567, 1216.112),
			// /bot waypoint_setproperty paththrough UseSwitch_PT:calldown
			ExitConditions =
			{
				f = function(bot){
					return Map.lift1Moving && Map.lift1Pos == "top";
				}
			},
			Wait = function()
			{
				if(Map.lift1Moving){ return false; }
				sleep(2);
				return true;
			},
		},
		in_bot =
		{
			Enabled = true,
			Priority = 0,
			WaypointName = "in_bot",
			Timeout = 3500,
			AimPosition = Vec3(-4552.246, -7063.875, 1216.423),
			// /bot waypoint_setproperty paththrough UseSwitch_PT:in_bot
			Wait = function()
			{
				return !Map.lift1Moving;
			},
		},
	},
	//lift switches end
	//lift
	lift1 = function(trigger)
	{
		Util.MapDebugPrint("lift moving", true);
		Map.Switches.in_top.Enabled = false;
		Map.Switches.in_bot.Enabled = false;

		Map.lift1Moving = true;
		sleep(15.3);
		Map.lift1Moving = false;

		z = ToVector(trigger.Action).z;
		if (z < 0)
		{
			Map.lift1Pos = "bottom";
			Util.MapDebugPrint("lift at bottom", true);
			sleep(2);
			Map.Switches.in_bot.Enabled = true;
		}
		else if (z > 0)
		{
			Map.lift1Pos = "top";
			Util.MapDebugPrint("lift at top", true);
			sleep(2);
			Map.Switches.in_top.Enabled = true;
		}
	},

	//lift doors
	lowerliftdoor = function( trigger )
	{
		if ( trigger.Action == "opening" )
		{
			Map.doorbotstatus = true; //open
			Map.Switches.calldown.Enabled = false;

			Util.MapDebugPrint("Bottom Door Open", true);
		}
		else if ( trigger.Action == "closing" )
		{
			Map.doorbotstatus = false; //closed
			Map.Switches.calldown.Enabled = true;

			Util.MapDebugPrint("Bottom Door Closed", true);
		}
	},
	upperliftdoor = function( trigger )
	{
		if ( trigger.Action == "opening" )
		{
			Map.doortopstatus = true; //open
			Map.Switches.callup.Enabled = false;

			Util.MapDebugPrint("Top Door Open", true);
		}
		else if ( trigger.Action == "closing" )
		{
			Map.doortopstatus = false; //closed
			Map.Switches.callup.Enabled = true;

			Util.MapDebugPrint("Top Door Closed", true);
		}
	},
	//lift end
	//Tank Trigger Regions
	tankzoneTrigger =
	{
		TriggerOnEntity = GetGoal("MOVER_tank").GetEntity(),

		OnEnter = function(ent)
		{
			Map.tankzoneTrigger = true;

			Util.EnableGoal( "MOVER_tank", true );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"CALLARTILLERY_zone",
				"ARTILLERY_S_zone",
				"MOBILEMG42_zone",
				"MOBILEMORTAR_zone",
				"DEFEND_ZONE.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"GRENADE_fence.*",
				"ATTACK_ZONE.*",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_AXS_Tank" );
			Util.MapDebugPrint( "Tank_Entered_Zone" );
		},
		OnExit = function(ent)
		{
			Map.tankzoneTrigger = false;

			SetAvailableMapGoals( TEAM.AXIS, false, {
				"CALLARTILLERY_zone.*",
				"ARTILLERY_S_zone.*",
				"MOBILEMG42_zone",
				"MOBILEMORTAR_zone",
				"DEFEND_ZONE.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_ZONE.*");
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Command_Post" );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"SNIPE_tank",
				"PLANT_bridge",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_AF_Bridge.*");
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_AF_Bridge.*",
				"BUILD_Tank_Barrier",
			});
			Util.MapDebugPrint( "Tank_Exited_Zone" );
		},
	},
	//before bridge
	beforebridgeTrigger =
	{
		TriggerOnEntity = GetGoal("MOVER_tank").GetEntity(),
		OnEnter = function(ent)
		{
			Map.beforebridgeTrigger = true;

			if ( Map.bridge_Built == true )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"CALLARTILLERY_bridge.*",
					"ARTILLERY_S_bridge.*",
					"AIRSTRIKE_bridge.*",
					"MOBILEMG42_bridge",
				});
			}
			else if ( Map.bridge_Built == false )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"CALLARTILLERY_bridge.*",
					"ARTILLERY_S_bridge.*",
					"AIRSTRIKE_bridge.*",
				});
				SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMG42_zone" );
				SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_bridge" );
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"MOBILEMG42_BF_Bridge.*",
					"BUILD_bridge",
					"ATTACK_AF_Bridge.*",
				});
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_AF_Bridge.*" );
			}
			Util.MapDebugPrint( "Tank_Entered_before_bridge" );
		},

		OnExit = function(ent)
		{
			Map.beforebridgeTrigger = false;

			SetAvailableMapGoals( TEAM.AXIS, false, {
				"CALLARTILLERY_bridge.*",
				"ARTILLERY_S_bridge.*",
				"AIRSTRIKE_bridge.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"AMMOCAB_first_ammocabinet",
				"HEALTHCAB_first_healthcabinet",
			});
			Util.MapDebugPrint( "Tank_Exited_before_bridge" );
		},
	},
	//after birdge
	afterbridgeTrigger =
	{
		TriggerOnEntity = GetGoal("MOVER_tank").GetEntity(),
		OnEnter = function(ent)
		{
			Map.afterbridgeTrigger = true;

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"PLANT_bridge",
				"CALLARTILLERY_AFbridge.*",
				"ARTILLERY_S_AFbridge.*",
				"AIRSTRIKE_AFbridge.*",
			});
			Util.MapDebugPrint( "Tank_Entered_after_bridge" );
		},
		OnExit = function(ent)
		{
			Map.afterbridgeTrigger = false;

			SetAvailableMapGoals( TEAM.AXIS, false, {
				"CALLARTILLERY_AFbridge.*",
				"ARTILLERY_S_AFbridge.*",
				"AIRSTRIKE_AFbridge.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, "MOBILEMG42_BF_Bridge.*");
			SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMG42_bridge" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_AF_Bridge.*");
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_AF_Bridge.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Barrier.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Barrier.*" );
			Util.MapDebugPrint( "Tank_Exited_after_bridge" );
		},
	},
	//at tank barrier
	barrierTrigger =
	{
		TriggerOnEntity = GetGoal("MOVER_tank").GetEntity(),
		OnEnter = function(ent)
		{
			Map.barrierTrigger = true;

			if ( Map.Tank_Barrier_Built == true && Map.Tank_Built == true )
			{

				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_AF_Bridge.*");
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"CALLARTILLERY_Barrier.*",
					"ARTILLERY_S_Barrier.*",
					"AIRSTRIKE_Barrier.*",
				});
				SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_bridge");
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier" );
			}
			else if ( Map.Tank_Barrier_Destroyed == true && Map.Tank_Built == true )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"CALLARTILLERY_Barrier.*",
					"ARTILLERY_S_Barrier.*",
					"AIRSTRIKE_Barrier.*",
				});
				SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_bridge");
				SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier" );
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_bridge");
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier" );
			}

			Util.MapDebugPrint( "Tank_Entered_barrier" );
		},
		OnExit = function(ent)
		{
			Map.barrierTrigger = false;

			SetAvailableMapGoals( TEAM.AXIS, false, {
				"CALLARTILLERY_Barrier.*",
				"ARTILLERY_S_Barrier.*",
				"AIRSTRIKE_Barrier.*",
				"MOBILEMG42_bridge",
				"PLANT_bridge",
				"BUILD_Tank_Barrier",
				"DEFEND_Barrier.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Barrier.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_bridge");
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier" );
			Util.MapDebugPrint( "Tank_Exited_barrier" );
		},
	},
	//Tank at At_End
	tankendTrigger =
	{
		TriggerOnEntity = GetGoal("MOVER_tank").GetEntity(),
		OnEnter = function(ent)
		{
			Map.tankendTrigger = true;

			Util.DisableGoal ( "MOUNT_Tank" );
			Util.DisableGoal ( "MOUNT_AXI_Tank" );
			Util.DisableGoal ( "BUILD_Tank" );
			Util.DisableGoal ( "MOVER_tank" );
			Util.DisableGoal ( "MOVER_chains" );
			Util.DisableGoal ( "MOVER_turret" );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"BUILD_Gate_MG42",
				"DEFEND_gate.*",
				"DEFEND_bunker",
				"DEFEND_Door.*",
				"PLANT_Assault_Ramp",
				"MOUNTMG42_truck",
				"MOUNTMG42_Gate_MG42",
				"SNIPE_tank",
			});

			Util.MapDebugPrint( "Tank_Entered_End_Trip" );
		},
	},
	//end Tank Trigger Regions
	//OBJ - Going Though Sewer
	SewerTrigger =
	{
		Name = "SewerTrigger",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( GetEntFlags(ent,ENTFLAG.CARRYINGGOAL) )
			{
				Util.ChangeSpawn(TEAM.AXIS, 1, 3);
				Util.DisableGoal( "DEFEND_gate.*" );
				Util.DisableGoal( "ATTACK_gate.*" );
				Util.DisableGoal( "MOUNTMG42_.*" );
				Util.DisableGoal( "ATTACK_docs.*" );
				Util.DisableGoal( "DEFEND_docs.*" );
				Util.DisableGoal( "MOBILEMG42_docs" );
				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Trans.*" );
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Trans.*",
					"SNIPE_Trans.*",
					"CALLARTILLERY_Trans_1",
					"ARTILLERY_S_Trans_1",
				});

				Util.MapDebugPrint(GetEntName(ent) + "^8Has Entered Sewer With The Documents!");
			}
		},
		OnExit = function(ent)
		{
			if ( GetEntFlags(ent,ENTFLAG.CARRYINGGOAL) )
			{
				Util.MapDebugPrint(GetEntName(ent) + "^3Has Exited Sewer With The Documents!");
			}
		},
	},
	//OBJ - Though Gate //Thanks CS:
	DocTrigger =
	{
		Name = "DocTrigger",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( GetEntFlags(ent,ENTFLAG.CARRYINGGOAL) )
			{
				Util.ChangeSpawn(TEAM.AXIS, 1, 3);
				Util.DisableGoal( "DEFEND_gate.*" );
				Util.DisableGoal( "ATTACK_gate.*" );
				Util.DisableGoal( "MOUNTMG42_.*" );
				Util.DisableGoal( "ATTACK_docs.*" );
				Util.DisableGoal( "DEFEND_docs.*" );
				Util.DisableGoal( "MOBILEMG42_docs" );
				SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Trans.*" );
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Trans.*",
					"SNIPE_Trans.*",
					"CALLARTILLERY_Trans_1",
					"ARTILLERY_S_Trans_1",
				});

				Util.MapDebugPrint(GetEntName(ent) + "^8Has Entered Gate Area With The Documents!");
			}
		},
		OnExit = function(ent)
		{
			if ( GetEntFlags(ent,ENTFLAG.CARRYINGGOAL) )
			{
				Util.MapDebugPrint(GetEntName(ent) + "^3Has Exited Gate Area With The Documents!");
			}
		},
	},

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

	Allied_Command_Post_Planted = function( trigger )
	{
		Map.Allied_Command_Post_Dyno += 1;

		Util.MapDebugPrint( "Allied_Command_Post_Planted" );
	},

	Allied_Command_Post_Defused = function( trigger )
	{
		Map.Allied_Command_Post_Dyno -= 1;

		Util.MapDebugPrint( "Allied_Command_Post_Defused" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		Map.Allied_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	Assault_Ramp_Built = function( trigger )
	{
		Map.Assault_Ramp_Built = true;
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Assault_Ramp" );

		Util.MapDebugPrint( "Assault_Ramp_Built" );
	},

	Assault_Ramp_Planted = function( trigger )
	{
		Map.Assault_Ramp_Dyno += 1;

		Util.MapDebugPrint( "Assault_Ramp_Planted" );
	},

	Assault_Ramp_Defused = function( trigger )
	{
		Map.Assault_Ramp_Dyno -= 1;

		Util.MapDebugPrint( "Assault_Ramp_Defused" );
	},

	Assault_Ramp_Destroyed = function( trigger )
	{
		Map.Assault_Ramp_Dyno = 0;
		Map.Assault_Ramp_Built = false;
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Assault_Ramp" );

		Util.MapDebugPrint( "Assault_Ramp_Destroyed" );
	},

	Elevator_Room_Door_Planted = function( trigger )
	{
		Map.Elevator_Room_Door_Dyno += 1;

		Util.MapDebugPrint( "Elevator_Room_Door_Planted" );
	},

	Elevator_Room_Door_Defused = function( trigger )
	{
		Map.Elevator_Room_Door_Dyno -= 1;

		Util.MapDebugPrint( "Elevator_Room_Door_Defused" );
	},

	Elevator_Room_Door_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Controls" );
		Map.Elevator_Room_Door_Dyno = 0;

		Util.MapDebugPrint( "Elevator_Room_Door_Destroyed" );
	},

	Elevator_Controls_Built = function( trigger )
	{
		Map.Switches.callup.Enabled = true;
		Map.Switches.in_top.Enabled = true;
		Map.Switches.calldown.Enabled = true;
		Map.Switches.in_bot.Enabled = true;
		Wp.SetWaypointFlag("in_top","closed",false);
		Wp.SetWaypointFlag("in_bot","closed",false);
		//Bots don't use lift till controls built
		Util.EnableGoal( "FLAG.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_lift.*",
			"DEFEND_docs.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Elevator_Controls*" );


		Util.MapDebugPrint( "Elevator_Controls_Built" );
	},

	Elevator_Controls_Planted = function( trigger )
	{
		Map.Elevator_Controls_Dyno += 1;

		Util.MapDebugPrint( "Elevator_Controls_Planted" );
	},

	Elevator_Controls_Defused = function( trigger )
	{
		Map.Elevator_Controls_Dyno -= 1;

		Util.MapDebugPrint( "Elevator_Controls_Defused" );
	},

	Elevator_Controls_Destroyed = function( trigger )
	{
		Map.Elevator_Controls_Dyno = 0;

		Map.Switches.callup.Enabled = false;
		Map.Switches.in_top.Enabled= false;
		Map.Switches.calldown.Enabled = false;
		Map.Switches.in_bot.Enabled = false;

		Wp.SetWaypointFlag("in_top","closed",true);
		Wp.SetWaypointFlag("in_bot","closed",true);
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_lift.*",
			"DEFEND_docs.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Elevator_Controls" );

		Util.MapDebugPrint( "Elevator_Controls_Destroyed" );
	},

	Gate_MG42_Built = function( trigger )
	{
		Map.Gate_MG42_Built = true;

		Util.MapDebugPrint( "Gate_MG42_Built" );
	},

	Gate_MG42_Planted = function( trigger )
	{
		Map.Gate_MG42_Dyno += 1;

		Util.MapDebugPrint( "Gate_MG42_Planted" );
	},

	Gate_MG42_Defused = function( trigger )
	{
		Map.Gate_MG42_Dyno -= 1;

		Util.MapDebugPrint( "Gate_MG42_Defused" );
	},

	Gate_MG42_Destroyed = function( trigger )
	{
		Map.Gate_MG42_Built = false;
		Map.Gate_MG42_Dyno = 0;

		if ( Map.Gate_MG42_Built == true && Map.Assault_Ramp_Built == true ){
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_Gate_MG42" );
		}
		else if ( Map.Gate_MG42_Built == false && Map.Assault_Ramp_Built == false ){
			Util.DisableGoal( "MOUNTMG42_Gate_MG42" );
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Gate_MG42" );
		}
		else if ( Map.Gate_MG42_Built == true && Map.Assault_Ramp_Built == false ){
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_Gate_MG42" );
		}

		Util.MapDebugPrint( "Gate_MG42_Destroyed" );
	},

	Tank_Built = function( trigger )
	{
		Map.Tank_Built = true;
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNT_tank" );
		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Destroyed = function( trigger )
	{
		Map.Tank_Destroyed = true;
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Tank" );
		Util.MapDebugPrint( "Tank_Destroyed" );
	},

	Tank_Barrier_Built = function( trigger )
	{
		Map.Tank_Barrier_Built = true;

		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Barrier.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Barrier.*" );

		Util.MapDebugPrint( "Tank_Barrier_Built" );
	},

	Tank_Barrier_Planted = function( trigger )
	{
		Map.Tank_Barrier_Dyno += 1;

		Util.MapDebugPrint( "Tank_Barrier_Planted" );
	},

	Tank_Barrier_Defused = function( trigger )
	{
		Map.Tank_Barrier_Dyno -= 1;

		Util.MapDebugPrint( "Tank_Barrier_Defused" );
	},

	Tank_Barrier_Destroyed = function( trigger )
	{
		Map.Tank_Barrier_Destroyed = true;
		Map.Tank_Barrier_Dyno = 0;

		if( Map.barrierTrigger == true )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier" );
		}
		else if (Map.barrierTrigger == false)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier" );
		}
		Util.MapDebugPrint( "Tank_Barrier_Destroyed" );
	},

	bridge_Built = function( trigger )
	{
		Map.bridge_Built = true;
		if ( Map.afterbridgeTrigger == true || Map.afterbridgeTrigger == false || Map.beforebridgeTrigger == true || Map.beforebridgeTrigger == false )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"BUILD_Tank_Barrier",
				"PLANT_bridge",
				"DEFEND_AFbridge.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_AFbridge.*");
		}
		Util.MapDebugPrint( "bridge_Built" );
	},

	bridge_Planted = function( trigger )
	{
		Map.bridge_Dyno += 1;

		Util.MapDebugPrint( "bridge_Planted" );
	},

	bridge_Defused = function( trigger )
	{
		Map.bridge_Dyno -= 1;

		Util.MapDebugPrint( "bridge_Defused" );
	},

	bridge_Destroyed = function( trigger )
	{
		Map.bridge_Built = false;
		Map.bridge_Dyno = 0;

		if ( Map.barrierTrigger == true )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_bridge" );
		}

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

		Util.MapDebugPrint( "bridge_Destroyed" );
	},

	Bunker_Wall_Planted = function( trigger )
	{
		Map.Bunker_Wall_Dyno += 1;

		Util.MapDebugPrint( "Bunker_Wall_Planted" );
	},

	Bunker_Wall_Defused = function( trigger )
	{
		Map.Bunker_Wall_Dyno -= 1;

		Util.MapDebugPrint( "Bunker_Wall_Defused" );
	},

	Bunker_Wall_Destroyed = function( trigger )
	{
		Map.Bunker_Wall_Destroyed = true;
		Map.Bunker_Wall_Dyno = 0;
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Assault_Ramp" );

		if ( Map.Bunker_Wall_Destroyed == true && Map.Door_to_the_Stairs_Destroyed == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_gate.*",
				"MOUNTMG42_truck",
				"MOUNTMG42_Gate_MG42",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
			});
			Util.EnableGoal( "FLAG.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_bunker" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
				"DEFEND_bunk.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_.*" );
			Util.EnableGoal( "FLAG.*" );
			Util.DisableGoal( "MOUNTMG42_Gate_MG42" );
		}

		Util.MapDebugPrint( "Bunker_Wall_Destroyed" );
	},

	Door_to_the_Stairs_Planted = function( trigger )
	{
		Map.Door_to_the_Stairs_Dyno += 1;

		Util.MapDebugPrint( "Door_to_the_Stairs_Planted" );
	},

	Door_to_the_Stairs_Defused = function( trigger )
	{
		Map.Door_to_the_Stairs_Dyno -= 1;

		Util.MapDebugPrint( "Door_to_the_Stairs_Defused" );
	},

	Door_to_the_Stairs_Destroyed = function( trigger )
	{
		Map.Door_to_the_Stairs_Destroyed = true;
		Map.Door_to_the_Stairs_Dyno = 0;
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Assault_Ramp" );

		if ( Map.Door_to_the_Stairs_Destroyed == true && Map.Bunker_Wall_Destroyed == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_gate.*",
				"MOUNTMG42_truck",
				"MOUNTMG42_Gate_MG42",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
				"DEFEND_DTTS.*",
			});
			Util.DisableGoal( "MOUNTMG42_Gate_MG42" );

		}

		Util.MapDebugPrint( "Door_to_the_Stairs_Destroyed" );
	},

	Sewer_Entrance_Planted = function( trigger )
	{
		Map.Sewer_Entrance_Dyno += 1;

		Util.MapDebugPrint( "Sewer_Entrance_Planted" );
	},

	Sewer_Entrance_Defused = function( trigger )
	{
		Map.Sewer_Entrance_Dyno -= 1;

		Util.MapDebugPrint( "Sewer_Entrance_Defused" );
	},

	Sewer_Entrance_Destroyed = function( trigger )
	{
		Map.Sewer_Entrance_Dyno = 0;

		Util.MapDebugPrint( "Sewer_Entrance_Destroyed" );
	},

	Gate_Destroyed = function( trigger )
	{
		Util.ChangeSpawn(TEAM.AXIS, 5 );
		Util.DisableGoal ( "MOUNT_AXS_Tank" );
		Util.DisableGoal ( "MOUNT_Tank" );
		Util.DisableGoal ( "BUILD_Tank" );
		Util.DisableGoal ( "MOVER_tank" );
		Util.DisableGoal ( "MOVER_chains" );
		Util.DisableGoal ( "MOVER_turret" );
		Util.EnableGoal ( "FLAG_docs" );
		Util.EnableGoal ( "CAPPOINT_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_Assault_Ramp",
			"ATTACK_gate.*",
			"GRENADE_truck.*",
			"PLANT_Bunker_Wall",
			"PLANT_Elevator_Room_Door",
			"PLANT_Door_to_the_Stairs",
			"PLANT_Sewer_Entrance",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_gate.*",
			"DEFEND_bunker",
			"DEFEND_Door.*",
			"PLANT_Assault_Ramp",
			"MOUNTMG42_truck",
			"MOUNTMG42_Gate_MG42",
			"SNIPE_tank",
			"SNIPE_GATE",
		});

		if ( Map.Gate_MG42_Built == true && Map.Assault_Ramp_Built == true ){
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_Gate_MG42" );
		}
		else if ( Map.Gate_MG42_Built == false && Map.Assault_Ramp_Built == false ){
			Util.DisableGoal( "MOUNTMG42_Gate_MG42" );
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Gate_MG42" );
		}
		else if ( Map.Gate_MG42_Built == true && Map.Assault_Ramp_Built == false ){
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_Gate_MG42" );
		}
		Util.MapDebugPrint( "Gate_Destroyed" );
	},

	docs_Taken = function( trigger )
	{
		Map.docs_Taken = true;
		Util.ChangeSpawn(TEAM.AXIS, 1, 3);
		if ( Map.Door_to_the_Stairs_Destroyed == false )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gate.*" ); //false when past gate
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_truck" ); //false when past gate
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_Gate_MG42" ); //false when past gate
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Trans.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_lift.*",
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_Trans.*",
				"SNIPE_Trans.*",
				"CALLARTILLERY_Trans_1",
				"ARTILLERY_S_Trans_1",
			});
		}
		else if ( Map.Bunker_Wall_Destroyed == false )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gate.*" ); //false when past gate
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_truck" ); // false when past gate
			SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_Gate_MG42" ); // false when past gate
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Trans.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_lift.*",
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_Trans.*",
				"SNIPE_Trans.*",
				"CALLARTILLERY_Trans_1",
				"ARTILLERY_S_Trans_1",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_gate.*",
				"MOUNTMG42_truck",
				"MOUNTMG42_Gate_MG42",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Trans.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_lift.*",
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_Trans.*",
				"SNIPE_Trans.*",
				"CALLARTILLERY_Trans_1",
				"ARTILLERY_S_Trans_1",
			});
		}
		Util.MapDebugPrint( "docs_Taken" );
	},

	docs_Returned = function( trigger )
	{
		docs_Returned = true;
		Util.ChangeSpawn(TEAM.AXIS, 5 );
		if ( Map.Door_to_the_Stairs_Destroyed == false )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_gate.*",
				"MOUNTMG42_truck",
				"MOUNTMG42_Gate_MG42",
				"DEFEND_lift.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Trans.*" );
		}
		else if ( Map.Bunker_Wall_Destroyed == false )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_gate.*",
				"MOUNTMG42_truck",
				"MOUNTMG42_Gate_MG42",
				"DEFEND_lift.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Trans.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_gate.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_gate.*",
				"MOUNTMG42_truck",
				"MOUNTMG42_Gate_MG42",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_docs.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Trans.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_lift.*",
				"DEFEND_docs.*",
				"MOBILEMG42_docs",
			});
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_Trans.*",
				"SNIPE_Trans.*",
				"CALLARTILLERY_Trans_1",
				"ARTILLERY_S_Trans_1",
			});
			Util.DisableGoal( "MOUNTMG42_Gate_MG42" );
		}
		Util.MapDebugPrint( "docs_Returned" );
	},

	docs_Secured = function( trigger )
	{
//Game Over
		if ( Map.Talk && MAP_TALK )
		{
			ETUtil.WinningChat( TEAM.ALLIES );
			ETUtil.LosingChat( TEAM.AXIS );
		}

		Util.MapDebugPrint( "docs_Secured" );
	},

};

global OnMapLoad = function()
{

// Register callback functions
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "The Assault Ramp has been constructed", Map.Assault_Ramp_Built );
	OnTrigger( "Allied team has repaired the Elevator Controls!", Map.Elevator_Controls_Built );
	OnTrigger( "Axis have built the MG42 at the Gate!", Map.Gate_MG42_Built );
	OnTrigger( "The tank has been repaired!", Map.Tank_Built );
	OnTrigger( "The tank has been damaged!", Map.Tank_Destroyed );
	OnTrigger( "The Tank Barrier has been constructed.", Map.Tank_Barrier_Built );
	OnTrigger( "Allied team has constructed the Bridge!", Map.bridge_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "The Assault Ramp has been destroyed", Map.Assault_Ramp_Destroyed );
	OnTrigger( "The Allies have destroyed the Bunker Wall!", Map.Bunker_Wall_Destroyed );
	OnTrigger( "The Allies have destroyed the Door to the Stairs!", Map.Door_to_the_Stairs_Destroyed );
	OnTrigger( "Axis team has destroyed the Elevator Controls!", Map.Elevator_Controls_Destroyed );
	OnTrigger( "The Allies have destroyed the Elevator Room Door!", Map.Elevator_Room_Door_Destroyed );
	OnTrigger( "Allies have destroyed the MG42 at the Gate!", Map.Gate_MG42_Destroyed );
	OnTrigger( "The Allies have destroyed the Sewer Entrance!", Map.Sewer_Entrance_Destroyed );
	OnTrigger( "The Tank Barrier has been destroyed.", Map.Tank_Barrier_Destroyed );
	OnTrigger( "Axis team has destroyed the Bridge!", Map.bridge_Destroyed );
	OnTrigger( "documents! Taken", Map.docs_Taken );
	OnTrigger( "documents! Returned", Map.docs_Returned );
	OnTrigger( "Allied team has transmitted the documents!", Map.docs_Secured );
	OnTrigger( "The Gate has been destroyed.", Map.Gate_Destroyed );
	OnTrigger( "Planted at the Allied Command Post.", Map.Allied_Command_Post_Planted );
	OnTrigger( "Planted at the Assault Ramp.", Map.Assault_Ramp_Planted );
	OnTrigger( "Planted at the Bunker Wall.", Map.Bunker_Wall_Planted );
	OnTrigger( "Planted at the Door to the Stairs.", Map.Door_to_the_Stairs_Planted );
	OnTrigger( "Planted at the Elevator Controls.", Map.Elevator_Controls_Planted );
	OnTrigger( "Planted at the Elevator Room Door.", Map.Elevator_Room_Door_Planted );
	OnTrigger( "Planted at the Gate MG42.", Map.Gate_MG42_Planted );
	OnTrigger( "Planted at the Sewer Entrance.", Map.Sewer_Entrance_Planted );
	OnTrigger( "Planted at the Tank Barrier.", Map.Tank_Barrier_Planted );
	OnTrigger( "Planted at the bridge.", Map.bridge_Planted );
	OnTrigger( "Defused at the Allied Command Post.", Map.Allied_Command_Post_Defused );
	OnTrigger( "Defused at the Assault Ramp.", Map.Assault_Ramp_Defused );
	OnTrigger( "Defused at the Bunker Wall.", Map.Bunker_Wall_Defused );
	OnTrigger( "Defused at the Door to the Stairs.", Map.Door_to_the_Stairs_Defused );
	OnTrigger( "Defused at the Elevator Controls.", Map.Elevator_Controls_Defused );
	OnTrigger( "Defused at the Elevator Room Door.", Map.Elevator_Room_Door_Defused );
	OnTrigger( "Defused at the Gate MG42.", Map.Gate_MG42_Defused );
	OnTrigger( "Defused at the Sewer Entrance.", Map.Sewer_Entrance_Defused );
	OnTrigger( "Defused at the Tank Barrier.", Map.Tank_Barrier_Defused );
	OnTrigger( "Defused at the bridge.", Map.bridge_Defused );
// lift1
	OnTrigger( "lift1_goto", Map.lift1 );
	OnTrigger( "upperliftdoor_Moving", Map.upperliftdoor );
	OnTrigger( "liftdoor_Moving", Map.lowerliftdoor );
//Tank trigger boxes
	tankzone = OnTriggerRegion(AABB(5197.482,-1064.221,1371.389,5482.368,-832.551,1455.571),Map.tankzoneTrigger);
	beforebridge = OnTriggerRegion(AABB(2103.102,-645.264,1294.110,2555.745,-399.927,1397.493),Map.beforebridgeTrigger);
	afterbridge = OnTriggerRegion(AABB(596.730,-694.429,1298.068,1133.234,-343.213,1395.711),Map.afterbridgeTrigger);
	barrier = OnTriggerRegion(AABB(-2156.101,278.863,1172.664,-1589.514,516.927,1308.137),Map.barrierTrigger);
	tankend  = OnTriggerRegion(AABB(-5386.144,312.578,1151.795,-5003.214,497.556,1234.268),Map.tankendTrigger);
//triggers if got Doc's //Thanks cs:
	doctrigger = OnTriggerRegion(AABB(-6637.083,-2265.753,1117.125,-5090.680,-786.329,1481.460), Map.DocTrigger);
	sewertrigger = OnTriggerRegion(AABB(-4290.501,-3256.676,1015.601,718.188,-3206.340,1108.153), Map.SewerTrigger);
//Breakable
	Ladder1 = OnTriggerRegion(AABB(-4957.425,-6939.883,3610.974,-4784.123,-6827.226,4161.509), RegionTrigger.BreakableDistance);
	Ladder2 = OnTriggerRegion(AABB(-5579.790,-6946.469,3876.120,-5427.779,-6813.472,4106.518), RegionTrigger.BreakableDistance);
	RegionTrigger.BreakableDistance.MaxBreakableDist = 200;
//Util.SetGoalOffset
	Util.SetGoalOffset( 0, 40, 0, "PLANT_Bunker_Wall" );
	Util.SetGoalOffset( 15, 0, 0, "PLANT_Elevator_Room_Door" );
	Util.SetGoalOffset( 20, 0, 0, "BUILD_bridge" );
	Util.SetGoalOffset( -30, 0, -20, "BUILD_Tank_Barrier" );
	Util.SetGoalOffset( 20, 0, 0, "PLANT_Tank_Barrier" );
//SetGoalPriority
	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.MEDIC, true  );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.ENGINEER, true );
	SetGoalPriority( "PLANT_bridge", 0.9, TEAM.AXIS, CLASS.ENGINEER, true );
//Util.DisableGoal
	Util.DisableGoal( ".*", true ); // all but routes
//SetAvailableMapGoals
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_ZONE.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"BUILD_Tank",
		"BUILD_bridge",
		"MOUNT_Tank",
		"ATTACK_ZONE.*",
	});
	Wp.SetWaypointFlag("in_top","closed",true);
	Wp.SetWaypointFlag("in_bot","closed",true);
//Add Use Wp
	Util.AddUseWp("PLANT_Assault_Ramp", "ramp");
	Util.AddUseWp("PLANT_Assault_Ramp", "ramp1");
	Util.AddUseWp("PLANT_bridge", "bridge");
	Util.AddUseWp("PLANT_bridge", "bridge1");
	Util.AddUseWp("PLANT_bridge", "bridge2");
	Util.AddUseWp("PLANT_bridge", "bridge3");
	Util.AddUseWp("PLANT_bridge", "bridge4");
	Util.AddUseWp("PLANT_Tank_Barrier", "Barrier");
	Util.AddUseWp("PLANT_Tank_Barrier", "Barrier_1");
	Util.AddUseWp("PLANT_Tank_Barrier", "Barrier_2");
	Util.AddUseWp("PLANT_Tank_Barrier", "Barrier_3");
	Util.AddUseWp("PLANT_Tank_Barrier", "Barrier_4");
	Util.AddUseWp("PLANT_Elevator_Controls", "ELE_CON");
//SwitchData
	Util.UpdateSwitchData();
// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "BUILD_.*" );
	Util.SetMaxUsers( 2, "PLANT_.*" );
// Camp times
	SetMapGoalProperties( "ATTACK_.*", {mincamptime=30, maxcamptime=45});
	SetMapGoalProperties( "DEFEND_.*", {mincamptime=60, maxcamptime=120});
	SetMapGoalProperties( "MOUNTMG42_.*", {mincamptime=60, maxcamptime=120});
	SetMapGoalProperties( "SNIPE_.*", {mincamptime=60, maxcamptime=60});
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=60, MaxCampTime=120} );
	SetMapGoalProperties( "MOBILEMORTAR_.*", {MinCampTime=60, MaxCampTime=120} );
//Map Routes

	MapRoutes =
	{
		FLAG_docs =
		{
			ROUTE_SPAWN_4  =
			{
				ROUTE_GATE  =
				{
					ROUTE_Door_to_the_stairs_A  =
					{
						ROUTE_Door_to_the_Stairs  =
						{
							ROUTE_door_to_the_stairs_top  =
							{
								ROUTE_Documents  =
								{
								},
							},
						},
					},
					ROUTE_Door_to_the_stairs_B  =
					{
						ROUTE_Door_to_the_Stairs  =
						{
							ROUTE_door_to_the_stairs_top  =
							{
								ROUTE_Documents  =
								{
								},
							},
						},
					},
					ROUTE_The_Bunker_Wall  =
					{
						ROUTE_Bunker_Wall_BOTTOM  =
						{
							ROUTE_Bunker_Wall_TOP  =
							{
								ROUTE_Documents  =
								{
								},
							},
						},
					},
					ROUTE_LIFT_Bot  =
					{
						ROUTE_LIFT_Top  =
						{
							ROUTE_Documents  =
							{
							},
						},
					},
				},
				ROUTE_GATE_A  =
				{
					ROUTE_Assault_Ramp_B  =
					{
						ROUTE_Door_to_the_stairs_A  =
						{
							ROUTE_Door_to_the_Stairs  =
							{
								ROUTE_door_to_the_stairs_top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
						ROUTE_Door_to_the_stairs_B  =
						{
							ROUTE_Door_to_the_Stairs  =
							{
								ROUTE_door_to_the_stairs_top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
						ROUTE_LIFT_Bot  =
						{
							ROUTE_LIFT_Top  =
							{
								ROUTE_Documents  =
								{
								},
							},
						},
						ROUTE_The_Bunker_Wall  =
						{
							ROUTE_Bunker_Wall_BOTTOM  =
							{
								ROUTE_Bunker_Wall_TOP  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
					},
				},
				ROUTE_GATE_B  =
				{
					ROUTE_Assault_Ramp  =
					{
						ROUTE_Ramp_Right_A  =
						{
							ROUTE_Door_to_the_stairs_A  =
							{
								ROUTE_Door_to_the_Stairs  =
								{
									ROUTE_door_to_the_stairs_top  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_Door_to_the_stairs_B  =
							{
								ROUTE_Door_to_the_Stairs  =
								{
									ROUTE_door_to_the_stairs_top  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
						},
						ROUTE_Ramp_Right_B  =
						{
							ROUTE_The_Bunker_Wall  =
							{
								ROUTE_Bunker_Wall_BOTTOM  =
								{
									ROUTE_Bunker_Wall_TOP  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_LIFT_Bot  =
							{
								ROUTE_LIFT_Top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
					},
				},
				ROUTE_Assault_Ramp_Bot  =
				{
					ROUTE_Assault_Ramp  =
					{
						ROUTE_Ramp_Right_A  =
						{
							ROUTE_Door_to_the_stairs_A  =
							{
								ROUTE_door_to_the_stairs_top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
						ROUTE_Ramp_Right_B  =
						{
							ROUTE_The_Bunker_Wall  =
							{
								ROUTE_Bunker_Wall_BOTTOM  =
								{
									ROUTE_Bunker_Wall_TOP  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
						},
					},
					ROUTE_Assault_Ramp_B  =
					{
						ROUTE_Door_to_the_stairs_A  =
						{
							ROUTE_Door_to_the_Stairs  =
							{
								ROUTE_door_to_the_stairs_top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
						ROUTE_Door_to_the_stairs_B  =
						{
							ROUTE_Door_to_the_Stairs  =
							{
								ROUTE_door_to_the_stairs_top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
						ROUTE_Ramp_Right_A  =
						{
							ROUTE_Door_to_the_stairs_A  =
							{
								ROUTE_Door_to_the_Stairs  =
								{
									ROUTE_door_to_the_stairs_top  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_Door_to_the_stairs_B  =
							{
								ROUTE_Door_to_the_Stairs  =
								{
									ROUTE_door_to_the_stairs_top  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_The_Bunker_Wall  =
							{
								ROUTE_Bunker_Wall_BOTTOM  =
								{
									ROUTE_Bunker_Wall_TOP  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_LIFT_Bot  =
							{
								ROUTE_LIFT_Top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
						ROUTE_Ramp_Right_B  =
						{
							ROUTE_Door_to_the_stairs_A  =
							{
								ROUTE_Door_to_the_Stairs  =
								{
									ROUTE_door_to_the_stairs_top  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_Door_to_the_stairs_B  =
							{
								ROUTE_Door_to_the_Stairs  =
								{
									ROUTE_door_to_the_stairs_top  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_The_Bunker_Wall  =
							{
								ROUTE_Bunker_Wall_BOTTOM  =
								{
									ROUTE_Bunker_Wall_TOP  =
									{
										ROUTE_Documents  =
										{
										},
									},
								},
							},
							ROUTE_LIFT_Bot  =
							{
								ROUTE_LIFT_Top  =
								{
									ROUTE_Documents  =
									{
									},
								},
							},
						},
					},
				},
			},
		},

		BUILD_bridge =
		{
			ROUTE_ALLIES_SPAWN  =
			{
				ROUTE_ALLIES_SPAWN_DOOR  =
				{
					ROUTE_SPAWN_DOOR_EXIT  =
					{
						ROUTE_Con_BRIDGE  =
						{
						},
					},
				},
				ROUTE_Con_BRIDGE  =
				{
				},
			},
		},
		BUILD_Allied_Command_Post =
		{
			ROUTE_ALLIES_SPAWN  =
			{
				ROUTE_ALLIES_SPAWN_DOOR  =
				{
					ROUTE_HILL  =
					{
						ROUTE_SPWAN_HUT  =
						{
						},
					},
				},
				ROUTE_HILL_1  =
				{
					ROUTE_SPWAN_HUT  =
					{
					},
				},
			},
		},
		CAPPOINT_Radio =
		{
			ROUTE_ROOF  =
			{
				ROUTE_Sewer_A  =
				{
					ROUTE_Sewer_B  =
					{
						ROUTE_bridge  =
						{
							ROUTE_HILL_1  =
							{
								ROUTE_OUTSIDE_HUT_FRUNT  =
								{
									ROUTE_Radio  =
									{
									},
								},
								ROUTE_OUTSIDE_HUT_BACK  =
								{
									ROUTE_Radio  =
									{
									},
								},
							},
						},
					},
				},
				ROUTE_GATE  =
				{
					ROUTE_Bridge_River  =
					{
						ROUTE_bridge  =
						{
							ROUTE_HILL_1  =
							{
								ROUTE_OUTSIDE_HUT_FRUNT  =
								{
									ROUTE_Radio  =
									{
									},
								},
								ROUTE_OUTSIDE_HUT_BACK  =
								{
									ROUTE_Radio  =
									{
									},
								},
							},
						},
					},
					ROUTE_Bridge_River_B  =
					{
						ROUTE_bridge  =
						{
							ROUTE_HILL_1  =
							{
								ROUTE_OUTSIDE_HUT_FRUNT  =
								{
									ROUTE_Radio  =
									{
									},
								},
								ROUTE_OUTSIDE_HUT_BACK  =
								{
									ROUTE_Radio  =
									{
									},
								},
							},
						},
					},
					ROUTE_trans  =
					{
						ROUTE_Radio  =
						{
						},
					},
					ROUTE_Con_BRIDGE_A  =
					{
						ROUTE_Con_BRIDGE  =
						{
							ROUTE_HILL_1  =
							{
								ROUTE_OUTSIDE_HUT_FRUNT  =
								{
									ROUTE_Radio  =
									{
									},
								},
								ROUTE_OUTSIDE_HUT_BACK  =
								{
									ROUTE_Radio  =
									{
									},
								},
							},
						},
					},
				},
			},
			ROUTE_Documents  =
			{
				ROUTE_LIFT_Top  =
				{
					ROUTE_LIFT_Bot  =
					{
						ROUTE_Sewer_A  =
						{
							ROUTE_Sewer_B  =
							{
								ROUTE_bridge  =
								{
									ROUTE_HILL_1  =
									{
										ROUTE_OUTSIDE_HUT_FRUNT  =
										{
											ROUTE_Radio  =
											{
											},
										},
										ROUTE_OUTSIDE_HUT_BACK  =
										{
											ROUTE_Radio  =
											{
											},
										},
									},
								},
							},
						},
						ROUTE_GATE  =
						{
							ROUTE_Bridge_River  =
							{
								ROUTE_bridge  =
								{
									ROUTE_HILL_1  =
									{
										ROUTE_OUTSIDE_HUT_FRUNT  =
										{
											ROUTE_Radio  =
											{
											},
										},
										ROUTE_OUTSIDE_HUT_BACK  =
										{
											ROUTE_Radio  =
											{
											},
										},
									},
								},
							},
							ROUTE_Bridge_River_B  =
							{
								ROUTE_bridge  =
								{
									ROUTE_HILL_1  =
									{
										ROUTE_OUTSIDE_HUT_FRUNT  =
										{
											ROUTE_Radio  =
											{
											},
										},
										ROUTE_OUTSIDE_HUT_BACK  =
										{
											ROUTE_Radio  =
											{
											},
										},
									},
								},
							},
							ROUTE_trans  =
							{
								ROUTE_Radio  =
								{
								},
							},
							ROUTE_Con_BRIDGE_A  =
							{
								ROUTE_Con_BRIDGE  =
								{
									ROUTE_HILL_1  =
									{
										ROUTE_OUTSIDE_HUT_FRUNT  =
										{
											ROUTE_Radio  =
											{
											},
										},
										ROUTE_OUTSIDE_HUT_BACK  =
										{
											ROUTE_Radio  =
											{
											},
										},
									},
								},
							},
						},
					},
				},
				ROUTE_door_to_the_stairs_top  =
				{
					ROUTE_Door_to_the_Stairs  =
					{
						ROUTE_Door_to_the_stairs_A  =
						{
							ROUTE_Sewer_A  =
							{
								ROUTE_Sewer_B  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
							},
							ROUTE_GATE  =
							{
								ROUTE_Bridge_River  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
								ROUTE_Bridge_River_B  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
								ROUTE_trans  =
								{
									ROUTE_Radio  =
									{
									},
								},
								ROUTE_Con_BRIDGE_A  =
								{
									ROUTE_Con_BRIDGE  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
							},
						},
						ROUTE_Door_to_the_stairs_B  =
						{
							ROUTE_Sewer_A  =
							{
								ROUTE_Sewer_B  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
							},
							ROUTE_GATE  =
							{
								ROUTE_Bridge_River  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
								ROUTE_Bridge_River_B  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
								ROUTE_trans  =
								{
									ROUTE_Radio  =
									{
									},
								},
								ROUTE_Con_BRIDGE_A  =
								{
									ROUTE_Con_BRIDGE  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
							},
						},
					},
				},
				ROUTE_Bunker_Wall_TOP  =
				{
					ROUTE_Bunker_Wall_BOTTOM  =
					{
						ROUTE_The_Bunker_Wall  =
						{
							ROUTE_Sewer_A  =
							{
								ROUTE_Sewer_B  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
							},
							ROUTE_GATE  =
							{
								ROUTE_Bridge_River  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
								ROUTE_Bridge_River_B  =
								{
									ROUTE_bridge  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
								ROUTE_trans  =
								{
									ROUTE_Radio  =
									{
									},
								},
								ROUTE_Con_BRIDGE_A  =
								{
									ROUTE_Con_BRIDGE  =
									{
										ROUTE_HILL_1  =
										{
											ROUTE_OUTSIDE_HUT_FRUNT  =
											{
												ROUTE_Radio  =
												{
												},
											},
											ROUTE_OUTSIDE_HUT_BACK  =
											{
												ROUTE_Radio  =
												{
												},
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
	};

	Util.Routes(MapRoutes);

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

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 90.0;
	bot.MaxViewDistance = 2400;
};
