//==========================================================================================
//
//	nq_chartow_beta2.gm
//
//	Who                           	When		What
//------------------------------------------------------------------------------------------
//	=F|A=BLACKWOLF*			15 July 2020	Initial Script
//
//==========================================================================================
//

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

	ALIANCKIE_DOWOCTWO_DOWODZENIA_Dyno = 0,
	BRAMA_WJAZDOWA_Dyno = 0,
	NIEMIECKIE_DOWOCTWO_DOWODZENIA_Dyno = 0,
	SCIANA_BOCZNA_Dyno = 0,
	SCIANA_MAGAZYNU_Dyno = 0,
	SCIANA_W_BARZE_Dyno = 0,
	SEJF_Dyno = 0,

	ALIANCKIE_DOWOCTWO_DOWODZENIA_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "ALIANCKIE_DOWOCTWO_DOWODZENIA_Built" );
	},

	CZOLG_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "CZOLG_Built" );
	},

	NIEMIECKIE_DOWOCTWO_DOWODZENIA_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "NIEMIECKIE_DOWOCTWO_DOWODZENIA_Built" );
	},

	ALIANCKIE_DOWOCTWO_DOWODZENIA_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.ALIANCKIE_DOWOCTWO_DOWODZENIA_Dyno += 1;
		Util.MapDebugPrint( "ALIANCKIE_DOWOCTWO_DOWODZENIA_Planted" );
	},

	BRAMA_WJAZDOWA_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.BRAMA_WJAZDOWA_Dyno += 1;
		Util.MapDebugPrint( "BRAMA_WJAZDOWA_Planted" );
	},

	NIEMIECKIE_DOWOCTWO_DOWODZENIA_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.NIEMIECKIE_DOWOCTWO_DOWODZENIA_Dyno += 1;
		Util.MapDebugPrint( "NIEMIECKIE_DOWOCTWO_DOWODZENIA_Planted" );
	},

	SCIANA_BOCZNA_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_BOCZNA_Dyno += 1;
		Util.MapDebugPrint( "SCIANA_BOCZNA_Planted" );
	},

	SCIANA_MAGAZYNU_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_MAGAZYNU_Dyno += 1;
		Util.MapDebugPrint( "SCIANA_MAGAZYNU_Planted" );
	},

	SCIANA_W_BARZE_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_W_BARZE_Dyno += 1;
		Util.MapDebugPrint( "SCIANA_W_BARZE_Planted" );
	},

	SEJF_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SEJF_Dyno += 1;
		Util.MapDebugPrint( "SEJF_Planted" );
	},

	ALIANCKIE_DOWOCTWO_DOWODZENIA_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.ALIANCKIE_DOWOCTWO_DOWODZENIA_Dyno -= 1;
		Util.MapDebugPrint( "ALIANCKIE_DOWOCTWO_DOWODZENIA_Defused" );
	},

	BRAMA_WJAZDOWA_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.BRAMA_WJAZDOWA_Dyno -= 1;
		Util.MapDebugPrint( "BRAMA_WJAZDOWA_Defused" );
	},

	NIEMIECKIE_DOWOCTWO_DOWODZENIA_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.NIEMIECKIE_DOWOCTWO_DOWODZENIA_Dyno -= 1;
		Util.MapDebugPrint( "NIEMIECKIE_DOWOCTWO_DOWODZENIA_Defused" );
	},

	SCIANA_BOCZNA_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_BOCZNA_Dyno -= 1;
		Util.MapDebugPrint( "SCIANA_BOCZNA_Defused" );
	},

	SCIANA_MAGAZYNU_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_MAGAZYNU_Dyno -= 1;
		Util.MapDebugPrint( "SCIANA_MAGAZYNU_Defused" );
	},

	SCIANA_W_BARZE_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_W_BARZE_Dyno -= 1;
		Util.MapDebugPrint( "SCIANA_W_BARZE_Defused" );
	},

	SEJF_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SEJF_Dyno -= 1;
		Util.MapDebugPrint( "SEJF_Defused" );
	},

	ALIANCKIE_DOWOCTWO_DOWODZENIA_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.ALIANCKIE_DOWOCTWO_DOWODZENIA_Dyno = 0;

		Util.MapDebugPrint( "ALIANCKIE_DOWOCTWO_DOWODZENIA_Destroyed" );
	},

	BRAMA_WJAZDOWA_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.BRAMA_WJAZDOWA_Dyno = 0;

		Util.MapDebugPrint( "BRAMA_WJAZDOWA_Destroyed" );
	},

	NIEMIECKIE_DOWOCTWO_DOWODZENIA_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.NIEMIECKIE_DOWOCTWO_DOWODZENIA_Dyno = 0;

		Util.MapDebugPrint( "NIEMIECKIE_DOWOCTWO_DOWODZENIA_Destroyed" );
	},

	SCIANA_BOCZNA_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_BOCZNA_Dyno = 0;

		Util.MapDebugPrint( "SCIANA_BOCZNA_Destroyed" );
	},

	SCIANA_MAGAZYNU_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_MAGAZYNU_Dyno = 0;

		Util.MapDebugPrint( "SCIANA_MAGAZYNU_Destroyed" );
	},

	SCIANA_W_BARZE_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SCIANA_W_BARZE_Dyno = 0;

		Util.MapDebugPrint( "SCIANA_W_BARZE_Destroyed" );
	},

	SEJF_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.SEJF_Dyno = 0;

		Util.MapDebugPrint( "SEJF_Destroyed" );
	},
	BANK_Breached = function( trigger )
	{
		if ( TestMap )
			{ return; }

		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_BRAMA_WJAZDOWA" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_SEJF" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_allies_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_allies2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_72" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis2_.*" );

		Util.MapDebugPrint( "BANK_Breached" );
	},
	
