//==========================================================================================
//
//	(um)azteca_b4.gm
//
//	Who                  	When		What
//------------------------------------------------------------------------------------------
//	maker@bigsighstudios.com	17 March 2018	Initial Script
//	palota		14 January 2025		ladders, stairs, more waypoints, Wp.CheckBlockable, ammo and health cabinets, MaxUsers
//==========================================================================================
//

global Map =
{
	Debug = 0,

	//Allies keys
	maya_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 1, "CAPPOINT_Maya" );
		Util.MapDebugPrint( "maya_key_Taken" );
	},
	maya_key_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 0, {
			"FLAG_maya_key",
			"CAPPOINT_Maya",
		});
		Util.MapDebugPrint( "maya_key_Secured" );
		sleep(8);
		Wp.CheckBlockable();
		SetAvailableMapGoals( TEAM.ALLIES, 1, "FLAG_stool_key" );
	},

	stool_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 1, "CAPPOINT_Stool" );
		Util.MapDebugPrint( "stool_key_Taken" );
	},
	stool_key_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 0, {
			"CAPPOINT_Stool",
			"FLAG_stool_key",
		});
		Util.MapDebugPrint( "stool_key_Secured" );
		sleep(8);
		Wp.CheckBlockable();
		SetAvailableMapGoals( TEAM.ALLIES, 1, "FLAG_skull_key" );
	},

	skull_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 1, "CAPPOINT_Skull" );
		Util.MapDebugPrint( "skull_key_Taken" );
	},
	skull_key_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 0, {
			"FLAG_skull_key",
			"CAPPOINT_Skull",
		});
		Util.MapDebugPrint( "skull_key_Secured" );
		sleep(8);
		Wp.CheckBlockable();
		SetAvailableMapGoals( TEAM.ALLIES, 1, "FLAG_t_inca_key" );
	},

	t_inca_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 1, "CAPPOINT_T_Inca" );
		Util.MapDebugPrint( "t_inca_key_Taken" );
	},
	t_inca_key_Secured = function( trigger )
	{
		ETUtil.WinningChat( TEAM.ALLIES );
		Util.MapDebugPrint( "t_inca_key_Secured" );
	},

	//Axis keys

	serenity_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 1, "CAPPOINT_Serenity" );
		Util.MapDebugPrint( "serenity_key_Taken" );
	},
	serenity_key_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 0, {
			"FLAG_serenity_key",
			"CAPPOINT_Serenity",
		});
		Util.MapDebugPrint( "serenity_key_Secured" );
		sleep(8);
		Wp.CheckBlockable();
		SetAvailableMapGoals( TEAM.AXIS, 1, "FLAG_azteca_key" );
	},

	azteca_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 1, "CAPPOINT_AztecA" );
		Util.MapDebugPrint( "azteca_key_Taken" );
	},
	azteca_key_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 0, {
			"FLAG_azteca_key",
			"CAPPOINT_AztecA",
		});
		Util.MapDebugPrint( "azteca_key_Secured" );
		sleep(8);
		Wp.CheckBlockable();
		SetAvailableMapGoals( TEAM.AXIS, 1, "FLAG_duality_key" );
	},

	duality_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 1, "CAPPOINT_Duality" );
		Util.MapDebugPrint( "duality_key_Taken" );
	},
	duality_key_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 0, {
			"FLAG_duality_key",
			"CAPPOINT_Duality",
		});
		Util.MapDebugPrint( "duality_key_Secured" );
		sleep(8);
		Wp.CheckBlockable();
		SetAvailableMapGoals( TEAM.AXIS, 1, "FLAG_inca_key" );
	},

	inca_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 1, "CAPPOINT_Inca" );
		Util.MapDebugPrint( "inca_key_Taken" );
	},
	inca_key_Secured = function( trigger )
	{
		ETUtil.WinningChat( TEAM.AXIS );
		Util.MapDebugPrint( "inca_key_Secured" );
	},
};

global OnMapLoad = function()
{
	//Allies keys
	OnTrigger( "Allies have stolen the Maya Key!", Map.maya_key_Taken );
	OnTrigger( "Troopers team has placed the Maya Key !", Map.maya_key_Secured );

	OnTrigger( "Allies have stolen the Stool Key!", Map.stool_key_Taken );
	OnTrigger( "Troopers team has placed the Stool Key !", Map.stool_key_Secured );

	OnTrigger( "Allies have stolen the Skull Key!", Map.skull_key_Taken );
	OnTrigger( "Troopers team has placed the Skull Key !", Map.skull_key_Secured );

	//Game end key - Allies
	OnTrigger( "Allies have stolen the Inca Key!", Map.t_inca_key_Taken );
	OnTrigger( "^7The ^2Troopers ^7have seized the Inca Key !", Map.t_inca_key_Secured );

	//Axis keys
	OnTrigger( "Axis have stolen the Serenity Key!", Map.serenity_key_Taken );
	OnTrigger( "Raiders team has placed the Serenity Key !", Map.serenity_key_Secured );

	OnTrigger( "Axis have stolen the Azteca Key!", Map.azteca_key_Taken );
	OnTrigger( "Raiders team has placed the Azteca Key !", Map.azteca_key_Secured );

	OnTrigger( "Axis have stolen the Duality Key!", Map.duality_key_Taken );
	OnTrigger( "Raiders team has placed the Duality Key !", Map.duality_key_Secured );

	//Game end key - Axis
	OnTrigger( "Axis have stolen the Inca Key!", Map.inca_key_Taken );
	OnTrigger( "^7The ^1Raiders ^7have seized the Inca Key !", Map.inca_key_Secured );


	Util.DisableGoal( ".*", true );
	Util.EnableGoal(".*CAB_.*");
	Util.DisableGoal(".*CAB_768");
	
	//Allies
	SetAvailableMapGoals( TEAM.ALLIES, 1, {
		//"ATTACK_.*",
		"FLAG_maya_key",
	});

	//Axis
	SetAvailableMapGoals( TEAM.AXIS, 1, {
		//"DEFEND_.*",
		"FLAG_serenity_key",
	});

	Util.SetMaxUsersInProgress(4, "FLAG.*");
	
	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};


global InitializeRoutes = function()
{
	MapRoutes =
	{
		//Allies
		CAPPOINT_Maya = {},

		CAPPOINT_Stool = {},

		CAPPOINT_Skull = {},

		CAPPOINT_T_Inca = {},

		//Axis
		CAPPOINT_Serenity = {},

		CAPPOINT_AztecA = {},

		CAPPOINT_Duality = {},

		CAPPOINT_Inca = {},
	};
	Util.Routes(MapRoutes);
};
