global Map =
{
	Ammo_Cabinet_mainbunker_ammocabinet = "AMMOCAB_mainbunker_ammocabinet",
	Ammo_Cabinet_mainbunker_ammocabinet_lms = "AMMOCAB_mainbunker_ammocabinet_lms",
	Ammo_Cabinet_eastbunker_ammocabinet = "AMMOCAB_eastbunker_ammocabinet",
	Checkpoint_westbunker_flag = "CHECKPOINT_westbunker_flag",
	Health_Cabinet_mainbunker_healthcabinet = "HEALTHCAB_mainbunker_healthcabinet",
	Health_Cabinet_eastbunker_healthcabinet = "HEALTHCAB_eastbunker_healthcabinet",
	Health_Cabinet_mainbunker_healthcabinet_lms = "HEALTHCAB_mainbunker_healthcabinet_lms",
	Build_Allied_Beach_Assault_Ramp = "BUILD_Allied_Beach_Assault_Ramp",
	Build_Allied_East_beach_MG_nest = "BUILD_Allied_East_beach_MG_nest",
	Build_Allied_West_beach_MG_nest = "BUILD_Allied_West_beach_MG_nest",
	Build_Axis_Main_Bunker_MG_nest = "BUILD_Axis_Main_Bunker_MG_nest",
	Build_Axis_North_West_MG_nest = "BUILD_Axis_North_W.*MG_nest",
	Build_Axis_South_East_MG_nest = "BUILD_Axis_South_East_MG_nest",
	Build_Command_Post = "BUILD_Command_Post",
	Build_Generator = "BUILD_Generator",
	Plant_Allied_Beach_Assault_Ramp = "PLANT_Allied_Beach_Assault_Ramp",
	Plant_Allied_East_beach_MG_nest = "PLANT_Allied_East_beach_MG_nest",
	Plant_Allied_West_beach_MG_nest = "PLANT_Allied_West_beach_MG_nest",
	Plant_Axis_Main_Bunker_MG_nest = "PLANT_Axis_Main_Bunker_MG_nest",
	Plant_Axis_North_West_MG_nest = "PLANT_Axis_North_W.*MG_nest",
	Plant_Axis_South_East_MG_nest = "PLANT_Axis_South_East_MG_nest",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_Generator = "PLANT_Generator",
	Plant_Gun_Controls = "PLANT_Gun_Controls",
	Mount_Allied_East_beach_MG_nest = "MOUNTMG42_Allied_East_beach_MG_nest",
	Mount_Allied_West_beach_MG_nest = "MOUNTMG42_Allied_West_beach_MG_nest",
	Mount_Axis_Main_Bunker_MG_nest = "MOUNTMG42_Axis_Main_Bunker_MG_nest",
	Mount_Axis_North_West_MG_nest = "MOUNTMG42_Axis_North_W.*MG_nest",
	Mount_Axis_South_East_MG_nest = "MOUNTMG42_Axis_South_East_MG_nest",
	Mount_eastbunker_mg42_1 = "MOUNTMG42_eastbunker_mg42_1",
	Mount_eastbunker_mg42_2 = "MOUNTMG42_eastbunker_mg42_2",
	Mount_westbunker_mg42_1 = "MOUNTMG42_westbunker_mg42_1",
	Mount_westbunker_mg42_2 = "MOUNTMG42_westbunker_mg42_2",
	Repair_Allied_East_beach_MG_nest = "REPAIRMG42_Allied_East_beach_MG_nest",
	Repair_Allied_West_beach_MG_nest = "REPAIRMG42_Allied_West_beach_MG_nest",
	Repair_Axis_Main_Bunker_MG_nest = "REPAIRMG42_Axis_Main_Bunker_MG_nest",
	Repair_Axis_North_West_MG_nest = "REPAIRMG42_Axis_North_W.*MG_nest",
	Repair_Axis_South_East_MG_nest = "REPAIRMG42_Axis_South_East_MG_nest",
	Repair_eastbunker_mg42_1 = "REPAIRMG42_eastbunker_mg42_1",
	Repair_eastbunker_mg42_2 = "REPAIRMG42_eastbunker_mg42_2",
	Repair_westbunker_mg42_1 = "REPAIRMG42_westbunker_mg42_1",
	Repair_westbunker_mg42_2 = "REPAIRMG42_westbunker_mg42_2",

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

	//status' for conditionals
	beachplanks = false,
	flagstatus = 0, //0 none, 1 axis, 2 allies
	doorcontrols = true, //intact
	frontdoor = false, //closed
	rightdoor = false,
	leftdoor = false,
	CPStatus = 0, // no team owns it

	//dyno counters
	GunDyno = 0,

	//detect if the back door is plantable since most mods ship with the etpro map scripts
	BackDoorGoal = false,
	BackDoorDyno = 0,
	EastBunkerMgs = true,

	DispenseAmmoTime = 15,

	// a couple axis bots will want to mount the south east mg
	Roles =
	{
		AXIS =
		{
			DEFENDER1 =
			{
				numbots = 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.
		},
	},

	BaseTriggered = false,
	BaseTrigger =
	{
		Name = "BaseTrigger",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( !Map.BaseTriggered )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Util.LimitToClass( Map.Checkpoint_westbunker_flag,
						TEAM.AXIS, CLASS.COVERTOPS );

					Util.ChangeSpawn( TEAM.AXIS, 1 );
					Map.BaseTriggered = true;
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Gun.*",
						"TRIPMINE_controls.*",
					});
					SetAvailableMapGoals( TEAM.AXIS, false, {
						"MOUNTMG42_Axis_Main_Bunker_MG_nest",
						"DEFEND_Flag_.*",
						"CAMP_cFlag.*",
						Map.Mount_westbunker_mg42_1,
						Map.Mount_westbunker_mg42_2,
						"CALLARTILLERY.*",
						"REPAIRMG42_westbunker_mg42_1",
						"REPAIRMG42_westbunker_mg42_2",
						"CAMP_cFlag.*",
						"PLANT_Allied_Beach_Assault_Ramp",
						"CHECKPOINT_westbunker_flag",
						Map.Mount_Axis_North_West_MG_nest,
						Map.Repair_Axis_North_West_MG_nest,
						Map.Build_Axis_North_West_MG_nest,
						"MOBILEMORTAR_ramp",
					});
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						"MOBILEMORTAR_bUpperBunker1",
						"GRENADE_westbunkermg",
					});

					DeleteTriggerRegion("BaseTrigger");
					Util.MapDebugPrint("BaseTrigger");
				}
			}
		},
	},

	Axis_Conservative = false,
	Axis_Fallback =
	{
		Name = "Axis_Fallback",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( !Map.Axis_Conservative )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.Axis_Conservative = true;
					Util.ChangeSpawn( TEAM.AXIS, 1 );
					Util.OneBotVSayTeam( TEAM.AXIS, VOICE.INCOMING );
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Gun.*",
						"TRIPMINE_controls.*",
						"MOUNTMG42_Axis_Main_Bunker_MG_nest",
					});
					SetAvailableMapGoals( TEAM.AXIS, false, {
						"DEFEND_Flag_.*",
						"CAMP_cFlag.*",
						Map.Mount_westbunker_mg42_1,
						Map.Mount_westbunker_mg42_2,
						"CALLARTILLERY.*",
						"REPAIRMG42_westbunker_mg42_1",
						"REPAIRMG42_westbunker_mg42_2",
						"CAMP_cFlag.*",
						"PLANT_Allied_Beach_Assault_Ramp",
						"CHECKPOINT_westbunker_flag",
						Map.Mount_Axis_North_West_MG_nest,
						Map.Repair_Axis_North_West_MG_nest,
						Map.Build_Axis_North_West_MG_nest,
						"MOBILEMORTAR_ramp",
					});
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						"MOBILEMORTAR_bUpperBunker1",
						"GRENADE_westbunkermg",
					});

					DeleteTriggerRegion("Axis_Fallback");
					Util.MapDebugPrint("Axis_Fallback");
				}
			}
		},
	},

	Allied_Beach_Assault_Ramp_Built = function( trigger )
	{
		//~ sleep( 2 );
		Map.beachplanks = true;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"SMOKEBOMB_assaultramp",
			Map.Build_Allied_Beach_Assault_Ramp,
			"AIRSTRIKE_bRamp.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Checkpoint_westbunker_flag,
			Map.Plant_Gun_Controls,
			Map.Plant_Generator,
			Map.Plant_Axis_Main_Bunker_MG_nest,
			Map.Plant_Axis_South_East_MG_nest,
			Map.Plant_Axis_North_West_MG_nest,
		});

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOBILEMORTAR_ramp",
			"DEFEND_Flag.*",
		});

		if ( !Map.BaseTriggered )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "CAMP_cFlag.*" );
		}

		Util.MapDebugPrint( "Allied_Beach_Assault_Ramp_Built" );
	},


	// TODO: really need to determine which allies are on the beach and which are past the ramp
	// right now, an eng at gun controls could potentially head back to the beach ...
	// dynamically setting roles is one option i guess
	Allied_Beach_Assault_Ramp_Destroyed = function( trigger )
	{
		Map.beachplanks = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Allied_Beach_Assault_Ramp );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Checkpoint_westbunker_flag,
			Map.Plant_Generator,
			Map.Plant_Axis_Main_Bunker_MG_nest,
			Map.Plant_Axis_South_East_MG_nest,
			Map.Plant_Axis_North_West_MG_nest,
		});

		if ( Map.flagstatus != 2 && !Map.BaseTriggered )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"AIRSTRIKE_bRamp.*",
				"MOBILEMORTAR_ramp",
				"DEFEND_Flag.*",
			});
			SetAvailableMapGoals( TEAM.AXIS, false, "CAMP_cFlag.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Gun_Controls );
			SetAvailableMapGoals( TEAM.ALLIES, true, "SMOKEBOMB_assaultramp" );
		}

		Util.MapDebugPrint( "Allied_Beach_Assault_Ramp_Destroyed" );
	},

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

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

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

	Allied_West_beach_MG_nest_Destroyed = function( trigger )
	{
		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_Destroyed = function( trigger )
	{
		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_Destroyed = function( trigger )
	{
		Util.MapDebugPrint( "Axis_North_West_MG_nest_Destroyed" );
	},

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

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

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

		if ( !Map.doorcontrols ) {
			Util.ChangeSpawn( TEAM.ALLIES, 4, 4 ); // spawn up to 4 at cp
		}

		Util.MapDebugPrint( "Command_Post_Built_Allied" );
	},

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

		Util.MapDebugPrint( "Command_Post_Built_Axis" );
	},

	Command_Post_Destroyed_Allied = function( trigger )
	{
		Map.CPStatus = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed_Allied" );
	},

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

		Util.MapDebugPrint( "Command_Post_Destroyed_Axis" );
	},

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

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

			if ( Map.frontdoor )
			{
				// Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.AXIS);
				// Util.LimitGoal( TEAM.AXIS, "SWITCH_frontdoor" );
			}
			else if ( Map.flagstatus == 2 )
			{
				Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.ALLIES);
				Util.LimitGoal( TEAM.ALLIES, "SWITCH_frontdoor" );
			}
			else
			{
				Map.Switches.FrontDoor.LimitTeam = 0;
				SetAvailableMapGoals( 0, false, "SWITCH_frontdoor" );
			}

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

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

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_Axis_South_East_MG_nest",
			"REPAIRMG42_Axis_South_East_MG_nest",
		});
		Util.ChangeSpawn( TEAM.ALLIES, 5 );

		Util.MapDebugPrint( "Generator_Built" );
	},

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

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

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"MOUNTMG42_Axis_South_East_MG_nest",
			"REPAIRMG42_Axis_South_East_MG_nest",
		});

		if ( Map.CPStatus == 2 ) {
			Util.ChangeSpawn( TEAM.ALLIES, 4, 4 ); // spawn up to 4 at cp
		}
		Util.MapDebugPrint( "Generator_Destroyed" );
	},

	westbunker_flag_Axis_Captured = function( trigger )
	{
		Map.flagstatus = 1;

		Util.ChangeSpawn( TEAM.ALLIES, 3 );

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

		if ( Map.GunDyno < 1 && !Map.BaseTriggered )
		{
			// Axis goals
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_Gun_.*",
				"DEFEND_gc_flex.*",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, {
				Map.Mount_westbunker_mg42_1,
				Map.Mount_westbunker_mg42_2,
				"REPAIRMG42_westbunker_mg42_1",
				"REPAIRMG42_westbunker_mg42_2",
				"CALLARTILLERY.*",
			});
		}

		if ( !Map.beachplanks  )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				Map.Plant_Gun_Controls,
				"ATTACK_Gun_.*",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ATTACK_Beach_.*",
				"GRENADE_westbunkermg",
				"GRENADE_westbunkermg1",
				"SMOKEBOMB_westbunkermg",
				"SMOKEBOMB_westbunker",
				"MOBILEMORTAR_bUpperBunker1",
			});
			SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Flag_.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "CAMP_cFlag.*" );
		}

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_Allied_West_beach_MG_nest",
			"MOUNTMG42_Allied_West_beach_MG_nest",
			"REPAIRMG42_Allied_West_beach_MG_nest",
		});

		if ( Map.frontdoor && Map.GunDyno < 1 && Map.doorcontrols )
		{
			// Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.AXIS);
			// Util.LimitGoal( 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.LimitGoal( 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.LimitGoal( TEAM.AXIS, "SWITCH_rightdoor" );
		}
		else
		{
			Map.Switches.RightDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_rightdoor" );
		}

		if ( Map.hatch )
		{
			Map.Switches.Hatch.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitGoal( TEAM.AXIS, "SWITCH_hatch" );
		}
		else
		{
			Map.Switches.Hatch.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_hatch" );
		}

		Util.MapDebugPrint( "westbunker_flag_Axis_Captured" );
	},

	westbunker_flag_Allies_Captured = function( trigger )
	{
		Map.flagstatus = 2;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Beach_.*",
			"MOBILEMORTAR_bUpperBunker1",
			"GRENADE_westbunkermg",
			"GRENADE_westbunkermg1",
			"SMOKEBOMB_westbunkermg",
			"SMOKEBOMB_westbunker",
			"BUILD_Allied_West_beach_MG_nest",
			"MOUNTMG42_Allied_West_beach_MG_nest",
			"REPAIRMG42_Allied_West_beach_MG_nest",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Gun_.*",
			Map.Plant_Gun_Controls,
		});

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

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Gun_.*" );

		if ( Map.GunDyno < 1 && !Map.BaseTriggered )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_gc_flex.*",
				"BUILD_Axis_Main_Bunker_MG_nest",
				"MOUNTMG42_Axis_Main_Bunker_MG_nest",
				"TRIPMINE_flex.*",
			});
		}

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Flag_.*",
			"CAMP_cFlag.*",
			Map.Mount_westbunker_mg42_1,
			Map.Mount_westbunker_mg42_2,
			"CALLARTILLERY.*",
			"REPAIRMG42_westbunker_mg42_1",
			"REPAIRMG42_westbunker_mg42_2",
			"TRIPMINE_bunker1",
		});

		if ( Map.frontdoor && Map.GunDyno < 1 && Map.doorcontrols )
		{
			// Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.AXIS);
			// Util.LimitGoal( TEAM.AXIS, "SWITCH_frontdoor" );
		}
		else if( !Map.frontdoor && Map.doorcontrols )
		{
			Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( 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.LimitGoal( TEAM.AXIS, "SWITCH_leftdoor" );
		}
		else if ( !Map.leftdoor && Map.doorcontrols )
		{
			Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( 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.LimitGoal( TEAM.AXIS, "SWITCH_rightdoor" );
		}
		else if ( !Map.rightdoor && Map.doorcontrols )
		{
			Map.Switches.RightDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( TEAM.ALLIES, "SWITCH_rightdoor" );
		}
		else
		{
			Map.Switches.RightDoor.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_rightdoor" );
		}

		if ( !Map.hatch )
		{
			Map.Switches.Hatch.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( TEAM.ALLIES, "SWITCH_hatch" );
		}
		else
		{
			Map.Switches.Hatch.LimitTeam = 0;
			SetAvailableMapGoals( 0, false, "SWITCH_hatch" );
		}

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

		Util.MapDebugPrint( "westbunker_flag_Allies_Captured" );
	},

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

		Util.MapDebugPrint( "Gun_Controls_Destroyed" );
	},

	Controls_Plant = function( trigger )
	{
		Map.GunDyno += 1;

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_gc_flex.*",
			"TRIPMINE_flex.*",
		});
		Map.Switches.FrontDoor.LimitTeam = 0;
		SetAvailableMapGoals( 0, false, "SWITCH_frontdoor" );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNTMG42_Axis_South_East_MG_nest",
			"REPAIRMG42_Axis_South_East_MG_nest",
			"BUILD_Generator",
		});

		Util.MapDebugPrint( "Controls_Plant" );
	},

	Controls_Defuse = function( trigger )
	{
		Map.GunDyno -= 1;

		if ( Map.GunDyno < 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_gc_flex.*",
				"TRIPMINE_flex.*",
				"MOUNTMG42_Axis_South_East_MG_nest",
				"REPAIRMG42_Axis_South_East_MG_nest",
				"BUILD_Generator",
			});

			Map.Axis_Conservative = false;

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

		Util.MapDebugPrint( "Controls_Defuse" );
	},

	Back_Door_Destroyed = function( trigger )
	{
		Map.BackDoorDyno = 0;
	},

	Back_Door_Planted = function( trigger )
	{
		Map.BackDoorDyno += 1;
	},

	Back_Door_Defused = function( trigger )
	{
		Map.BackDoorDyno -= 1;
	},

	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.LimitGoal( TEAM.AXIS, "SWITCH_frontdoor" );
		}
		else if ( Map.flagstatus == 2 && !Map.frontdoor )
		{
			Map.Switches.FrontDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( 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.LimitGoal( TEAM.AXIS, "SWITCH_leftdoor" );
		}
		else if ( Map.flagstatus == 2 && !Map.leftdoor )
		{
			Map.Switches.LeftDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( 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.LimitGoal( TEAM.AXIS, "SWITCH_rightdoor" );
		}
		else if ( Map.flagstatus == 2 && !Map.rightdoor )
		{
			Map.Switches.RightDoor.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( 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[1] < 0 )
		{
			Util.MapDebugPrint("hatch closing", true);
		}
		else if ( vel[1] > 0 )
		{
			Util.MapDebugPrint("hatch opening", true);
		}

		//set availability based on status'
		if ( Map.hatch )
		{
			Map.hatch = false;
			Map.Switches.Hatch.LimitTeam = (1<<TEAM.ALLIES);
			Util.LimitGoal( TEAM.ALLIES, "SWITCH_hatch" );
			Wp.SetWaypointFlag( "Base Hatch 1", "closed", true );
			Wp.SetWaypointFlag( "Base Hatch 2", "closed", true );
			DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );
		}
		else
		{
			Map.hatch = true;
			Map.Switches.Hatch.LimitTeam = (1<<TEAM.AXIS);
			Util.LimitGoal( TEAM.AXIS, "SWITCH_hatch" );
			Wp.SetWaypointFlag( "Base Hatch 1", "closed", false );
			Wp.SetWaypointFlag( "Base Hatch 2", "closed", false );
			DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );
		}

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

global OnMapLoad = function()
{
	Util.SetGoalOffset( -128, -96, 128, Map.Plant_Allied_Beach_Assault_Ramp );

	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 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( "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( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed_Axis );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Command_Post_Destroyed_Allied );
	OnTrigger( "Allied team has destroyed the Door Controls Generator!", Map.Generator_Destroyed );
	OnTrigger( "Allies have destroyed the gun tracking", Map.Gun_Controls_Destroyed );
	OnTrigger( "Axis capture the West Bunker!", Map.westbunker_flag_Axis_Captured );
	OnTrigger( "Allies capture the Forward Bunker!", Map.westbunker_flag_Allies_Captured );
	OnTrigger( "Planted at the Gun Controls.", Map.Controls_Plant );
	OnTrigger( "Defused at the Gun Controls.", Map.Controls_Defuse );
	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 );

	// detect if the back door can be planted
	bd = Util.GoalTable("PLANT_Back_Door");
	if ( tableCount(bd) > 0 )
	{
		Map.BackDoorGoal = true;
		OnTrigger( "^1Note: ^3Allies have destroyed the Backdoor - Axis need to rebuild it.", Map.Back_Door_Destroyed ); // NoQuarter colored notes
		OnTrigger( "Allies have destroyed the Backdoor.", Map.Back_Door_Destroyed ); // default
		OnTrigger( "Planted at the Back Door.", Map.Back_Door_Planted );
		OnTrigger( "Defused at the Back Door.", Map.Back_Door_Defused );
	}

	// more etpro script detection...
	ebmg = Util.GoalTable("MOUNTMG42_eastbunker_mg42.*");
	if (tableCount(ebmg) < 1)
	{
		Map.EastBunkerMgs = false;
	}

	tOne = OnTriggerRegion(Vector3(2336,-4161,920), 200, Map.BaseTrigger);
	gc1 = OnTriggerRegion(AABB(3638.603,-4191.351,1151.125,3776.875,-4079.821,1225.125), Map.Axis_Fallback);
	gc2 = OnTriggerRegion(AABB(3014.064,-3574.636,895.125,3170.968,-3466.865,969.125), Map.Axis_Fallback);
	gc3 = OnTriggerRegion(AABB(3584.027,-3782.805,895.125,3662.790,-3651.899,969.125), Map.Axis_Fallback);

	// Max users per goal
	Util.SetMaxUsersInProgress( 15, Map.Checkpoint_westbunker_flag );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "SWITCH_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "MOUNT.*" );
	Util.SetMaxUsers( 1, "SMOKEBOMB_.*" );
	Util.SetMaxUsers( 1, "REPAIRMG42_.*" );
	Util.SetMaxUsers( 1, Map.Build_Axis_North_West_MG_nest );
	Util.SetMaxUsers( 1, "BUILD_Axis_South_East_MG_nest" );
	Util.SetMaxUsers( 1, "BUILD_Generator" );

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=15, MaxCampTime=30} );
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=15, MaxCampTime=30} );
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=45, MaxCampTime=90} );

	SetGoalPriority( "SWITCH_.*", 0.65 );
	SetGoalPriority( "DEFEND_gc_flex.*", 0.49, TEAM.AXIS );
	SetGoalPriority( Map.Plant_Gun_Controls, 0.85, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Allied_West_beach_MG_nest, 0.93, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Allied_Beach_Assault_Ramp, 0.92, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Allied_East_beach_MG_nest, 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Generator, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Axis_North_West_MG_nest, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Axis_Main_Bunker_MG_nest, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Axis_South_East_MG_nest, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Generator, 0.83, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( Map.Plant_Axis_North_West_MG_nest, 0.82, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( Map.Plant_Axis_Main_Bunker_MG_nest, 0.81, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( Map.Build_Generator, 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Axis_North_West_MG_nest, 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Axis_Main_Bunker_MG_nest, 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Allied_Beach_Assault_Ramp, 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Allied_Beach_Assault_Ramp, 0.81, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "DEFUSE_Axis_South_East_MG_nest.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_Command_Post.*", 0.0, TEAM.AXIS, CLASS.ENGINEER, true );

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

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ATTACK_Beach_.*",
		"GRENADE_westbunkermg",
		"GRENADE_westbunkermg1",
		"SMOKEBOMB_westbunkermg",
		"SMOKEBOMB_westbunker",
		"SMOKEBOMB_assaultramp",
		"AIRSTRIKE_bRamp.*",
		"BUILD_Allied_Beach_Assault_Ramp",
		"MOBILEMORTAR_bUpperBunker1",
		"BUILD_Allied_West_beach_MG_nest",
		"MOUNTMG42_Allied_West_beach_MG_nest",
		"REPAIRMG42_Allied_West_beach_MG_nest",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Flag_.*" );
	// SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_frontdoor" );
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"PLANT_Allied_Beach_Assault_Ramp",
		"CALLARTILLERY_ramparty1",
		"CALLARTILLERY_ramparty2",
		"ARTILLERY_S_573",
		"CHECKPOINT_westbunker_flag",
		"MOUNTMG42_westbunker_mg42_1",
		"MOUNTMG42_westbunker_mg42_2",
		Map.Mount_Axis_North_West_MG_nest,
		"REPAIRMG42_westbunker_mg42_1",
		"REPAIRMG42_westbunker_mg42_2",
		Map.Repair_Axis_North_West_MG_nest,
	});
	SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Axis_North_West_MG_nest ); // overlooks ramp
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"BUILD_Axis_Main_Bunker_MG_nest",
		"BUILD_Axis_South_East_MG_nest",
		"BUILD_Generator",
		"MOBILEMORTAR_ramp",
		"TRIPMINE_bunker1",
	});

	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 = {},
						},
					},
				},
			},
		},
		MOUNTMG42_Axis_Main_Bunker_MG_nest =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_westladder = { ROUTE_gunpatrol2 = {}, },
				ROUTE_eastladder = { ROUTE_gunpatrol = {}, },
			},
		},
	};
	MapRoutes["DEFEND_Gun_.*"] =
	{
		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 = {},
			},
		},
	};
	MapRoutes["DEFEND_Flag_.*"] =
	{
		ROUTE_AxisSpawn =
		{
			ROUTE_flagroute = { Weight = 3 },
			ROUTE_gunpatrol = {},
			ROUTE_southstairs =
			{
				ROUTE_guntop = { ROUTE_guntop = {}, },
			},
		},
	};

	//copy some routes
	MapRoutes["ATTACK_Gun_.*"] = MapRoutes.PLANT_Gun_Controls;
	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[Map.Mount_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.REPAIRMG42_westbunker_mg42_2 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.REPAIRMG42_Axis_Main_Bunker_MG_nest = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.REPAIRMG42_Axis_South_East_MG_nest = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.REPAIRMG42_westbunker_mg42_1 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes[Map.Repair_Axis_North_West_MG_nest] = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	MapRoutes.BUILD_Generator = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	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[Map.Build_Axis_North_West_MG_nest] = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;

	if ( Map.EastBunkerMgs )
	{
		MapRoutes.MOUNTMG42_eastbunker_mg42_1 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
		MapRoutes.MOUNTMG42_eastbunker_mg42_2 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
		MapRoutes.REPAIRMG42_eastbunker_mg42_1 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
		MapRoutes.REPAIRMG42_eastbunker_mg42_2 = MapRoutes.MOUNTMG42_Axis_Main_Bunker_MG_nest;
	}

	Util.Routes(MapRoutes);
	Util.UpdateSwitchData();
	Util.MapDebugPrint( "OnMapLoad" );
};

global OnBotJoin = function( bot )
{
	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);
		}
	}
};
