//==========================================================================================
//
//	sfx_tatooine.gm
//
//	Who                      	When		What
//------------------------------------------------------------------------------------------
//	MickyP				04 October 2010	Initial Script
//
//==========================================================================================
//

global Map =
{
	APC_Barrier_1_Dyno = 0,
	APC_Barrier_2_Dyno = 0,
	Charge_Booster_Dyno = 0,

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

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

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

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

	APC_Barrier_1_Destroyed = function()
	{
		Map.APC_Barrier_1_Dyno = 0;

		Util.MapDebugPrint( "APC_Barrier_1_Destroyed" );
	},

	APC_Barrier_2_Destroyed = function()
	{
		Map.APC_Barrier_2_Dyno = 0;

		Util.MapDebugPrint( "APC_Barrier_2_Destroyed" );
	},

	Charge_Booster_Destroyed = function()
	{
		Map.Charge_Booster_Dyno = 0;

		Util.MapDebugPrint( "Charge_Booster_Destroyed" );
	},

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

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

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

	Doors_Blown = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNT_APC",
			"BUILD_APC",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG.*" );

		Util.MapDebugPrint( "Doors_Blown" );
	},
};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "The APC has been repaired!", Map.APC_Built );
	OnTrigger( "APC Barrier #1 has been constructed.", Map.APC_Barrier_1_Built );
	OnTrigger( "APC Barrier #2 has been constructed.", Map.APC_Barrier_2_Built );
	OnTrigger( "Troopers Charge Booster constructed. Charge speed increased !", Map.Charge_Booster_Built );
	OnTrigger( "Raiders Charge Booster constructed. Charge speed increased !", Map.Charge_Booster_Built );
	OnTrigger( "First APC Barrier destroyed.", Map.APC_Barrier_1_Destroyed );
	OnTrigger( "Second APC Barrier destroyed.", Map.APC_Barrier_2_Destroyed );
	OnTrigger( "Raiders have destroyed the Troopers Charge Booster !", Map.Charge_Booster_Destroyed );
	OnTrigger( "Troopers have destroyed the Charge Booster !", Map.Charge_Booster_Destroyed );
	OnTrigger( "MISSING_STRING", Map.axis_gold_crate_Taken );
	OnTrigger( "MISSING_STRING", Map.axis_gold_crate_Returned );
	OnTrigger( "MISSING_STRING", Map.axis_gold_crate_Secured );
	OnTrigger( "Allied team has destroyed the Warehouse Doors!", Map.Doors_Blown );

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

	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"FLAG.*",
		"MOVER_tank",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_APC" );

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

	
	print( "Omni-bot map script for " + GetMapName() + " executed." );
};
