//==========================================================================================
//
//	mars.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
//	Martin	05 October 2010	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 1,

	Hilltop_MG_42_Built = function( trigger )
	{
		Util.MapDebugPrint( "Hilltop_MG_42_Built" );
	},

	Hilltop_MG_42_Destroyed = function( trigger )
	{
		Map.Hilltop_MG_42_Dyno = 0;

		Util.MapDebugPrint( "Hilltop_MG_42_Destroyed" );
	},

	Secret_Office_Door_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"FLAG_axis_document",
			"CAPPOINT_Radar",
		});
		Util.MapDebugPrint( "Secret_Office_Door_Destroyed" );
	},

	axis_document_Taken = function( trigger )
	{
		Util.EnableGoal( "DEFEND_Radar.*", true );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Office.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Office.*" );
		Util.MapDebugPrint( "axis_document_Taken" );
	},

	axis_document_Returned = function( trigger )
	{
		Util.DisableGoal( "DEFEND_Radar.*", true );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Office.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Office.*" );
		Util.MapDebugPrint( "axis_document_Returned" );
	},

	axis_document_Secured = function( trigger )
	{
		Util.MapDebugPrint( "axis_document_Secured" );
	},

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "Allied team has built the hilltop MG-42!", Map.Hilltop_MG_42_Built );
	OnTrigger( "Axis team has destroyed the hilltop MG-42!", Map.Hilltop_MG_42_Destroyed );
	OnTrigger( "The Allies have destroyed the Office Door!", Map.Secret_Office_Door_Destroyed );
	OnTrigger( "The Allies have stolen the Secret Document", Map.axis_document_Taken );
	OnTrigger( "The Axis have retrieved the Secret Document", Map.axis_document_Returned );
	OnTrigger( "The Allies have transmitted the Secret Document", Map.axis_document_Secured );

	Util.DisableGoal( ".*", true ); // all but routes
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Office.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ATTACK_Office.*",
		"PLANT_Secret_Office_Door",
	});

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

	// 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 )
{
};
