//===============================================================================================
//
//	uje_the_ghetto.gm
//
//	Who  	When		What
//-----------------------------------------------------------------------------------------------
//	|TP|kaos	10 December 2011	r3 Script
//	need routes, helicopter control and grenade points, but work fine
//===============================================================================================
//

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

	Bridge_Dyno = 0,
	Bridge_MG42_Dyno = 0,
	Command_Post_Dyno = 0,
	Gate_Dyno = 0,
	Tank_Barrier_Dyno = 0,
	TankStatus = 0,	//initial=0 built=1 destroyed=2
	FlagStatus = 0,	//cityflag, 0=initial 1=Axis 2=Allies
	Phase1passed = 0,
	Phase2passed = 0,
	Phase3passed = 0,
	Phase4passed = 0,

	Ammo_Cabinet_ammo5 = "AMMOCAB_ammo5",
	Ammo_Cabinet_north_ammocabinet = "AMMOCAB_north_ammocabinet",
	Ammo_Cabinet_north_ammocabinet_1 = "AMMOCAB_north_ammocabinet_1",
	Health_Cabinet_health4 = "HEALTHCAB_health4",
	Health_Cabinet_health5 = "HEALTHCAB_health5",
	Health_Cabinet_north_healthcabinet = "HEALTHCAB_north_healthcabinet",
	Health_Cabinet_north_healthcabinet_1 = "HEALTHCAB_north_healthcabinet_1",
	Checkpoint_cityflag = "CHECKPOINT_cityflag",
	Flag_maps = "FLAG_maps",
	Cappoint_490 = "CAPPOINT_490",
	Build_Bridge = "BUILD_Bridge",
	Build_Bridge_MG42 = "BUILD_Bridge_MG42",
	Build_Command_Post = "BUILD_Command_Post",
	Build_Gate = "BUILD_Gate",
	Build_Tank = "BUILD_Tank",
	Build_Tank_Barrier = "BUILD_Tank_Barrier",
	Plant_Bridge = "PLANT_Bridge",
	Plant_Bridge_MG42 = "PLANT_Bridge_MG42",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_Gate = "PLANT_Gate",
	Plant_Tank_Barrier = "PLANT_Tank_Barrier",
	Mount_Bridge_MG42 = "MOUNTMG42_Bridge_MG42",
	Repair_Bridge_MG42 = "REPAIRMG42_Bridge_MG42",
	Mover_tank = "MOVER_tank",
	Mover_heli2 = "MOVER_heli2",

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

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

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

	Gate_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_fl_3",
			"DEFEND_fl_4",
			"DEFEND_gate.*",
			"BUILD_Gate",
		});
		Util.MapDebugPrint( "Gate_Built" );
	},

	Tank_Built = function( trigger )
	{
		Map.TankStatus = 1;	//tank ready
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_pha1.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_tk.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_Tank" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNT_Tank" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_fl.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_pha1.*",
			"BUILD_Tank_Barrier",
			"PLANT_Bridge",
		});
		SetGoalPriority( "PLANT_Bridge", 0.82 );
		SetGoalPriority( "BUILD_Bridge_MG42", 0.80 );

		if ( Map.Phase1passed == 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "CHECKPOINT_cityflag" );
		}

		if ( Map.Phase1passed == 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_pha1.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"DEFEND_fl.*",
				"DEFEND_pha1.*",
				"DEFEND_gate.*",
			});
		}

		if ( Map.Phase2passed == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Bridge" );
		}

		if ( Map.Phase3passed == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Tank_Barrier" );
		}

		Util.MapDebugPrint( "Tank_Built" );
	},

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

	Bridge_Planted = function( trigger )
	{
		if ( Map.Phase1passed == 0 )
		{
			Util.DisableGoal( "DEFUSE_Bridge.*" );	//Be patient engineer, first tank, your turn will come...
		}

		Map.Bridge_Dyno += 1;
		Util.MapDebugPrint( "Bridge_Planted" );
	},

	Bridge_MG42_Planted = function( trigger )
	{
		Map.Bridge_MG42_Dyno += 1;
		Util.MapDebugPrint( "Bridge_MG42_Planted" );
	},

	Command_Post_Planted = function( trigger )
	{
		Map.Command_Post_Dyno += 1;
		Util.MapDebugPrint( "Command_Post_Planted" );
	},

	Gate_Planted = function( trigger )
	{
		Map.Gate_Dyno += 1;
		Util.DisableGoal( "DEFUSE_Gate.*" );	//Why waste control over the area to defuse the dynamite?, better to wait and build...
		if ( Map.FlagStatus == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"DEFEND_gate.*",
				"BUILD_Gate",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_gate.*",
				"BUILD_Gate",
			});
		}

		Util.MapDebugPrint( "Gate_Planted" );
	},

	Tank_Barrier_Planted = function( trigger )
	{
		Map.Tank_Barrier_Dyno += 1;
		// randomize plant goal position
		rand = RandInt( 1,4 );
		if ( rand == 1 )
			{ Util.SetGoalPosition( -175.052, 3166.733, 272.125, Map.Plant_Tank_Barrier ); }
		else if ( rand == 2 )
			{ Util.SetGoalPosition( -449.589, 2747.459, 272.125, Map.Plant_Tank_Barrier ); }
		else if ( rand == 3 )
			{ Util.SetGoalPosition( -626.907, 2710.734, 272.125, Map.Plant_Tank_Barrier ); }
		else
			{ Util.SetGoalPosition( -386.230, 2960.551, 382.878, Map.Plant_Tank_Barrier ); }

		Util.MapDebugPrint( "Tank_Barrier_Planted" );
	},

	Bridge_Defused = function( trigger )
	{
		Map.Bridge_Dyno -= 1;
		Util.MapDebugPrint( "Bridge_Defused" );
	},

	Bridge_MG42_Defused = function( trigger )
	{
		Map.Bridge_MG42_Dyno -= 1;
		Util.MapDebugPrint( "Bridge_MG42_Defused" );
	},

	Command_Post_Defused = function( trigger )
	{
		Map.Command_Post_Dyno -= 1;
		Util.MapDebugPrint( "Command_Post_Defused" );
	},

	Gate_Defused = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_gate.*" );
		Map.Gate_Dyno -= 1;
		Util.MapDebugPrint( "Gate_Defused" );
	},

	Tank_Barrier_Defused = function( trigger )
	{
		Map.Tank_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "Tank_Barrier_Defused" );
	},

	Bridge_Destroyed = function( trigger )
	{
		Map.Bridge_Dyno = 0;
		SetGoalPriority( "PLANT_Bridge", 0.81 );

		Util.MapDebugPrint( "Bridge_Destroyed" );
	},

	Bridge_MG42_Destroyed = function( trigger )
	{
		Map.Bridge_MG42_Dyno = 0;

		Util.MapDebugPrint( "Bridge_MG42_Destroyed" );
	},

	Command_Post_Destroyed = function( trigger )
	{
		Map.Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

	Gate_Destroyed = function( trigger )
	{
		Map.Gate_Dyno = 0;
		if ( Map.FlagStatus == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"DEFEND_fl_3",
				"DEFEND_fl_4",
				"DEFEND_gate.*",
				"BUILD_Gate",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_fl_3",
				"DEFEND_fl_4",
				"DEFEND_gate.*",
				"BUILD_Gate",
			});
		}

		Util.MapDebugPrint( "Gate_Destroyed" );
	},

	Tank_Destroyed = function( trigger )
	{
		Map.TankStatus = 2;	//tank destroyed
		SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_Tank" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNT_Tank" );
		if ( Map.FlagStatus == 0 || Map.FlagStatus == 2 && Map.Phase1passed == 0)
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_fl.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_pha1.*" );
		}

		if ( Map.Phase1passed == 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "CHECKPOINT_cityflag" );
		}

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

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

		Util.MapDebugPrint( "Tank_Barrier_Destroyed" );
	},

	//Phase1 - CityFlag and starting engine
	cityflag_Axis_Captured = function( trigger )
	{
		Map.FlagStatus = 1;
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ESCORT_Tank",
			"BUILD_Tank",
			"ATTACK_tk.*",
			"ATTACK_fl.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_pha1.*" );
		if ( Map.TankStatus == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_fl.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_pha1.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_fl.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_pha1.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"CALLARTILLERY_pha1.*",
				"ARTILLERY_D_pha1.*",
				"PLANT_Bridge",
			});
		}

		Util.MapDebugPrint( "cityflag_Axis_Captured" );
	},

	cityflag_Allies_Captured = function( trigger )
	{
		Map.FlagStatus = 2;
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_tk.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_fl.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_pha1.*" );
		if ( Map.TankStatus == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_fl.*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_pha1.*" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_fl.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_pha1.*" );
		}

		Util.MapDebugPrint( "cityflag_Allies_Captured" );
	},

	//Phase2 - Bridge
	phase2_Start = function( trigger )
	{

		Map.Phase1passed = 1;
		Util.EnableGoal( "DEFUSE_Bridge.*" );
		Util.DisableGoal( "AMMOCAB_.*" );
		Util.DisableGoal( "HEALTHCAB_.*" );
		Util.DisableGoal( "DEFEND_gate.*" );
		Util.DisableGoal( "BUILD_Gate" );
		Util.DisableGoal( "PLANT_Gate" );
		Util.DisableGoal( "CHECKPOINT_cityflag" );
		Util.DisableGoal( "DEFEND_fl.*" );
		Util.DisableGoal( "DEFEND_pha1.*" );
		Util.DisableGoal( "ATTACK_fl.*" );
		Util.DisableGoal( "ATTACK_tk.*" );
		Util.DisableGoal( "ATTACK_pha1.*" );
		Util.DisableGoal( "CALLARTILLERY_pha1.*" );
		Util.DisableGoal( "ARTILLERY_D_pha1.*" );
		Util.DisableGoal( "PLANTMINE_pha1.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANTMINE_pha2.*",
			"DEFEND_h1",
			"DEFEND_h2",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"BUILD_Command_Post",
			"PLANT_Command_Post",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_pha2.*",
			"DEFEND_pan1",
			"DEFEND_pas1",
			"DEFEND_ter.*",
		});
		ETUtil.LimitToClass("DEFEND_ter_1", TEAM.ALLIES, CLASS.FIELDOPS, CLASS.COVERTOPS);
		ETUtil.LimitToClass("DEFEND_ter_2", TEAM.ALLIES, CLASS.FIELDOPS, CLASS.COVERTOPS);
		ETUtil.LimitToClass("DEFEND_ter_3", TEAM.ALLIES, CLASS.FIELDOPS, CLASS.COVERTOPS);
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"MOUNTMG42_Bridge_MG42",
			"BUILD_Bridge_MG42",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"PLANT_Command_Post",
			"BUILD_Command_Post",
			"BUILD_Bridge",
			"SNIPE_ax_1",
			"ATTACK_pha2.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"AIRSTRIKE_pha2.*",
			"CALLARTILLERY_pha2.*",
			"ARTILLERY_D_pha2.*",
		});
		//this is just if covertops gets sneak before completing the 4th phase, and an unwary player open a door, hihi
		Util.EnableGoal( "FLAG_maps" );
		Util.EnableGoal( "CAPPOINT_490" );

		Util.MapDebugPrint( "phase2_Start" );
	},

	//Phase3 - Tank Barrier
	phase3_Start = function( trigger )
	{

		Map.Phase2passed = 1;
		Util.DisableGoal( "BUILD_Bridge" );
		Util.DisableGoal( "PLANT_Bridge" );
		Util.DisableGoal( "ATTACK_pha2.*" );
		Util.DisableGoal( "DEFEND_pha2.*" );
		Util.DisableGoal( "MOUNTMG42_Bridge_MG42" );
		Util.DisableGoal( "BUILD_Bridge_MG42" );
		Util.DisableGoal( "AIRSTRIKE_pha2.*" );
		Util.DisableGoal( "CALLARTILLERY_pha2.*" );
		Util.DisableGoal( "ARTILLERY_D_pha2.*" );
		Util.DisableGoal( "PLANTMINE_pha2.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_pha3.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_pan1",
			"DEFEND_pas1",
			"DEFEND_ter.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"AIRSTRIKE_pha3.*",
			"CALLARTILLERY_pha3.*",
			"ARTILLERY_D_pha3.*",
			"DEFEND_pha3.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_pha3.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SNIPE_ax_1" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"SNIPE_ax_2",
			"PLANT_Tank_Barrier",
			"ATTACK_h.*",
		});
		ETUtil.LimitToClass("ATTACK_h.*", TEAM.AXIS, CLASS.COVERTOPS);

		Util.MapDebugPrint( "phase3_Start" );
	},

	//Phase 4 - Incoming!
	phase4_Start = function( trigger )
	{

		Map.Phase3passed = 1;
		Util.DisableGoal( "ATTACK_h1" );
		Util.DisableGoal( "PLANT_Tank_Barrier" );
		Util.DisableGoal( "BUILD_Tank_Barrier" );
		Util.DisableGoal( "DEFEND_pha3.*" );
		Util.DisableGoal( "DEFEND_h.*" );
		Util.DisableGoal( "ATTACK_pha3.*" );
		Util.DisableGoal( "AIRSTRIKE_pha3.*" );
		Util.DisableGoal( "PLANTMINE_pha3.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANTMINE_pha4.*",
			"AIRSTRIKE_pha4.*",
			"DEFEND_pha4.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "SNIPE_ax_2" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_pha4.*" );

		Util.MapDebugPrint( "phase4_Start" );
	},

	//Phase5
	Docs_Available = function( trigger )
	{
		Map.Phase4passed = 1;
		Util.ClearRoleForGoals(Map.Flag_maps, ROLE.INFILTRATOR);
		Util.DisableGoal( "AIRSTRIKE_pha4.*" );
		Util.DisableGoal( "CALLARTILLERY_pha3.*" );
		Util.DisableGoal( "ARTILLERY_D_pha3.*" );
		Util.DisableGoal( "DEFEND_pha4.*" );
		Util.DisableGoal( "ATTACK_pha4.*" );
		Util.DisableGoal( "PLANTMINE_pha4.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_inter.*" );
		ETUtil.LimitToClass("DEFEND_inter.*", TEAM.ALLIES, CLASS.SOLDIER);
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_doc.*",
			"MOUNT_Tank",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_490" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"MOUNT_Tank",
			"ESCORT_Tank",
			"BUILD_Tank",
		});

		Util.MapDebugPrint( "Docs_Available" );
	},

	maps_Taken = function( trigger )
	{

		if ( Map.Phase4passed == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_obj.*",
				"DEFEND_pan2",
				"DEFEND_ter_4.*",
				"DEFEND_h3",
			});
			SetGoalPriority( "DEFEND_h3", 0.52 );
			Util.SetMaxUsersInProgress(1, "DEFEND_h3");
		}

		//some funny attempts to sneak before completing the 4th phase?... no problem
		if ( Map.Phase4passed == 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_obj_1" );
			SetMapGoalProperties( "DEFEND_obj_1", {MinCampTime=999, MaxCampTime=999} );
			ETUtil.LimitToClass("DEFEND_obj_1", TEAM.ALLIES, CLASS.SOLDIER, CLASS.MEDIC, CLASS.COVERTOPS, CLASS.FIELDOPS);
			SetGoalPriority( "DEFEND_obj_1", 0.51 );
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"DEFEND_h1",
				"DEFEND_h2",
			});
		}

		Util.MapDebugPrint( "maps_Taken" );
	},

	maps_Returned = function( trigger )
	{
		if ( Map.Phase4passed == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_doc.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"DEFEND_obj.*",
				"DEFEND_pan2",
				"DEFEND_h3",
			});
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_inter.*",
				"MOUNT_Tank",
			});
		}

		if ( Map.Phase4passed == 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_obj_1" );
			SetMapGoalProperties( "DEFEND_obj_1", {MinCampTime=10, MaxCampTime=20} );
			ETUtil.LimitToClass("DEFEND_obj_1", TEAM.ALLIES, CLASS.SOLDIER, CLASS.MEDIC, CLASS.COVERTOPS, CLASS.FIELDOPS, CLASS.ENGINEER);
			SetGoalPriority( "DEFEND_obj_1", 0.50 );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_h1",
				"DEFEND_h2",
			});
		}

		Util.MapDebugPrint( "maps_Returned" );
	},

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

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "The bridge has been repaired.", Map.Bridge_Built );
	OnTrigger( "Allied team has built the bridge mg42!", Map.Bridge_MG42_Built );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Built );
	OnTrigger( "Allied team has rebuilt the gate!", Map.Gate_Built );
	OnTrigger( "The Tank has been repaired!", Map.Tank_Built );
	OnTrigger( "Tank Barrier has been constructed.", Map.Tank_Barrier_Built );
	OnTrigger( "Planted at the Bridge.", Map.Bridge_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Bridge_MG42_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Command_Post_Planted );
	OnTrigger( "Planted at the Gate.", Map.Gate_Planted );
	OnTrigger( "Planted at the Tank Barrier.", Map.Tank_Barrier_Planted );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Bridge_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Bridge_MG42_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Command_Post_Defused );
	OnTrigger( "Defused at the Gate.", Map.Gate_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Tank_Barrier_Defused );
	OnTrigger( "The bridge has been damaged.", Map.Bridge_Destroyed );
	OnTrigger( "Axis team has destroyed the bridge mg42!", Map.Bridge_MG42_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Destroyed );
	OnTrigger( "Axis team has destroyed the gate!", Map.Gate_Destroyed );
	OnTrigger( "The Tank has been damaged!", Map.Tank_Destroyed );
	OnTrigger( "Tank Barrier has been destroyed.", Map.Tank_Barrier_Destroyed );
	OnTrigger( "Axis have stolen The Combat Maps!", Map.maps_Taken );
	OnTrigger( "Allies have returned The Combat Maps!", Map.maps_Returned );
	OnTrigger( "MISSING_STRING", Map.maps_Secured );
	OnTrigger( "Axis captured the Disco!", Map.cityflag_Axis_Captured );
	OnTrigger( "Allies reclaim the town!", Map.cityflag_Allies_Captured );
	OnTrigger( "Axis own the Disco!", Map.phase2_Start );
	OnTrigger( "UJE_the_ghetto_allies_tank_bridge", Map.phase3_Start );
	OnTrigger( "UJE_the_ghetto_allies_tankbar_past", Map.phase4_Start );
	OnTrigger( "Axis team has broken into Battalion Headquarters!", Map.Docs_Available );

	Util.SetGoalPosition ( -228.245, 2967.947, 272.125, "PLANT_Tank_Barrier" );

	//START ALLIES
	//clear all goals
	SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );
	//activation
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"AMMOCAB_north_ammocabinet",
		"HEALTHCAB_north_healthcabinet",
		"CHECKPOINT_cityflag",
		"DEFEND_fl.*",
		"BUILD_Command_Post*",
		"PLANT_Command_Post*",
	});
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"DEFEND_fl_3.*",
		"DEFEND_fl_4.*",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_pha1.*" );

	//START AXIS
	//clear all goals
	SetAvailableMapGoals( TEAM.AXIS, false, ".*" );
	//activation
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"AMMOCAB_north_ammocabinet",
		"HEALTHCAB_north_healthcabinet",
	});
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"PLANT_Gate",
		"CHECKPOINT_cityflag",
	});


	//Priorities
	SetGoalPriority( "BUILD_Tank", 0.91 );
	SetGoalPriority( "BUILD_Command_Post", 0.60 );
	SetGoalPriority( "PLANT_Command_Post", 0.60 );
	SetGoalPriority( "MOUNT_Tank", 0.50, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "MOUNT_Tank", 0.50, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "ESCORT_Tank", 0.50, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "DEFUSE_Gate_.*", 1.10, TEAM.ALLIES, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_Bridge_.*", 1.15, TEAM.ALLIES, CLASS.ENGINEER, true );
	SetGoalPriority( "DEFUSE_Tank_Barrier_.*", 1.20, TEAM.ALLIES, CLASS.ENGINEER, true );

	// Max users per goal
	Util.SetMaxUsers( 1, "ATTACK_.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "SNIPE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMORTAR_.*" );
	Util.SetMaxUsers( 1, "AIRSTRIKE_.*" );
	Util.SetMaxUsers( 1, "CALLARTILLERY_.*" );
	Util.SetMaxUsers( 1, "MOUNT_Tank" );
	Util.SetMaxUsers( 2, "ESCORT_Tank" );
	Util.SetMaxUsers( 1, "BUILD_Command_Post" );
	Util.SetMaxUsers( 1, "PLANT_Command_Post" );
	Util.SetMaxUsersInProgress( 1, "BUILD_Command_Post" );
	Util.SetMaxUsersInProgress( 1, "MOUNTMG42_Bridge_MG42" );


	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=10, MaxCampTime=60} );
	SetMapGoalProperties( "DEFEND_h3", {MinCampTime=120, MaxCampTime=180} );
	SetMapGoalProperties( "DEFEND_doc1.*", {MinCampTime=15, MaxCampTime=30} );
	SetMapGoalProperties( "SNIPE.*", {MinCampTime=45, MaxCampTime=60} );

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

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 300.0;
};
