//==========================================================================================
//
//	ae_sniper_challenge.gm
//
//	Who			When		What
//------------------------------------------------------------------------------------------------------------
//	jaskot			02/03/09	Converted old script to new format
//	crapshoot		03/10/10	new switch goals and enabled cabinets
//==========================================================================================
//

global Map =
{
	SnipeMap = true,

	AlliedPowerSwitchHit = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, false, "SWITCH_bPower");

		if ( Map.PowerOn ) {
			Map.PowerOn = false;
		}
		else{
			Map.PowerOn = true;
		}

		// do the opposite of what the other team just did
		SetAvailableMapGoals(TEAM.AXIS, !Map.PowerOn, "SWITCH_rPower");
		Util.MapDebugPrint( "AlliedPowerSwitchHit", true );
	},

	AxisPowerSwitchHit = function()
	{
		SetAvailableMapGoals(TEAM.AXIS, false, "SWITCH_rPower");

		if ( Map.PowerOn ) {
			Map.PowerOn = false;
		}
		else {
			Map.PowerOn = true;
		}

		// do the opposite of what the other team just did
		SetAvailableMapGoals(TEAM.ALLIES, !Map.PowerOn, "SWITCH_bPower");
		Util.MapDebugPrint( "AxisPowerSwitchHit", true );
	},

	PowerOn = true,
};

global OnMapLoad = function()
{
	// Allow the powerlines to settle....
	sleep( 1 );

	OnTrigger( "allied_lever_goto", Map.AlliedPowerSwitchHit );
	OnTrigger( "axis_lever_goto", Map.AxisPowerSwitchHit );

	Util.SetMaxUsers( 1, "SWITCH_.*" );
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=30, MaxCampTime=60});
	SetGoalPriority("SWITCH.*", 0.75);

	Util.DisableGoal(".*");
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"SNIPE_axis.*",
		"HEALTHCAB_north_healthcabinet_5",
		"AMMOCAB_north_ammocabinet_5",
		"HEALTHCAB_north_healthcabinet_2",
		"AMMOCAB_north_ammocabinet_2",
		"HEALTHCAB_north_healthcabinet_1",
		"AMMOCAB_north_ammocabinet_1",
	});

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"SNIPE_allies.*",
		"HEALTHCAB_north_healthcabinet_4",
		"AMMOCAB_north_ammocabinet_4",
		"HEALTHCAB_north_healthcabinet_3",
		"AMMOCAB_north_ammocabinet_3",
		"HEALTHCAB_north_healthcabinet",
		"AMMOCAB_north_ammocabinet",
	});

	Util.MapDebugPrint( "OnMapLoad", true);
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 100.0;
	Util.ChangeToSniperWeapons(bot);
};