TANK_Stolen = function( trigger )
	{
		if ( TestMap )

			{ return; }

		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_ALIANCKIE_DOWOCTWO_DOWODZENIA" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMORTAR_allied_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_BRAMA_WJAZDOWA" );

		Util.MapDebugPrint( "TANK_Stolen" );
	},

DOOR_Breached = function( trigger )
	{
		if ( TestMap )
			{ return; }

		// SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNTMG42_194" );

		Util.MapDebugPrint( "DOOR_Breached" );
	},



};

global OnMapLoad = function()
{
	if ( TestMapOn )
		{ Util.AutoTestMap(); }

	// Register callback functions
	OnTrigger( "MISSING_STRING", Map.ALIANCKIE_DOWOCTWO_DOWODZENIA_Built );
	OnTrigger( "MISSING_STRING", Map.CZOLG_Built );
	OnTrigger( "MISSING_STRING", Map.NIEMIECKIE_DOWOCTWO_DOWODZENIA_Built );
	OnTrigger( "Planted at the MISSING_STRING.", Map.ALIANCKIE_DOWOCTWO_DOWODZENIA_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.BRAMA_WJAZDOWA_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.NIEMIECKIE_DOWOCTWO_DOWODZENIA_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.SCIANA_BOCZNA_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.SCIANA_MAGAZYNU_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.SCIANA_W_BARZE_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.SEJF_Planted );
	OnTrigger( "Defused at the MISSING_STRING.", Map.ALIANCKIE_DOWOCTWO_DOWODZENIA_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.BRAMA_WJAZDOWA_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.NIEMIECKIE_DOWOCTWO_DOWODZENIA_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.SCIANA_BOCZNA_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.SCIANA_MAGAZYNU_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.SCIANA_W_BARZE_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.SEJF_Defused );
	OnTrigger( "MISSING_STRING", Map.ALIANCKIE_DOWOCTWO_DOWODZENIA_Destroyed );
	OnTrigger( "MISSING_STRING", Map.BRAMA_WJAZDOWA_Destroyed );
	OnTrigger( "MISSING_STRING", Map.NIEMIECKIE_DOWOCTWO_DOWODZENIA_Destroyed );
	OnTrigger( "MISSING_STRING", Map.SCIANA_BOCZNA_Destroyed );
	OnTrigger( "MISSING_STRING", Map.SCIANA_MAGAZYNU_Destroyed );
	OnTrigger( "MISSING_STRING", Map.SCIANA_W_BARZE_Destroyed );
	OnTrigger( "MISSING_STRING", Map.SEJF_Destroyed );
	OnTrigger( "^3***^1ZNISZCZONO BRAME BANKU^3***", Map.BANK_Breached );
	OnTrigger( "^3***^1CZOLG NAPRAWIONY^3***", Map.TANK_Stolen );
	// OnTrigger( "^3***^1WYSADZONO BRAME WJAZDOWA^3***", Map.DOOR_Breached );


	//~Util.DisableGoal( ".*", true ); // all but routes
	SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_SCIANA_BOCZNA" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNTMG42_.*" );
	SetAvailableMapGoals( TEAM.AXIS, false, "MOUNTMG42_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "REPAIRMG42_.*" );
	SetAvailableMapGoals( TEAM.AXIS, false, "REPAIRMG42_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_BRAMA_WJAZDOWA" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_SEJF" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "AIRSTRIKE_axis_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_allies2_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_SCIANA_W_BARZE" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_ALIANCKIE_DOWOCTWO_DOWODZENIA" );
	SetGoalPriority( "BUILD_CZOLG" , 1.0 , TEAM.ALLIES );
	SetGoalPriority( "PLANT_SCIANA_W_BARZE" , 0.99 , TEAM.ALLIES );
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_SCIANA_MAGAZYNU" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "AIRSTRIKE_allies_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMORTAR_allied_.*" );
	SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMORTAR_allied_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "AIRSTRIKE_allies_attack_axisspawn" );
	SetAvailableMapGoals( TEAM.AXIS, false, "AIRSTRIKE_allies_attack_axisspawn" );

	// Max users per goal
	//Util.SetMaxUsers( 3, "ESCORT_.*" );
	//Util.SetMaxUsers( 3, "BUILD_CZOLG" );
	//Util.SetMaxUsers( 1, "BUILD_ALIANCKIE_DOWOCTWO_DOWODZENIA" );
	//Util.SetMaxUsers( 1, "GRENADE_.*" );
	//Util.SetMaxUsers( 1, "MOUNTMG42_.*" );

	// Camp times
	//SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	//SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=10, MaxCampTime=60} );


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

