//==========================================================================================
//
//	temple_of_dal.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	ETPlayer	22 September 2010	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 1,
	ShowMovers = false,

	Main_gate_Dyno = 0,
	Side_gate_Dyno = 0,
	Wall_of_altar_Dyno = 0,

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

		Map.Main_gate_Dyno += 1;
		Util.MapDebugPrint( "Main_gate_Planted" );
	},

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

		Map.Side_gate_Dyno += 1;
		Util.MapDebugPrint( "Side_gate_Planted" );
	},

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

		Map.Wall_of_altar_Dyno += 1;
		Util.MapDebugPrint( "Wall_of_altar_Planted" );
	},

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

		Map.Main_gate_Dyno -= 1;
		Util.MapDebugPrint( "Main_gate_Defused" );
	},

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

		Map.Side_gate_Dyno -= 1;
		Util.MapDebugPrint( "Side_gate_Defused" );
	},

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

		Map.Wall_of_altar_Dyno -= 1;
		Util.MapDebugPrint( "Wall_of_altar_Defused" );
	},

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

		Map.Main_gate_Dyno = 0;

		Util.MapDebugPrint( "Main_gate_Destroyed" );
	},

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

		Map.Side_gate_Dyno = 0;

		Util.MapDebugPrint( "Side_gate_Destroyed" );
	},

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

		Map.Wall_of_altar_Dyno = 0;

		Util.MapDebugPrint( "Wall_of_altar_Destroyed" );
	},

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

		Util.MapDebugPrint( "dal_Taken" );
	},

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

		Util.MapDebugPrint( "dal_Returned" );
	},

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

		Util.MapDebugPrint( "dal_Secured" );
	},

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

		Util.MapDebugPrint( "flag_Axis_Captured" );
	},

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

		Util.MapDebugPrint( "flag_Allies_Captured" );
	},

};

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

	// Register callback functions
        OnTrigger( "Allies have breached the Main gate", Map.Main_gate_Destroyed );
	OnTrigger( "Allies have breached the Side gate", Map.Side_gate_Destroyed );
	OnTrigger( "Allies have breached the Wall of altar", Map.Wall_of_altar_Destroyed );
	OnTrigger( "Allies have stolen the Artifact of dal!", Map.dal_Taken );
	OnTrigger( "Flag returned dal!", Map.dal_Returned );
	OnTrigger( "Allied captured Artifact of dal", Map.dal_Secured );
	OnTrigger( "MISSING_STRING", Map.flag_Axis_Captured );
	OnTrigger( "MISSING_STRING", Map.flag_Allies_Captured );

	//~Util.DisableGoal( ".*", true ); // all but routes
	//~SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_.*" );
	//~SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_.*" );

	// 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_.*" );

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

	if ( Map.Debug > 1 )
		{ Util.ShowActiveGoals(); }

	print( "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;
};

