//==========================================================================================
//
//	etc_race.gm
//
//	Who              	When		What
//------------------------------------------------------------------------------------------
//	^1W^4OLF ^1E^4NSTEIN	26 March 2021	Initial Script
//
//==========================================================================================
//

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

	allies_gold_Taken = function( trigger )
	{
		
		SetAvailableMapGoals( TEAM.AXIS, false, "FLAG_allies_gold" );
		
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "allies_gold_Taken" );
	},

	axis_gold_Taken = function( trigger )
	{
		
		SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_axis_gold" );
		
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "axis_gold_Taken" );
	},

	allies_gold_Returned = function( trigger )
	{
		
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_allies_gold" );
		
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "allies_gold_Returned" );
	},

	axis_gold_Returned = function( trigger )
	{
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_axis_gold" );
		
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "axis_gold_Returned" );
	},

	allies_gold_Secured = function( trigger )
	{
		
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_axis_gold" );
		
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "allies_gold_Secured" );
	},

	axis_gold_Secured = function( trigger )
	{
		
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_allies_gold" );
		
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "axis_gold_Secured" );
	},
	
		Axis_Fuel_Secured_1 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_2" );
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_1" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_1" );
	},
	
	Axis_Fuel_Secured_2 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_2" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_3" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_2" );
	},
	
	Axis_Fuel_Secured_3 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_3" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_4" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_3" );
	},
	
	Axis_Fuel_Secured_4 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_4" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_5" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_4" );
	},
	
	Axis_Fuel_Secured_5 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_5" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_6" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_5" );
	},
	
	Axis_Fuel_Secured_6 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_6" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_7" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_6" );
	},
	
	Axis_Fuel_Secured_7 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_7" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_8" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_7" );
	},
	
	Axis_Fuel_Secured_8 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_8" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_9" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_8" );
	},
	
	Axis_Fuel_Secured_9 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_9" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_10" );

		Util.MapDebugPrint( "Axis_Fuel_Secured_9" );
	},
	
	Allied_Fuel_Secured_1 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_1" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_2" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_1" );
	},
	
	Allied_Fuel_Secured_2 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_2" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_3" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_2" );
	},
	
	Allied_Fuel_Secured_3 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_3" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_4" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_3" );
	},
	
	Allied_Fuel_Secured_4 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_4" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_5" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_4" );
	},
	
	Allied_Fuel_Secured_5 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_5" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_6" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_5" );
	},
	
	Allied_Fuel_Secured_6 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_6" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_7" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_6" );
	},
	
	Allied_Fuel_Secured_7 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_7" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_8" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_7" );
	},
	
	Allied_Fuel_Secured_8 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_8" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_9" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_8" );
	},
	
	Allied_Fuel_Secured_9 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_9" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_10" );

		Util.MapDebugPrint( "Allied_Fuel_Secured_9" );
	},
	
	Allies_Return_Gold = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_allies_gold" );

		Util.MapDebugPrint( "Allies_Return_Gold" );
	},
	
	Axis_Return_Gold = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_axis_gold" );

		Util.MapDebugPrint( "Axis_Return_Gold" );
	},
	
	Allied_Carpet_Fuelled = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_axis_gold" );

		Util.MapDebugPrint( "Allied_Carpet_Fuelled" );
	},
	
	Axis_Carpet_Fuelled = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_allies_gold" );

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

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

	// Register callback functions
	OnTrigger( "^1The Axis have stolen The Gold!", Map.allies_gold_Taken );
	OnTrigger( "^4The Allies have stolen The Gold!", Map.axis_gold_Taken );
	OnTrigger( "Allies have returned The Allies Gold Bars!", Map.allies_gold_Returned );
	OnTrigger( "^Axis have returned The Axis Gold Bars!", Map.axis_gold_Returned );
	OnTrigger( "The allies carpet has new fuel", Map.allies_gold_Secured );
	OnTrigger( "^4Allies have returned The Gold!", Map.Allies_Return_Gold );
	OnTrigger( "^1Axis have returned The Gold!", Map.Axis_Return_Gold );
	OnTrigger( "The allies carpet has new fuel", Map.Allied_Carpet_Fuelled);
	OnTrigger( "The axis carpet has new fuel", Map.Axis_Carpet_Fuelled);
	OnTrigger( "(R1) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_1 );
	OnTrigger( "(R2) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_2 );
	OnTrigger( "(R3) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_3 );
	OnTrigger( "(R4) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_4 );
	OnTrigger( "(R5) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_5 );
	OnTrigger( "(R6) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_6 );
	OnTrigger( "(R7) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_7 );
	OnTrigger( "(R8) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_8 );
	OnTrigger( "(R9) The Axis Carpet needs more fuel !!!", Map.Axis_Fuel_Secured_9 );
	OnTrigger( "(B1) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_1 );
	OnTrigger( "(B2) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_2 );
	OnTrigger( "(B3) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_3 );
	OnTrigger( "(B4) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_4 );
	OnTrigger( "(B5) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_5 );
	OnTrigger( "(B6) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_6 );
	OnTrigger( "(B7) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_7 );
	OnTrigger( "(B8) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_8 );
	OnTrigger( "(B9) The Allies Carpet needs more fuel !!!", Map.Allied_Fuel_Secured_9 );
	
	SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_axis_carpet_1" );
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis_gold_1" );
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis_gold_2" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_2" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_3" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_4" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_5" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_6" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_7" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_8" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_9" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_axis_carpet_10" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_allied_carpet_1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_allied_gold_1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_allied_gold_2" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_2" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_3" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_4" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_5" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_6" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_7" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_8" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_9" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_allied_carpet_10" );

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

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


	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 =
	{
		FLAG_axis_gold =
		{
		},
		FLAG_allies_gold =
		{
		},
	};
	Util.Routes(MapRoutes);
};