global OnBotJoin = function( bot )
{
	// Uncomment for shootable breakables
	//~bot.TargetBreakableDist = 90.0;
	// Only set MaxViewDistance on maps with limited sight (e.g. fog)
	//~bot.MaxViewDistance = 2400;
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		ESCORT_tank = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
			},
		},
		BUILD_CZOLG = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
			},
		},
		BUILD_ALIANCKIE_DOWOCTWO_DOWODZENIA = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
			},
		},
		ATTACK_allies_1 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
			},
		},
		ATTACK_allies_2 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies_3 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies_4 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies_5 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies2_1 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies2_2 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies2_3 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies2_4 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		ATTACK_allies2_5 = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		PLANT_SEJF = 
		{
			ROUTE_allied_spawn  = 
			{
				ROUTE_allied_south_exit  = 
				{
				},
				ROUTE_allied_final_exit  = 
				{
				},
				ROUTE_allied_north_exit  = 
				{
					ROUTE_allied_north_exit_2  = 
					{
					},
				},
			},
		},
		DEFEND_axis2_1 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		DEFEND_axis2_2 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		DEFEND_axis2_3 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		DEFEND_axis_1 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		DEFEND_axis_2 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		DEFEND_axis_3 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		DEFEND_axis_4 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		DEFEND_axis_5 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},
		PLANT_ALIANCKIE_DOWOCTWO_DOWODZENIA = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_axis_west_exit  = 
				{
				},
				ROUTE_axis_north_exit  = 
				{
				},
				ROUTE_axis_cp_exit  = 
				{
				},
			},
		},





	};
	Util.Routes(MapRoutes);
};
