//==========================================================================================
//
//	chateau_norvegien.gm
//
//	Who                  	When		What
//------------------------------------------------------------------------------------------
//	maker@bigsighstudios.com	11 October 2017	Initial Script
//
//==========================================================================================
//

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

	Big_Gate_Dyno = 0,
	fence_Dyno = 0,

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

		Util.MapDebugPrint( "Big_Gate_Built" );
	},

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

		Util.MapDebugPrint( "fence_Built" );
	},

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

		Map.Big_Gate_Dyno += 1;
		Util.DisableGoal("DEFUSE_Big_Gate", false);
		Util.MapDebugPrint( "Big_Gate_Planted" );
	},

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

		Map.fence_Dyno += 1;
		Util.DisableGoal("DEFUSE_fence", false);
		Util.MapDebugPrint( "fence_Planted" );
	},

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

		Map.Big_Gate_Dyno -= 1;
		Util.MapDebugPrint( "Big_Gate_Defused" );
	},

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

		Map.fence_Dyno -= 1;
		Util.MapDebugPrint( "fence_Defused" );
	},

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

		Map.Big_Gate_Dyno = 0;
		Util.DisableGoal("BUILD_Big_Gate", false);

		Util.MapDebugPrint( "Big_Gate_Destroyed" );
	},

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

		Map.fence_Dyno = 0;
		Util.DisableGoal("BUILD_fence", false);

		Util.MapDebugPrint( "fence_Destroyed" );
	},

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

		Util.MapDebugPrint( "radarbox_Taken" );
	},

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

		Util.MapDebugPrint( "radarbox2_Taken" );
	},

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

		Util.MapDebugPrint( "radarbox3_Taken" );
	},

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

		Util.MapDebugPrint( "radarbox_Returned" );
	},

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

		Util.MapDebugPrint( "radarbox2_Returned" );
	},

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

		Util.MapDebugPrint( "radarbox3_Returned" );
	},

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

		Util.MapDebugPrint( "radarbox_Secured" );
	},

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

		Util.MapDebugPrint( "radarbox2_Secured" );
	},

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

		Util.MapDebugPrint( "radarbox3_Secured" );
	},

};

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

	// Register callback functions
	OnTrigger( "MISSING_STRING", Map.Big_Gate_Built );
	OnTrigger( "MISSING_STRING", Map.fence_Built );
	OnTrigger( "Planted at the Big Gate.", Map.Big_Gate_Planted );
	OnTrigger( "Planted at The fence.", Map.fence_Planted );
	OnTrigger( "Defused at the Big Gate.", Map.Big_Gate_Defused );
	OnTrigger( "Defused at the fence.", Map.fence_Defused );
	OnTrigger( "The Big Gate has been destroyed!", Map.Big_Gate_Destroyed );
	OnTrigger( "The fence has been destroyed!", Map.fence_Destroyed );
	OnTrigger( "MISSING_STRING", Map.radarbox_Taken );
	OnTrigger( "MISSING_STRING", Map.radarbox2_Taken );
	OnTrigger( "MISSING_STRING", Map.radarbox3_Taken );
	OnTrigger( "MISSING_STRING", Map.radarbox_Returned );
	OnTrigger( "MISSING_STRING", Map.radarbox2_Returned );
	OnTrigger( "MISSING_STRING", Map.radarbox3_Returned );
	OnTrigger( "MISSING_STRING", Map.radarbox_Secured );
	OnTrigger( "MISSING_STRING", Map.radarbox2_Secured );
	OnTrigger( "MISSING_STRING", Map.radarbox3_Secured );

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

	Util.SetGoalPosition(-24.000, 1592.000, -124.000, "PLANT_Big_Gate");

	Util.DisableGoal( "MOUNTMG42_.*", false );
	Util.DisableGoal( "DEFUSE_.*", false );

	// Max users per goal
	Util.SetMaxUsers( 1, "ATTACK_.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "SNIPE_.*" );
	Util.SetMaxUsers( 0, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMORTAR_.*" );
	Util.SetMaxUsers( 1, "AIRSTRIKE_.*" );
	Util.SetMaxUsers( 1, "CALLARTILLERY_.*" );

	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=3, MaxCampTime=5} );
	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 =
	{
		BUILD_Big_Gate =
		{
		},
		PLANT_Big_Gate =
		{
		},
		BUILD_fence =
		{
		},
		PLANT_fence =
		{
		},
		FLAG_radarbox =
		{
		},
		FLAG_radarbox2 =
		{
		},
		FLAG_radarbox3 =
		{
		},
	};
	Util.Routes(MapRoutes);
};
