//==========================================================================================
//
//	battery_recharged.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	^4Tardis	12 September 2010	Updated Script to 0.8
//
//==========================================================================================
//

global Map =
{
	Debug = 0,

	Allied_Beach_Assault_Ramp_Dyno = 0,
	Allied_East_beach_MG_nest_Dyno = 0,
	Allied_West_beach_MG_nest_Dyno = 0,
	Axis_Main_Bunker_MG_nest_Dyno = 0,
	Axis_North_West_MG_nest_Dyno = 0,
	Axis_South_East_MG_nest_Dyno = 0,
	Barricade_Dyno = 0,
	Command_Post_Dyno = 0,
	Generator_Dyno = 0,
	Gun_Dyno = 0,
	Gun_Controls_Dyno = 0,
	Power_Supply_Dyno = 0,
	Power_Supply_Door_Dyno = 0,
	Radar_Station_Dyno = 0,

	//set some vars for the door entities
	frontdoorent,
	leftdoorent,
	rightdoorent,

        //status' for conditionals
	Barricade = false, //not built initially
	Flagstatus = 0, //0 none, 1 axis, 2 allies
	Doorcontrols = true, //intact
	Frontdoor = false, //closed
	Rightdoor = false,
	Leftdoor = false,
	HatchStatus = false, //closed at start
	CPStatus = 0, // no team owns it
        Power_Supply_Door = false, //not built initially
	BaseTriggered = false,
	Axis_Conservative = false,
	DispenseHealthTime = 2,

	Switches =
	{
		FrontDoor =
		{
			Enabled = true,
			Priority = 0, // leave for paththrough
			WaypointName = "Front Door Switch",
			LimitTeam = 0, // disabled initially.
		},

		LeftDoor =
		{
			Enabled = true,
			Priority = 0, // leave for paththrough
			WaypointName = "Left Door Switch",
			LimitTeam = 0, // disabled initially.
		},

		RightDoor =
		{
			Enabled = true,
			Priority = 0, // leave for paththrough
			WaypointName = "Right Door Switch",
			LimitTeam = 0, // disabled initially.
		},

		hatch =
		{
			Enabled = true,
			Priority = 0, // leave for paththrough
			WaypointName = "hatch",
			LimitTeam = 0, // disabled initially.
		},
	},

	BaseTrigger =
	{
		Name = "BaseTrigger",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( !Map.BaseTriggered )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Util.SetMaxUsers( 2, "CHECKPOINT_westbunker_flag" );
					SetAvailableMapGoals( TEAM.AXIS , true, "CHECKPOINT_westbunker_flag");
					Map.BaseTriggered = true;
				}
			}
		},
	},

	Assault_Ramp =
	{
		Name="Assault_Ramp",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				//to see if built
				if( Allied_Beach_Assault_Ramp_Built == true )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Gun",
						"DEFEND_Gun_1",
						"DEFEND_Gun_3",
						"DEFEND_Gun_4",
						"PLANT_Allied_Beach_Assault_Ramp",
						"SNIPE_Gun",
					});
				}
				//to see if Gun & Controls is destroyed
				if(Map.Gun_Controls_Dyno == 0 && Map.Gun_Dyno == 0)
				{
					SetAvailableMapGoals( TEAM.AXIS, false, {
						"DEFEND_Gun",
						"DEFEND_Gun_1",
						"DEFEND_Gun_3",
						"DEFEND_Gun_4",
					});
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"PLANT_Allied_Beach_Assault_Ramp",
						"SNIPE_Gun",
					});
				}
				Util.MapDebugPrint(GetEntName(ent) + " Allies Entered Assault_Ramp");
			}
		},
		OnExit = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				if(Map.Gun_Controls_Dyno == 0 && Map.Gun_Dyno == 0)
				{
					SetAvailableMapGoals( TEAM.AXIS, false, {
						"DEFEND_Gun",
						"DEFEND_Gun_1",
						"DEFEND_Gun_3",
						"DEFEND_Gun_4",
					});
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"PLANT_Allied_Beach_Assault_Ramp",
						"SNIPE_Gun",
					});
				}
				Util.MapDebugPrint(GetEntName(ent) + " Allies Exited Assault_Ramp");
			}
		},
	},

	//for Human Players going in Back Way
	BackPath =
	{
		Name="BackPath",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				//to see if built
				if( Map.Axis_South_East_MG_nest_Built == true )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"MOUNTMG42_Axis_South_East_MG_nest",
						"REPAIRMG42_Axis_South_East_MG_nest",
					});
				}
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rear_door.*" );

				Util.MapDebugPrint(GetEntName(ent) + " Allies Entered Back Path");
			}
			if(GetEntTeam(ent) == TEAM.AXIS)
			{
				Util.MapDebugPrint(GetEntName(ent) + " Axis Entered Back Path");
			}
		},
		OnExit = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				//to see if built
				if(Map.Axis_South_East_MG_nest_Built == true)
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"MOUNTMG42_Axis_South_East_MG_nest",
						"REPAIRMG42_Axis_South_East_MG_nest",
					});
				}
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_rear_door.*" );

				Util.MapDebugPrint(GetEntName(ent) + " Allies Exited Back Path");
			}
			if(GetEntTeam(ent) == TEAM.AXIS)
			{
				Util.MapDebugPrint(GetEntName(ent) + " Axis Exited Back Path");
			}
		},
	},
	BackTunnel =
	{
		Name="BackTunnel",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rear_door.*" );

				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Gun_6",
					"DEFEND_Gun_5",
					"DEFEND_Gun_2",
					"DEFEND_gc_flex",
					"DEFEND_gc_flex_5",
					"DEFEND_gc_flex_6",
				});

				Util.MapDebugPrint(GetEntName(ent) + " Allies Entered Back Tunnel");
			}
			if(GetEntTeam(ent) == TEAM.AXIS)
			{
				Util.MapDebugPrint(GetEntName(ent) + " Axis Entered Back Tunnel");
			}
		},
		OnExit = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rear_door.*" );
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Gun_6",
					"DEFEND_Gun_5",
					"DEFEND_Gun_2",
					"DEFEND_gc_flex",
					"DEFEND_gc_flex_5",
					"DEFEND_gc_flex_6",
				});

				Util.MapDebugPrint(GetEntName(ent) + " Allies Exited Back Tunnel");
			}
			if(GetEntTeam(ent) == TEAM.AXIS)
			{
				Util.MapDebugPrint(GetEntName(ent) + " Axis Exited Back Tunnel");
			}
		},
	},
	BackStairs =
	{
		Name="BackStairs",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rear_door.*" );

				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Gun_6",
					"DEFEND_Gun_5",
					"DEFEND_Gun_2",
					"DEFEND_gc_flex",
					"DEFEND_gc_flex_5",
					"DEFEND_gc_flex_6",
				});

				Util.MapDebugPrint(GetEntName(ent) + " Allies Entered Back Stairs");
			}
			if(GetEntTeam(ent) == TEAM.AXIS)
			{
				Util.MapDebugPrint(GetEntName(ent) + " Axis Entered Back Stairs");
			}
		},
		OnExit = function(ent)
		{
			if(GetEntTeam(ent) == TEAM.ALLIES)
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_rear_door.*" );
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Gun_6",
					"DEFEND_Gun_5",
					"DEFEND_Gun_2",
					"DEFEND_gc_flex",
					"DEFEND_gc_flex_5",
					"DEFEND_gc_flex_6",
				});

				Util.MapDebugPrint(GetEntName(ent) + " Allies Exited Back Stairs");
			}
			if(GetEntTeam(ent) == TEAM.AXIS)
			{
				Util.MapDebugPrint(GetEntName(ent) + " Axis Exited Back Stairs");
			}
		},
	},

	Command_Post_Built_Allied = function( trigger )
	{
		Map.CPStatus = 2;

		if ( !Map.doorcontrols ) {
			Util.ChangeSpawn( TEAM.ALLIES, 4, 4 ); // spawn up to 4 at cp
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ROUTE_CP",
				"AMMOCAB_eastbunker_ammocabinet",
				"HEALTHCAB_eastbunker_healthcabinet",
			});
		}

		Util.MapDebugPrint( "Command_Post_Built_Allied" );
	},

	Command_Post_Destroyed_Allied = function( trigger )
	{
		Map.CPStatus = 0;
		SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_CP" );
		Util.MapDebugPrint( "Command_Post_Destroyed_Allied" );
	},

	Command_Post_Built_Axis = function( trigger )
	{
		Map.CPStatus = 1;

		Util.MapDebugPrint( "Command_Post_Built_Axis" );
	},

	Command_Post_Destroyed_Axis = function( trigger )
	{
		Map.CPStatus = 0;
		Util.ChangeSpawn( TEAM.ALLIES, 5 );

		Util.MapDebugPrint( "Command_Post_Destroyed_Axis" );
	},

	Command_Post_Planted = function( trigger )
	{
		Map.Command_Post_Dyno += 1;

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );

		Util.MapDebugPrint( "Command_Post_Planted" );
	},

	Command_Post_Defused = function( trigger )
	{
		Map.Command_Post_Dyno -= 1;

		if ( Map.Command_Post_Dyno < 1 )
			{ SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Command_Post" ); }

		if ( Map.Command_Post_Dyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Command_Post" ); }

		Util.MapDebugPrint( "Command_Post_Defused" );
	},


	Allied_Beach_Assault_Ramp_Built = function( trigger )
	{
		Allied_Beach_Assault_Ramp_Built = true;
		Wp.SetWaypointFlag("beach_ramp","closed",false);
		Wp.SetWaypointFlag("beach_ramp_1","closed",false);
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"PLANT_Allied_Beach_Assault_Ramp",
			"DEFEND_ramp.*",
		});

		Util.MapDebugPrint( "Allied_Beach_Assault_Ramp_Built" );
	},

	Allied_Beach_Assault_Ramp_Planted = function( trigger )
	{
		Map.Allied_Beach_Assault_Ramp_Dyno += 1;
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Beach_Assault_Ramp" );
		Util.MapDebugPrint( "Allied_Beach_Assault_Ramp_Planted" );
	},

	Allied_Beach_Assault_Ramp_Defused = function( trigger )
	{
		Map.Allied_Beach_Assault_Ramp_Dyno -= 1;

		if ( Map.Allied_Beach_Assault_Ramp_Dyno < 1 )
			{ SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Allied_Beach_Assault_Ramp" ); }

		Util.MapDebugPrint( "Allied_Beach_Assault_Ramp_Defused" );
	},

	Allied_Beach_Assault_Ramp_Destroyed = function( trigger )
	{
		Map.Allied_Beach_Assault_Ramp_Dyno = 0;

		Wp.SetWaypointFlag("beach_ramp","closed",true);
		Wp.SetWaypointFlag("beach_ramp_1","closed",true);
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Gun",
			"DEFEND_Gun_1",
			"DEFEND_Gun_3",
			"DEFEND_Gun_4",
			"PLANT_Allied_Beach_Assault_Ramp",
			"SNIPE_Gun",
			"DEFEND_ramp.*",
		});
		Util.MapDebugPrint( "Allied_Beach_Assault_Ramp_Destroyed" );
	},

	Allied_East_beach_MG_nest_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"MOUNTMG42_Allied_East_beach_MG_nest",
			"REPAIRMG42_Allied_East_beach_MG_nest",
		});

		Util.MapDebugPrint( "Allied_East_beach_MG_nest_Built" );
	},

	Allied_East_beach_MG_nest_Planted = function( trigger )
	{
		Map.Allied_East_beach_MG_nest_Dyno += 1;

		Util.MapDebugPrint( "Allied_East_beach_MG_nest_Planted" );
	},

	Allied_East_beach_MG_nest_Defused = function( trigger )
	{
		Map.Allied_East_beach_MG_nest_Dyno -= 1;

		Util.MapDebugPrint( "Allied_East_beach_MG_nest_Defused" );
	},

	Allied_East_beach_MG_nest_Destroyed = function( trigger )
	{
		Map.Allied_East_beach_MG_nest_Dyno = 0;

		Util.MapDebugPrint( "Allied_East_beach_MG_nest_Destroyed" );
	},

	Allied_West_beach_MG_nest_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"MOUNTMG42_Allied_West_beach_MG_nest",
			"REPAIRMG42_Allied_West_beach_MG_nest",
		});

		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Built" );
	},

	Allied_West_beach_MG_nest_Planted = function( trigger )
	{
		Map.Allied_West_beach_MG_nest_Dyno += 1;

		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Planted" );
	},

	Allied_West_beach_MG_nest_Defused = function( trigger )
	{
		Map.Allied_West_beach_MG_nest_Dyno -= 1;

		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Defused" );
	},

	Allied_West_beach_MG_nest_Destroyed = function( trigger )
	{
		Map.Allied_West_beach_MG_nest_Dyno = 0;

		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Destroyed" );
	},

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

	Axis_Main_Bunker_MG_nest_Planted = function( trigger )
	{
		Map.Axis_Main_Bunker_MG_nest_Dyno += 1;

		Util.MapDebugPrint( "Axis_Main_Bunker_MG_nest_Planted" );
	},

	Axis_Main_Bunker_MG_nest_Defused = function( trigger )
	{
		Map.Axis_Main_Bunker_MG_nest_Dyno -= 1;

		Util.MapDebugPrint( "Axis_Main_Bunker_MG_nest_Defused" );
	},

	Axis_Main_Bunker_MG_nest_Destroyed = function( trigger )
	{
		Map.Axis_Main_Bunker_MG_nest_Dyno = 0;

		Util.MapDebugPrint( "Axis_Main_Bunker_MG_nest_Destroyed" );
	},

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

	Axis_North_West_MG_nest_Planted = function( trigger )
	{
		Map.Axis_North_West_MG_nest_Dyno += 1;

		Util.MapDebugPrint( "Axis_North_West_MG_nest_Planted" );
	},

	Axis_North_West_MG_nest_Defused = function( trigger )
	{
		Map.Axis_North_West_MG_nest_Dyno -= 1;

		Util.MapDebugPrint( "Axis_North_West_MG_nest_Defused" );
	},

	Axis_North_West_MG_nest_Destroyed = function( trigger )
	{
		Map.Axis_North_West_MG_nest_Dyno = 0;

		Util.MapDebugPrint( "Axis_North_West_MG_nest_Destroyed" );
	},

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

		Util.MapDebugPrint( "Axis_South_East_MG_nest_Built" );
	},

	Axis_South_East_MG_nest_Planted = function( trigger )
	{
		Map.Axis_South_East_MG_nest_Dyno += 1;

		Util.MapDebugPrint( "Axis_South_East_MG_nest_Planted" );
	},

	Axis_South_East_MG_nest_Defused = function( trigger )
	{
		Map.Axis_South_East_MG_nest_Dyno -= 1;

		Util.MapDebugPrint( "Axis_South_East_MG_nest_Defused" );
	},

	Axis_South_East_MG_nest_Destroyed = function( trigger )
	{
		Map.Axis_South_East_MG_nest_Dyno = 0;
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_Axis_South_East_MG_nest",
			"REPAIRMG42_Axis_South_East_MG_nest",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_South_East_MG_nest" );

		Util.MapDebugPrint( "Axis_South_East_MG_nest_Destroyed" );
	},

	Barricade_Built = function( trigger )
	{
		Map.Barricade = true;

                SetAvailableMapGoals( TEAM.ALLIES, true, {
                	"PLANT_Barricade",
                	"BUILD_Allied_West_Beach_MG_nest",
                	"BUILD_Allied_East_Beach_MG_nest",
                });
		SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_ramp" );

		Util.MapDebugPrint( "Barricade_Built" );
	},

	Barricade_Planted = function( trigger )
	{
		Map.Barricade_Dyno += 1;
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
		// focus on attacking the barricade
                SetAvailableMapGoals( TEAM.ALLIES, false, {
                	"BUILD_Command_Post",
                	"BUILD_Allied_East_Beach_MG_nest",
                	"BUILD_Allied_West_Beach_MG_nest",
                });
                SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Beach_.*" );

		Util.MapDebugPrint( "Barricade_Planted" );
	},

	Barricade_Defused = function( trigger )
	{
		Map.Barricade_Dyno -= 1;

		if ( Map.Barricade_Dyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" ); }

		Util.MapDebugPrint( "Barricade_Defused" );
	},

	Barricade_Destroyed = function( trigger )
	{
		Map.Barricade_Dyno = 0;

		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Radar_Station" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_ramp" );

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_Allied_Beach_Assault_Ramp",
			"PLANT_Command_Post",
			"PLANT_Gun",
			"PLANT_Gun_Controls",
			"PLANT_Generator",
			"PLANT_Radar_Station",
			"PLANT_Power_Supply_Door",
		});

		if( Map.flagstatus == 2 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Barricade" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
		}

		Util.MapDebugPrint( "Barricade_Destroyed" );
	},

	Generator_Built = function( trigger )
	{
		Map.doorcontrols = true;

                SetAvailableMapGoals( TEAM.ALLIES, false, {
                	"ROUTE_westdoor",
                	"ROUTE_eastdoor",
                	"DEFEND_GEN",
                	"PLANT_Power_Supply_Door",
                	"BUILD_Command_Post",
                });
		SetGoalPriority( "BUILD_Command_Post", 0.80, TEAM.ALLIES, CLASS.ENGINEER );

	        SetAvailableMapGoals( TEAM.AXIS, false, {
	        	"BUILD_Generator",
	        	"BUILD_Axis_South_East_MG_nest",
	        	"DEFEND_rear_door.*",
	        });

		if ( Map.Gun_Dyno < 1 && Map.Gun_controls_Dyno < 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gc_flex.*" );

			if ( Map.frontdoor )
				{ Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.AXIS); }
			else if ( Map.flagstatus == 2 )
				{ Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.ALLIES); }
			else
			{
				Map.Switches.FrontDoor.LimitTeam = 0;
				Map.Switches.FrontDoor_Enabled = false;
			}

			if ( Map.rightdoor )
				{ Map.Switches.RightDoor.LimitTeam = (1<<TEAM.AXIS); }
			else if ( Map.flagstatus == 2 )
				{ Map.Switches.RightDoor.LimitTeam = (1<<TEAM.ALLIES); }
			else
			{
				Map.Switches.RightDoor.LimitTeam = 0;
				Map.Switches.RightDoor_Enabled = false;
			}

			if ( Map.leftdoor )
				{ Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.AXIS); }
			else if ( Map.flagstatus == 2 )
				{ Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.ALLIES); }
			else
			{
				Map.Switches.LeftDoor.LimitTeam = 0;
				Map.Switches.LeftDoor_Enabled = false;
			}
		}

		Util.MapDebugPrint( "Generator_Built" );
	},

	Generator_Planted = function( trigger )
	{
                Map.Generator_Dyno += 1;

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

		Util.MapDebugPrint( "Generator_Planted" );
	},

	Generator_Defused = function( trigger )
	{
		Map.Generator_Dyno -= 1;

		if ( Map.Generator_Dyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Generator" ); }

		Util.MapDebugPrint( "Generator_Defused" );
	},

	Generator_Destroyed = function( trigger )
	{
		Map.doorcontrols = false;
		Map.Switches.FrontDoor.LimitTeam = 0;
		Map.Switches.LeftDoor.LimitTeam = 0;
		Map.Switches.RightDoor.LimitTeam = 0;
		Map.Switches.RightDoor_Enabled = false;
		Map.Switches.LeftDoor_Enabled = false;
		Map.Switches.FrontDoor_Enabled = false;

                SetAvailableMapGoals( TEAM.ALLIES, true, {
                	"ROUTE_westdoor",
                	"ROUTE_eastdoor",
                	"DEFEND_GEN",
                });
	        SetAvailableMapGoals( TEAM.AXIS, true, {
	        	"BUILD_Generator",
	        	"BUILD_Axis_South_East_MG_nest",
	        	"DEFEND_rear_door.*",
	        });

		SetAvailableMapGoals( 0, false, {
			"SWITCH_frontdoor",
			"SWITCH_leftdoor",
			"SWITCH_rightdoor",
		});

		if ( Map.CPStatus == 2 )
		{
			Util.ChangeSpawn( TEAM.ALLIES, 4, 4 ); // spawn up to 4 at cp
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_Power_Supply_Door",
				"ROUTE_CP",
			});
		}
		if ( Map.CPStatus == 0)
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
			SetGoalPriority( Map.Build_Command_Post, 0.99, TEAM.ALLIES, CLASS.ENGINEER );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_CP" );
		}
		if ( Map.Power_Supply_Door == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_hatchroute" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Power_Supply_Door" );
			SetGoalPriority( Map.Plant_Power_Supply_Door, 0.99, TEAM.ALLIES, CLASS.COVERTOPS );
		}
		if ( Map.Power_Supply_Door == false )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ROUTE_hatchroute",
				"PLANT_Power_Supply",
			});
			SetGoalPriority( Map.Plant_Power_Supply, 0.99, TEAM.ALLIES, CLASS.ENGINEER );
		}

		Util.MapDebugPrint( "Generator_Destroyed" );
	},

	Power_Supply_Door_Built = function( trigger )
	{
		Map.Power_Supply_Door = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ROUTE_hatchroute",
			"PLANT_Power_Supply",
		});

		if ( Map.doorcontrols == false && Map.CPStatus == 2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Power_Supply_Door" );
			SetGoalPriority( "PLANT_Power_Supply_Door", 0.99, TEAM.ALLIES, CLASS.COVERTOPS );
		}

		Util.MapDebugPrint( "Power_Supply_Door_Built" );
	},

	Power_Supply_Door_Planted = function( trigger )
	{
		Map.Power_Supply_Door_Dyno += 1;
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gc_flex_5" );

		Util.MapDebugPrint( "Power_Supply_Door_Planted" );
	},

	Power_Supply_Door_Defused = function( trigger )
	{
		Map.Power_Supply_Door_Dyno -= 1;
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_gc_flex_5" );

		if ( Map.doorcontrols == false && Map.CPStatus == 2 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Power_Supply_Door" );
		}

		Util.MapDebugPrint( "Power_Supply_Door_Defused" );
	},

	Power_Supply_Door_Destroyed = function( trigger )
	{
		Map.Power_Supply_Door_Dyno = 0;
		Map.Power_Supply_Door = false;

                SetAvailableMapGoals( TEAM.ALLIES, true, {
                	"ROUTE_hatchroute",
                	"PLANT_Power_Supply",
                });


		Util.MapDebugPrint( "Power_Supply_Door_Destroyed" );
	},

	Power_Supply_Planted = function( trigger )
	{
		Map.Power_Supply_Dyno += 1;
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_gc_flex",
			"DEFEND_gc_flex_5",
			"DEFEND_gc_flex_6",
		});

		Util.MapDebugPrint( "Power_Supply_Planted" );
	},

	Power_Supply_Defused = function( trigger )
	{
		Map.Power_Supply_Dyno -= 1;

		Util.MapDebugPrint( "Power_Supply_Defused" );
	},

	Power_Supply_Destroyed = function( trigger )
	{
		Map.Power_Supply_Dyno = 0;
		Map.Power = true;

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_gc_flex",
			"DEFEND_gc_flex_6",
			"BUILD_Power_Supply_Door",
			"SWITCH_hatch",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_hatch" );

		Util.MapDebugPrint( "Power_Supply_Destroyed" );
	},

	Gun_Planted = function( trigger )
	{
		Map.Gun_Dyno += 1;

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Gun" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Gun",
			"DEFEND_Gun_1",
			"DEFEND_Gun_3",
			"DEFEND_Gun_4",
		});

		Util.MapDebugPrint( "Gun_Planted" );
	},

	Gun_Defused = function( trigger )
	{
		Map.Gun_Dyno -= 1;
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Gun",
			"DEFEND_Gun_1",
			"DEFEND_Gun_3",
			"DEFEND_Gun_4",
		});

		if ( Map.Gun_Dyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Gun" ); }

		Util.MapDebugPrint( "Gun_Defused" );
	},

	Gun_Destroyed = function( trigger )
	{
		Map.Gun_Dyno = 0;

		if  ( Map.Gun_Controls_Dyno == 0 && Map.Gun_Dyno == 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_Gun",
				"DEFEND_Gun_1",
				"DEFEND_Gun_3",
				"DEFEND_Gun_4",
			});
			Map.Switches.RightDoor_Enabled = false;
			Map.Switches.LeftDoor_Enabled = false;
		}
		else
		{
			//defend incoming Allied_Beach_Assault_Ramp
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_Gun",
				"DEFEND_Gun_1",
			});

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

		}

		Util.MapDebugPrint( "Gun_Destroyed" );
	},

	Gun_Controls_Planted = function( trigger )
	{
		Map.Gun_Controls_Dyno += 1;

		SetAvailableMapGoals( TEAM.ALLIES, false, "Plant_Gun_Controls" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Gun",
			"DEFEND_Gun_1",
			"DEFEND_Gun_3",
			"DEFEND_Gun_4",
		});

		Util.MapDebugPrint( "Gun_Controls_Planted" );
	},

	Gun_Controls_Defused = function( trigger )
	{
		Map.Gun_Controls_Dyno -= 1;

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Gun",
			"DEFEND_Gun_1",
			"DEFEND_Gun_3",
			"DEFEND_Gun_4",
		});

		if ( Map.Gun_Controls_Dyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Gun_Controls" ); }

		Util.MapDebugPrint( "Gun_Controls_Defused" );
	},

	Gun_Controls_Destroyed = function( trigger )
	{
		Map.Gun_Controls_Dyno = 0;

		if  ( Map.Gun_Controls_Dyno == 0 && Map.Gun_Dyno == 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Gun.*" );
			Map.Switches.RightDoor_Enabled = false;
			Map.Switches.LeftDoor_Enabled = false;

		}
		else
		{
			//defend incoming Allied_Beach_Assault_Ramp
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_Gun",
				"DEFEND_Gun_1",
			});

			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_Gun",
				"PLANT_Generator",
				"PLANT_Radar_Station",
				"PLANT_Power_Supply_Door",
				"PLANT_Power_Supply",
			});
		}

		Util.MapDebugPrint( "Gun_Controls_Destroyed" );
	},

	Radar_Station_Planted = function( trigger )
	{
		Map.Radar_Station_Dyno += 1;

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Radar_Station" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_radar.*" );

		Util.MapDebugPrint( "Radar_Station_Planted" );
	},

	Radar_Station_Defused = function( trigger )
	{
		Map.Radar_Station_Dyno -= 1;
		if ( Map.Radar_Station_Dyno < 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Radar_Station" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANTMINE_radar.*" );
		}
		Util.MapDebugPrint( "Radar_Station_Defused" );
	},

	Radar_Station_Destroyed = function( trigger )
	{
		Map.Radar_Station_Dyno = 0;
                SetAvailableMapGoals( TEAM.ALLIES, true, {
                	"PLANT_Gun",
                	"PLANT_Gun_Controls",
                	"PLANT_Power_Supply_Door",
                	"PLANT_Generator",
                	"AMMOCAB_mainbunker_ammocabinet",
                	"HEALTHCAB_mainbunker_healthcabinet",
                });
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANTMINE_radar.*" );

		Util.MapDebugPrint( "Radar_Station_Destroyed" );
	},

	westbunker_flag_Axis_Captured = function( trigger )
	{
                Map.flagstatus = 1;
		Util.SetMaxUsers( 15, "CHECKPOINT_westbunker_flag" );
		Util.ChangeSpawn( TEAM.ALLIES, 3 );
		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Gun_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Beach_.*",
			"BUILD_Allied_West_beach_MG_nest",
			"BUILD_Allied_East_beach_MG_nest",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNTMG42_Allied_West_beach_MG_nest",
			"MOUNTMG42_Allied_East_beach_MG_nest",
			"REPAIRG42_Allied_West_beach_MG_nest",
			"REPAIRMG42_Allied_East_beach_MG_nest",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMORTAR_bUpperBunker1" );
		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Gun_.*",
			"DEFEND_gc_flex.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Flag_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_westbunker_mg42_1",
			"MOUNTMG42_westbunker_mg42_2",
			"REPAIR42_westbunker_mg42_1",
			"REPAIR42_westbunker_mg42_2",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"CALLARTILLERY.*",
			"ARTILLERY_S.*",
			"MOBILEMORTAR_ramp",
			"BUILD_Barricade",
		});


		if ( Map.Barricade  )
			{ SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Generator" ); }

		if ( Map.frontdoor && Map.GunDyno < 1 && Map.doorcontrols )
		{
			// Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.AXIS);
			// Util.LimitToTeam( TEAM.AXIS, "SWITCH_frontdoor" );
		}
		else
		{
			Map.Switches.FrontDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_frontdoor" );
		}

		if ( Map.leftdoor && Map.doorcontrols )
		{
			Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitToTeam( TEAM.AXIS, "SWITCH_leftdoor" );
		}
		else
		{
			Map.Switches.LeftDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_leftdoor" );
		}

		if ( Map.rightdoor && Map.doorcontrols )
		{
			Map.Switches.RightDoor.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitToTeam( TEAM.AXIS, "SWITCH_rightdoor" );
		}
		else
		{
			Map.Switches.RightDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_rightdoor" );
		}

		if ( Map.HatchStatus == false) //closed
		{
			Map.Switches.hatch.LimitTeam = (1<<TEAM.ALLIES);
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_hatch" );
		}
		else if ( Map.HatchStatus == true) //open
		{
			Map.Switches.hatch.LimitTeam = (1<<TEAM.AXIS);
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_hatch" );
		}

		Util.MapDebugPrint( "westbunker_flag_Axis_Captured" );
	},

	westbunker_flag_Allies_Captured = function( trigger )
	{
                Map.flagstatus = 2;
		Util.SetMaxUsers( 2, "CHECKPOINT_westbunker_flag" );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Beach_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Gun_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"BUILD_Allied_West_beach_MG_nest",
			"BUILD_Allied_East_beach_MG_nest",
			"MOUNTMG42_Allied_West_beach_MG_nest",
			"MOUNTMG42_Allied_East_beach_MG_nest",
			"MOUNTMG42_Axis_Main_Bunker_MG_nest",
			"REPAIRMG42_Allied_West_beach_MG_nest",
			"REPAIRMG42_Allied_East_beach_MG_nest",
			"REPAIRMG42_Axis_Main_Bunker_MG_nest",
		});
                SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Radar_Station" );
                SetAvailableMapGoals( TEAM.ALLIES, false, {
                	"SNIPE_.*",
                	"GRENADE_bunker.*",
                	"MOBILEMORTAR_bUpperBunker1",
                });

		//make sure they spawn at flag
		Util.ChangeSpawn( TEAM.ALLIES, 5 );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Gun_.*",
			"MOUNTMG42_Axis_Main_Bunker_MG_nest",
			"REPAIRMG42_Axis_Main_Bunker_MG_nest",
		});
		if ( Map.Gun_Dyno < 1 && Map.Gun_Controls_Dyno < 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_gc_flex.*" );
		}
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Flag_.*",
			"MOUNTMG42_westbunker_mg42_1",
			"MOUNTMG42_westbunker_mg42_2",
			"REPAIRMG42_westbunker_mg42_1",
			"REPAIRMG42_westbunker_mg42_2",
			"CALLARTILLERY.*",
			"ARTILLERY_S.*",
			"ROUTE_Gunpatrol.*",
			"MOBILEMORTAR_ramp",
			"BUILD_Barricade",
		});

		if ( Map.frontdoor && Map.GunDyno < 1 && Map.doorcontrols )
		{
			// Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.AXIS);
			// Util.LimitToTeam( TEAM.AXIS, "SWITCH_frontdoor" );
		}
		else if( !Map.frontdoor && Map.doorcontrols )
		{
			Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitToTeam( TEAM.ALLIES, "SWITCH_frontdoor" );
		}
		else
		{
			Map.Switches.FrontDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_frontdoor" );
		}

		if ( Map.leftdoor && Map.doorcontrols )
		{
			Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitToTeam( TEAM.AXIS, "SWITCH_leftdoor" );
		}
		else if ( !Map.leftdoor && Map.doorcontrols )
		{
			Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitToTeam( TEAM.ALLIES, "SWITCH_leftdoor" );
		}
		else
		{
			Map.Switches.LeftDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_leftdoor" );
		}

		if ( Map.rightdoor && Map.doorcontrols )
		{
			Map.Switches.RightDoor.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitToTeam( TEAM.AXIS, "SWITCH_rightdoor" );
		}
		else if ( !Map.rightdoor && Map.doorcontrols )
		{
			Map.Switches.RightDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitToTeam( TEAM.ALLIES, "SWITCH_rightdoor" );
		}
		else
		{
			Map.Switches.RightDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_rightdoor" );
		}

		if ( Map.HatchStatus == false) //closed
		{
			Map.Switches.hatch.LimitTeam = (1<<TEAM.ALLIES);
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_hatch" );
		}
		else if ( Map.HatchStatus == true) //open
		{
			Map.Switches.hatch.LimitTeam = (1<<TEAM.AXIS);
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_hatch" );
		}

		WeaponTable.SetWeaponAvailability(CLASS.COVERTOPS, WEAPON.FG42, false);

		Util.MapDebugPrint( "westbunker_flag_Allies_Captured" );
	},

	front_door_lever = function( trigger )
	{
		//as soon as they trigger it, turn it off
		//so they only hit it once.
		Map.Switches.FrontDoor.LimitTeam = 0;
		SetAvailableMapGoals( 0, false, "SWITCH_frontdoor" );
		Util.MapDebugPrint( "front_door_lever", true );
	},

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

		//set status based on direction
		if ( vel[1] < 0 )
		{
			Map.frontdoor = false;
			Util.DisableGoal("ROUTE_fdoor_route");
			Util.MapDebugPrint("front door closing", true);
		}
		else if ( vel[1] > 0 )
		{
			Map.frontdoor = true;
			Util.EnableGoal("ROUTE_fdoor_route");
			Util.MapDebugPrint("front door opening", true);
		}

		//set availability based on status'
		if ( Map.GunDyno < 1 && Map.doorcontrols && Map.frontdoor )
		{
			// Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.AXIS);
			// Util.LimitToTeam( TEAM.AXIS, "SWITCH_frontdoor" );
		}
		else if ( Map.flagstatus == 2 && !Map.frontdoor )
		{
			Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitToTeam( TEAM.ALLIES, "SWITCH_frontdoor" );
		}
		else
		{
			Map.Switches.FrontDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_frontdoor" );
		}

		Util.MapDebugPrint( "front_door_right", true );
	},

	left_door_lever = function( trigger )
	{
		Map.Switches.LeftDoor.LimitTeam = 0;
		SetAvailableMapGoals( 0, false, "SWITCH_leftdoor" );
		Util.MapDebugPrint( "left_door_lever", true );
	},

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

		if ( vel[1] > 0 )
		{
			Map.leftdoor = false;
			Util.MapDebugPrint("left door closing", true);
		}
		else if ( vel[1] < 0 )
		{
			Map.leftdoor = true;
			Util.MapDebugPrint("left door opening", true);
		}

		if ( Map.doorcontrols && Map.leftdoor )
		{
			Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitToTeam( TEAM.AXIS, "SWITCH_leftdoor" );
		}
		else if ( Map.flagstatus == 2 && !Map.leftdoor )
		{
			Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitToTeam( TEAM.ALLIES, "SWITCH_leftdoor" );
		}
		else
		{
			Map.Switches.LeftDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_leftdoor" );
		}

		Util.MapDebugPrint( "left_door_right", true );
	},

	right_door_lever = function( trigger )
	{
		Map.Switches.RightDoor.LimitTeam = 0;
		SetAvailableMapGoals( 0, false, "SWITCH_rightdoor" );
		Util.MapDebugPrint( "right_door_lever", true );
	},

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

		if ( vel[1] < 0 )
		{
			Map.rightdoor = false;
			Util.MapDebugPrint("right door closing", true);
		}
		else if ( vel[1] > 0 )
		{
			Map.rightdoor = true;
			Util.MapDebugPrint("right door opening", true);
		}

		if ( Map.doorcontrols && Map.rightdoor )
		{
			Map.Switches.RightDoor.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitToTeam( TEAM.AXIS, "SWITCH_rightdoor" );
		}
		else if ( Map.flagstatus == 2 && !Map.rightdoor )
		{
			Map.Switches.RightDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitToTeam( TEAM.ALLIES, "SWITCH_rightdoor" );
		}
		else
		{
			Map.Switches.RightDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_rightdoor" );
		}

		Util.MapDebugPrint( "right_door_right", true );
	},

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

		//set status based on direction
		if ( vel.z > 0 )
		{
			Map.HatchStatus = false; //closed

			if ( Map.Power_Supply_Door == true ) //Built
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_hatchroute" );
				SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_hatch" );
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_hatch" );
				SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Power_Supply" );
				SetGoalPriority( "PLANT_Power_Supply", 0.83, TEAM.ALLIES, CLASS.ENGINEER );
			}
			if( Map.Power_Supply_Door == false ) //Distoryed
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_hatch" );
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_hatch" );
				SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_hatchroute" );
				SetGoalPriority( "PALNT_Power_Supply", 0.99, TEAM.ALLIES, CLASS.ENGINEER );
				SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Power_Supply_Door" );
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Power_Supply" );
			}
			Wp.SetWaypointFlag( "Base Hatch 1", "closed", true );
			Wp.SetWaypointFlag( "Base Hatch 2", "closed", true );
			Wp.SetWaypointFlag( "basehatch", "closed", true );

			Util.MapDebugPrint("Hatch Closed", true);
		}
		else if ( vel.z < 0 )
		{
			Map.HatchStatus = true; //open

			SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_hatchroute" );
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_hatch" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_hatch" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Power_Supply" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Power_Supply_Door" );
			SetGoalPriority( "PALNT_Power_Supply", 0.99, TEAM.ALLIES, CLASS.ENGINEER );
			Wp.SetWaypointFlag( "Base Hatch 1", "closed", false );
			Wp.SetWaypointFlag( "Base Hatch 2", "closed", false );
			Wp.SetWaypointFlag( "basehatch", "closed", false );

			Util.MapDebugPrint("Hatch Opened", true);
		}
	},
};

