//==========================================================================================
//
//	(um)azteca_b4.gm
//
//	Who                  	When		What
//------------------------------------------------------------------------------------------
//	maker@bigsighstudios.com	17 March 2018	Initial Script
//
//==========================================================================================
//

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

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

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

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

	t_inca_key_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, 1, "CAPPOINT_T_Inca" );
		Util.MapDebugPrint( "t_inca_key_Taken" );
	},
	t_inca_key_Returned = function( trigger )
	{
		Util.MapDebugPrint( "t_inca_key_Returned" );
	},
	t_inca_key_Secured = function( trigger )
	{
		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_Returned = function( trigger )
	{
		Util.MapDebugPrint( "serenity_key_Returned" );
	},
	serenity_key_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, 0, "FLAG_serenity_key" );
		SetAvailableMapGoals( TEAM.AXIS, 0, "CAPPOINT_Serenity" );
		SetAvailableMapGoals( TEAM.AXIS, 1, "FLAG_azteca_key" );
		Util.MapDebugPrint( "serenity_key_Secured" );
	},

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

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

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


};

global OnMapLoad = function()
{
	// Register callback functions

	//Allies keys
	OnTrigger( "Allies have stolen the Maya Key!", Map.maya_key_Taken );
	OnTrigger( "MISSING_STRING", Map.maya_key_Returned );
	OnTrigger( "Troopers team has placed the Maya Key !", Map.maya_key_Secured );

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

	OnTrigger( "Allies have stolen the Skull Key!", Map.skull_key_Taken );
	OnTrigger( "MISSING_STRING", Map.skull_key_Returned );
	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( "MISSING_STRING", Map.t_inca_key_Returned );
	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( "MISSING_STRING", Map.serenity_key_Returned );
	OnTrigger( "Raiders team has placed the Serenity Key !", Map.serenity_key_Secured );

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

	OnTrigger( "Axis have stolen the Duality Key!", Map.duality_key_Taken );
	OnTrigger( "MISSING_STRING", Map.duality_key_Returned );
	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( "MISSING_STRING", Map.inca_key_Returned );
	OnTrigger( "^7The ^1Raiders ^7have seized the Inca Key !", Map.inca_key_Secured );


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

	//Allies
	SetAvailableMapGoals( TEAM.ALLIES, 1, {
		"ATTACK_.*",
		"FLAG_maya_key",
	});

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

	// Max users per goal
	//Util.SetMaxUsers( 1, "MOUNTMG42_.*" );

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


	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 =
	{
		//Allies
		FLAG_maya_key =
		{
		},
		CAPPOINT_Maya = {},

		FLAG_stool_key =
		{
		},
		CAPPOINT_Stool = {},

		FLAG_skull_key =
		{
		},
		CAPPOINT_Skull = {},

		FLAG_t_inca_key =
		{
		},
		CAPPOINT_T_Inca = {},

		//Axis
		FLAG_serenity_key =
		{
		},
		CAPPOINT_Serenity = {},

		FLAG_azteca_key =
		{
		},
		CAPPOINT_Azteca = {},

		FLAG_duality_key =
		{
		},
		CAPPOINT_Duality = {},

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