global OnMapLoad = function()
{
	Util.SetGoalPosition( 640.000,-3592.000,1108.000, "PLANT_Radar_Station" );
	Util.SetGoalPosition( 3424.000,-4672.000,762.000, "PLANT_Power_Supply" );
	Util.SetGoalPosition( 1820, -2801, 883, "PLANT_Barricade" );
	Util.DisableGoal("REPAIRMG42_.*");

	// Register callback functions
	OnTrigger( "The Allied Beach Assault Ramp has been constructed.", Map.Allied_Beach_Assault_Ramp_Built );
	OnTrigger( "The Allied East beach MG Nest has been constructed.", Map.Allied_East_beach_MG_nest_Built );
	OnTrigger( "The Allied West beach MG Nest has been constructed.", Map.Allied_West_beach_MG_nest_Built );
	OnTrigger( "The Axis Main Bunker MG Nest has been constructed.", Map.Axis_Main_Bunker_MG_nest_Built );
	OnTrigger( "The Axis North-West MG Nest has been constructed.", Map.Axis_North_West_MG_nest_Built );
	OnTrigger( "The Axis South-East MG Nest has been constructed.", Map.Axis_South_East_MG_nest_Built );
	OnTrigger( "Axis have built the beach Barricade!", Map.Barricade_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Command_Post_Built_Axis );
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built_Allied );
	OnTrigger( "Axis have constructed the Door Controls Generator!", Map.Generator_Built );
	OnTrigger( "The Axis have built the door to the Power Supply room!", Map.Power_Supply_Door_Built );
	OnTrigger( "Planted at the Allied Beach Assault Ramp.", Map.Allied_Beach_Assault_Ramp_Planted );
	OnTrigger( "Planted at the Allied East beach MG nest.", Map.Allied_East_beach_MG_nest_Planted );
	OnTrigger( "Planted at the Allied West beach MG nest.", Map.Allied_West_beach_MG_nest_Planted );
	OnTrigger( "Planted at the Axis Main Bunker MG nest.", Map.Axis_Main_Bunker_MG_nest_Planted );
	OnTrigger( "Planted at the Axis North-West MG nest.", Map.Axis_North_West_MG_nest_Planted );
	OnTrigger( "Planted at the Axis South-East MG nest.", Map.Axis_South_East_MG_nest_Planted );
	OnTrigger( "Planted at the Barricade.", Map.Barricade_Planted );
	OnTrigger( "Planted at the Command Post.", Map.Command_Post_Planted );
	OnTrigger( "Planted at the Generator.", Map.Generator_Planted );
	OnTrigger( "Planted at the Gun.", Map.Gun_Planted );
	OnTrigger( "Planted at the Gun Controls.", Map.Gun_Controls_Planted );
	OnTrigger( "Planted at the Power Supply.", Map.Power_Supply_Planted );
	OnTrigger( "Planted at the Power Supply Door.", Map.Power_Supply_Door_Planted );
	OnTrigger( "Planted at the Radar Station.", Map.Radar_Station_Planted );
	OnTrigger( "Defused at the Allied Beach Assault Ramp.", Map.Allied_Beach_Assault_Ramp_Defused );
	OnTrigger( "Defused at the Allied East beach MG nest.", Map.Allied_East_beach_MG_nest_Defused );
	OnTrigger( "Defused at the Allied West beach MG nest.", Map.Allied_West_beach_MG_nest_Defused );
	OnTrigger( "Defused at the Axis Main Bunker MG nest.", Map.Axis_Main_Bunker_MG_nest_Defused );
	OnTrigger( "Defused at the Axis North-West MG nest.", Map.Axis_North_West_MG_nest_Defused );
	OnTrigger( "Defused at the Axis South-East MG nest.", Map.Axis_South_East_MG_nest_Defused );
	OnTrigger( "Defused at the Barricade.", Map.Barricade_Defused );
	OnTrigger( "Defused at the Command Post.", Map.Command_Post_Defused );
	OnTrigger( "Defused at the Generator.", Map.Generator_Defused );
	OnTrigger( "Defused at the Gun.", Map.Gun_Defused );
	OnTrigger( "Defused at the Gun Controls.", Map.Gun_Controls_Defused );
	OnTrigger( "Defused at the Power Supply.", Map.Power_Supply_Defused );
	OnTrigger( "Defused at the Power Supply Door.", Map.Power_Supply_Door_Defused );
	OnTrigger( "Defused at the Radar Station.", Map.Radar_Station_Defused );
	OnTrigger( "Axis have destroyed the Allied Beach Assault Ramp.", Map.Allied_Beach_Assault_Ramp_Destroyed );
	OnTrigger( "The Allied East beach MG Nest has been destroyed.", Map.Allied_East_beach_MG_nest_Destroyed );
	OnTrigger( "The Allied West beach MG Nest has been destroyed.", Map.Allied_West_beach_MG_nest_Destroyed );
	OnTrigger( "The Axis Main Bunker MG Nest has been destroyed.", Map.Axis_Main_Bunker_MG_nest_Destroyed );
	OnTrigger( "The Axis North-West MG Nest has been destroyed.", Map.Axis_North_West_MG_nest_Destroyed );
	OnTrigger( "The Axis South-East MG Nest has been destroyed.", Map.Axis_South_East_MG_nest_Destroyed );
	OnTrigger( "Allies have destroyed the beach Barricade!", Map.Barricade_Destroyed );
	OnTrigger( "Allied team has destroyed the Door Controls Generator!", Map.Generator_Destroyed );
	OnTrigger( "The Allies have destroyed the Gun!", Map.Gun_Destroyed );
	OnTrigger( "Allies have destroyed the gun tracking", Map.Gun_Controls_Destroyed );
	OnTrigger( "The Allies have destroyed the Power Supply!", Map.Power_Supply_Destroyed );
	OnTrigger( "The Allies have destroyed the door to the Power Supply room!", Map.Power_Supply_Door_Destroyed );
	OnTrigger( "The Allies have destroyed the Radar Station!", Map.Radar_Station_Destroyed );
	OnTrigger( "Axis capture the West Bunker!", Map.westbunker_flag_Axis_Captured );
	OnTrigger( "Allies capture the Forward Bunker!", Map.westbunker_flag_Allies_Captured );
	OnTrigger( "frontdoor_right_goto", Map.front_door_right );
	OnTrigger( "leftdoor_right_goto", Map.left_door_right );
	OnTrigger( "rightdoor_right_goto", Map.right_door_right );
	OnTrigger( "frontdoor_lever1_goto", Map.front_door_lever );
	OnTrigger( "leftdoor_lever1_goto", Map.left_door_lever );
	OnTrigger( "rightdoor_lever1_goto", Map.right_door_lever );
	OnTrigger( "hatch_start", Map.hatch_start );

	Util.DisableGoal( ".*", true ); // all but routes

	Util.DisableGoal("ROUTE_fdoor_route");
	Util.DisableGoal("ROUTE_CP" );

	Wp.SetWaypointFlag("beach_ramp","closed",true);
	Wp.SetWaypointFlag("beach_ramp_1","closed",true);

	Util.AddUseWp("PLANT_Gun_Controls", "Gun_Con_1");
	Util.AddUseWp("PLANT_Gun_Controls", "Gun_Con_2");
	Util.AddUseWp("PLANT_Gun_Controls", "Gun_Con_3");
	Util.AddUseWp("PLANT_Gun", "Main_Gun");
	Util.AddUseWp("PLANT_Gun", "Main_Gun_1");
	Util.AddUseWp("PLANT_Gun", "Main_Gun_3");
	Util.AddUseWp("PLANT_Power_Supply", "PW_1");
	Util.AddUseWp("PLANT_Power_Supply", "PW_2");
	Util.AddUseWp("PLANT_Power_Supply", "PW_3");
	Util.AddUseWp("PLANT_Power_Supply", "PW_4");
	Util.AddUseWp("PLANT_Power_Supply", "PW_5");
	Util.AddUseWp("PLANT_Allied_Beach_Assault_Ramp", "beach_ramp_1");
	Util.AddUseWp("PLANT_Radar_Station", "radar");
	Util.AddUseWp("PLANT_Radar_Station", "radar_1");
	Util.AddUseWp("PLANT_Radar_Station", "radar_2");
	Util.AddUseWp("PLANT_Radar_Station", "radar_3");
	Util.AddUseWp("PLANT_Power_Supply_Door", "PWSD");
// Max users per goal
	Util.SetMaxUsers( 2, "ATTACK.*" );
	Util.SetMaxUsers( 2, "CHECKPOINT_westbunker_flag" );
	Util.SetMaxUsers( 1, "DEFEND.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "BUILD_.*" );
	Util.SetMaxUsers( 1, "PLANT_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );

	SetMapGoalProperties( "ATTACK_.*", {mincamptime=30, maxcamptime=45});
	SetMapGoalProperties( "DEFEND_.*", {mincamptime=60, maxcamptime=120});
	SetMapGoalProperties( "MOUNTMG42_.*", {mincamptime=60, maxcamptime=120});
	SetMapGoalProperties( "SNIPE_.*", {mincamptime=60, maxcamptime=120});
	SetGoalPriority( "SWITCH_.*", 0.65 );
// Allied goals
	SetGoalPriority( "PLANT_Barricade", 0.81, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Barricade", 0.84, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Radar_Station", 0.83, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Power_Supply", 0.83, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Power_Supply_Door", 0.83, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Gun_Controls", 0.84, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Gun", 0.85, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Allied_Beach_Assault_Ramp", 0.93, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Allied_West_beach_MG_nest", 0.92, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Allied_East_beach_MG_nest", 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Command_Post", 0.80, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Generator", 0.85, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Axis_North_West_MG_nest", 0.82, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Axis_Main_Bunker_MG_nest", 0.81, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Axis_South_East_MG_nest", 0.80, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "GRENADE_bunker", 0.70, TEAM.ALLIES);
	SetGoalPriority( "GRENADE_bunker_1", 0.70, TEAM.ALLIES);
	SetGoalPriority( "MOUNTMG42_.*", 0.0, TEAM.ALLIES, CLASS.MEDIC );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, TEAM.ALLIES, CLASS.COVERTOPS);

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ATTACK_Beach_.*",
		"BUILD_Allied_Beach_Assault_Ramp",
		"BUILD_Allied_West_beach_MG_nest",
		"BUILD_Allied_East_beach_MG_nest",
		"PLANT_Barricade",
		"PLANT_Command_Post",
		"PLANT_Gun",
		"PLANT_Gun_Controls",
		"PLANT_Generator",
		"PLANT_Radar_Station",
		"PLANT_Power_Supply_Door",
		"PLANT_Power_Supply",
		"GRENADE_bunker.*",
		"SWITCH_hatch",
		"MOBILEMORTAR_bUpperBunker1",
		"CHECKPOINT_westbunker_flag",
	});
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"MOBILEMORTAR_ramp",
		"REPAIRMG42_.*",
	});

// Axis goals
	SetGoalPriority( "BUILD_Barricade", 0.96, TEAM.AXIS );
	SetGoalPriority( "BUILD_Generator", 0.96, TEAM.AXIS );
	SetGoalPriority( "BUILD_Axis_South_East_MG_nest", 0.94, TEAM.AXIS );
	SetGoalPriority( "BUILD_Axis_North_West_MG_nest", 0.91, TEAM.AXIS );
	SetGoalPriority( "BUILD_Command_Post", 0.90, TEAM.AXIS );
	SetGoalPriority( "BUILD_Power_Supply_Door", 0.93, TEAM.AXIS );
	SetGoalPriority( "BUILD_Axis_Main_Bunker_MG_nest", 0.92, TEAM.AXIS );
	SetGoalPriority( "PLANT_Command_Post", 0.90, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "DEFEND_ramp.*", 0.00, TEAM.AXIS, CLASS.SOLDIER );
	SetGoalPriority( "PLANT_Allied_Beach_Assault_Ramp", 0.50, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Allied_Beach_Assault_Ramp", 0.96, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "SNIPE_.*", 0.95, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, TEAM.AXIS, CLASS.MEDIC );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, TEAM.AXIS, CLASS.COVERTOPS);
	SetGoalPriority( "DEFUSE_Gun_.*", 1.10, TEAM.AXIS, CLASS.ENGINEER, true);
	SetGoalPriority( "DEFUSE_Gun_Controls_.*", 1.10, TEAM.AXIS, CLASS.ENGINEER, true);
	SetGoalPriority( "DEFUSE_Radar_Station_.*", 1.10, TEAM.AXIS, CLASS.ENGINEER, true);
	SetGoalPriority( "DEFUSE_Power_Supply_.*", 1.10, TEAM.AXIS, CLASS.ENGINEER, true);
	SetGoalPriority( "DEFUSE_Power_Supply_Door_.*", 1.00, TEAM.AXIS, CLASS.ENGINEER, true);

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"AMMOCAB_mainbunker_ammocabinet",
		"HEALTHCAB_mainbunker_healthcabinet",
		"DEFEND_Flag_.*",
		"BUILD_Barricade",
		"BUILD_Axis_South_East_MG_nest",
		"BUILD_Axis_North_West_MG_nest",
		"BUILD_Axis_Main_Bunker_MG_nest",
		"BUILD_Power_Supply_Door",
		"PLANT_Allied_Beach_Assault_Ramp",
		"SNIPE_Gun",
		"DEFEND_Gun",
		"DEFEND_Gun_1",
		"SWITCH_hatch",
		"MOUNTMG42_Axis_Main_Bunker_MG_nest",
		"MOUNTMG42_Axis_North_West_MG_nest",
		"MOUNTMG42_Axis_South_East_MG_nest",
		"MOUNTMG42_westbunker_mg42_1",
		"MOUNTMG42_westbunker_mg42_2",
		"REPAIRMG42_Axis_Main_Bunker_MG_nest",
		"REPAIRMG42_Axis_North_West_MG_nest",
		"REPAIRMG42_Axis_South_East_MG_nest",
		"REPAIRMG42_westbunker_mg42_1",
		"REPAIRMG42_westbunker_mg42_2",
		"MOBILEMORTAR_ramp",
		"CHECKPOINT_westbunker_flag",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_bUpperBunker1" );

// trigger to let defending bots know to go after flag
	tOne = OnTriggerRegion(Vector3(2336,-4161,920), 200, Map.BaseTrigger);
// Back Way
	BackPath = OnTriggerRegion(AABB(3936.262,-3211.632,1103.525,4825.469,-2535.125,1217.985),Map.BackPath);
	BackTunnel = OnTriggerRegion(AABB(3899.481,-4124.875,890.505,4226.562,-4003.125,1091.574),Map.BackTunnel);
	BackStairs = OnTriggerRegion(AABB(3782.084,-4856.874,897.125,4045.895,-4190.358,1099.125),Map.BackStairs);
// Allied_Beach_Assault_Ramp
	ramp = OnTriggerRegion(AABB(3070.153,-1925.497,505.125,3114.360,-1419.575,1125.931),Map.Assault_Ramp);
// Switches
	Util.UpdateSwitchData();
// Set up Routing

	MapRoutes =
	{
		PLANT_Gun_Controls =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_fdoor_route =
				{
					ROUTE_hatchroute =
					{
						ROUTE_hatchroute2 =
						{
							ROUTE_eastdoor = {},
							ROUTE_westdoor = {},
							ROUTE_weststairs =
							{
								ROUTE_westladder = {},
								ROUTE_eastladder = {},
							},
						},
					},
					ROUTE_southstairs =
					{
						ROUTE_guntop =
						{
							ROUTE_westladder = {},
							ROUTE_eastladder = {},
						},
					},
				},
				ROUTE_radar_route =
				{
					ROUTE_hatchroute =
					{
						ROUTE_hatchroute2 =
						{
							ROUTE_eastdoor = {},
							ROUTE_westdoor = {},
							ROUTE_weststairs =
							{
								ROUTE_westladder = {},
								ROUTE_eastladder = {},
							},
						},
					},
					ROUTE_southstairs =
					{
						ROUTE_guntop =
						{
							ROUTE_westladder = {},
							ROUTE_eastladder = {},
						},
					},
				},
			},
		},
		PLANT_Gun =
		{
			ROUTE_FlagSpawn =
			{
				ROUTE_fdoor_route =
				{
					ROUTE_hatchroute =
					{
						ROUTE_hatchroute2 =
						{
							ROUTE_eastdoor = {},
							ROUTE_westdoor = {},
							ROUTE_weststairs =
							{
								ROUTE_westladder = {},
								ROUTE_eastladder = {},
							},
						},
					},
					ROUTE_southstairs =
					{
						ROUTE_guntop =
						{
							ROUTE_westladder = {},
							ROUTE_eastladder = {},
						},
					},
				},
				ROUTE_radar_route =
				{
					ROUTE_hatchroute =
					{
						ROUTE_hatchroute2 =
						{
							ROUTE_eastdoor = {},
							ROUTE_westdoor = {},
							ROUTE_weststairs =
							{
								ROUTE_westladder = {},
								ROUTE_eastladder = {},
							},
						},
					},
					ROUTE_southstairs =
					{
						ROUTE_guntop =
						{
							ROUTE_westladder = {},
							ROUTE_eastladder = {},
						},
					},
				},
			},
		},
		DEFEND_Gun_3 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_hatchroute =
				{
					ROUTE_hatchroute2 =
					{
						ROUTE_eastdoor = {},
						ROUTE_westdoor = {},
						ROUTE_weststairs =
						{
							ROUTE_westladder = {},
							ROUTE_eastladder = {},
						},
					},
				},
				ROUTE_southstairs =
				{
					Weight = 2,
					ROUTE_southstairs2 = { Weight = 2, },
					ROUTE_guntop = {},
				},
			},
		},
		MOUNTMG42_Axis_Main_Bunker_MG_nest =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_gunpatrol = { ROUTE_gunpatrol2 = {}, },
				ROUTE_gunpatrol2 = { ROUTE_gunpatrol = {}, },
			},
		},
		DEFEND_Flag_5 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_flagroute = { Weight = 3 },
				ROUTE_gunpatrol = {},
				ROUTE_southstairs =
				{
					ROUTE_guntop = { ROUTE_guntop = {}, },
				},
			},
		},
		BUILD_Generator =
		{
			ROUTE_AxisSpawn  =
			{
				ROUTE_E5_stairs  =
				{
				},
				ROUTE_southstairs  =
				{
					ROUTE_E5_stairs  =
					{
					},
					ROUTE_southstairs_bot  =
					{
						ROUTE_E5_stairs  =
						{
						},
					},
				},
			},
			ROUTE_FlagSpawn  =
			{
				ROUTE_weststairs2  =
				{
					ROUTE_weststairs  =
					{
						ROUTE_hatchroute2  =
						{
							ROUTE_rear_door  =
							{
							},
						},
					},
					ROUTE_southstairs2  =
					{
						ROUTE_E5_stairs  =
						{
						},
					},
				},
				ROUTE_radar_route  =
				{
					ROUTE_fdoor_route  =
					{
						ROUTE_E5_stairs  =
						{
						},
					},
				},
			},
		},
		PLANT_Power_Supply =
		{
			ROUTE_CP  =
			{
				ROUTE_rear_door  =
				{
					ROUTE_hatchroute  =
					{
					},
					ROUTE_E5_stairs  =
					{
						ROUTE_hatchroute  =
						{
						},
					},
				},
			},
			ROUTE_FlagSpawn  =
			{
				ROUTE_radar_route  =
				{
					ROUTE_flagroute  =
					{
						ROUTE_southstairs_bot  =
						{
							ROUTE_hatchroute  =
							{
							},
							ROUTE_E5_stairs  =
							{
								ROUTE_rear_door  =
								{
									ROUTE_hatchroute  =
									{
									},
								},
							},
						},
					},
				},
				ROUTE_fdoor_route  =
				{
					ROUTE_flagroute  =
					{
						ROUTE_southstairs_bot  =
						{
							ROUTE_hatchroute  =
							{
							},
							ROUTE_E5_stairs  =
							{
								ROUTE_rear_door  =
								{
									ROUTE_hatchroute  =
									{
									},
								},
							},
						},
					},
				},
			},
		},

	};

	// copy some routes
	MapRoutes.ATTACK_Gun_1 = MapRoutes.PLANT_Gun_Controls;
	MapRoutes.ATTACK_Gun_2 = MapRoutes.PLANT_Gun_Controls;
	MapRoutes.ATTACK_Gun_3 = MapRoutes.PLANT_Gun_Controls;
	MapRoutes.ATTACK_Gun_4 = MapRoutes.PLANT_Gun_Controls;
	MapRoutes.ATTACK_Gun_5 = MapRoutes.PLANT_Gun_Controls;
	MapRoutes.ATTACK_Gun_1 = MapRoutes.PLANT_Gun;
	MapRoutes.ATTACK_Gun_2 = MapRoutes.PLANT_Gun;
	MapRoutes.ATTACK_Gun_3 = MapRoutes.PLANT_Gun;
	MapRoutes.ATTACK_Gun_4 = MapRoutes.PLANT_Gun;
	MapRoutes.ATTACK_Gun_5 = MapRoutes.PLANT_Gun;
	MapRoutes.DEFEND_Gun_4 = MapRoutes.DEFEND_Gun_3;
	MapRoutes.DEFEND_Gun_5 = MapRoutes.DEFEND_Gun_3;
	MapRoutes.DEFEND_Gun_6 = MapRoutes.DEFEND_Gun_3;
	MapRoutes.DEFEND_Gun_7 = MapRoutes.DEFEND_Gun_3;
	MapRoutes.MOUNTMG42_westbunker_mg42_1 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.MOUNTMG42_westbunker_mg42_2 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.MOUNTMG42_eastbunker_mg42_2 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.MOUNTMG42_Axis_North_West_MG_nest = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.MOUNTMG42_Axis_South_East_MG_nest = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.MOUNTMG42_eastbunker_mg42_1 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.BUILD_Generator = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.BUILD_Generator = MapRoutes.DEFEND_rear_door;
	MapRoutes.BUILD_Generator = MapRoutes.DEFEND_rear_door_1;
	MapRoutes.BUILD_Generator = MapRoutes.DEFEND_rear_door_2;
	MapRoutes.BUILD_Generator = MapRoutes.DEFEND_rear_door_3;
	MapRoutes.BUILD_Axis_Main_Bunker_MG_nest = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.BUILD_Axis_South_East_MG_nest = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.BUILD_Axis_North_West_MG_nest = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.DEFEND_Flag_6 = MapRoutes.DEFEND_Flag_5;
	MapRoutes.DEFEND_Flag_7 = MapRoutes.DEFEND_Flag_5;
	MapRoutes.DEFEND_Flag_8 = MapRoutes.DEFEND_Flag_5;
	MapRoutes.DEFEND_Flag_9 = MapRoutes.DEFEND_Flag_5;

	Util.Routes(MapRoutes);

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

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 90.0;
	team = bot.GetTeam();
	class = bot.GetClass();

	team = bot.GetTeam();

	// default spawn
	if ( team == TEAM.ALLIES ) {
		if ( Map.flagstatus == 2 ) {
			bot.ChangeSpawnPoint(5);
		}
		else {
			bot.ChangeSpawnPoint(3);
		}
	}
	else if ( team == TEAM.AXIS ) {
		if ( Map.flagstatus != 2 ) {
			bot.ChangeSpawnPoint(5);
		}
		else {
			bot.ChangeSpawnPoint(1);
		}
	}

	if ( team == TEAM.ALLIES )
	{
		if ( class == CLASS.COVERTOPS )
		{
			bot.ChangeSpawnPoint( 2 );
		}
	}
};
