//==========================================================================================
//
//	etl_ice_v2.gm
//
//	Who                    	When		What
//------------------------------------------------------------------------------------------
//	^1{WeB}^7*^4GA^1NG$^4TA^7*	14 November 2018	Initial Script
//
//==========================================================================================
//

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

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

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

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

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

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

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

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

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

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

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

	documents_Taken = function( trigger )
	{
	
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Transmitter_1" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Transmitter_2" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Transmitter_3" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Transmitter_4" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Transmitter_5" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Docs_1" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Docs_2" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Docs_3" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Docs_4" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Docs_5" );
       SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Transmitter_1" ); 
	 SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Transmitter_2" );
	 SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Transmitter_3" );
	 SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Transmitter_4" );
	 SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Transmitter_5" );
	
		Util.MapDebugPrint( "documents_Taken" );
	},

	documents_Returned = function( trigger )
	{
	
       SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_1" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_2" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_3" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_4" );
	 SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_5" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_1" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_2" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_3" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_4" );
	 SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_5" );
       SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_1" ); 
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_2" );
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_3" );
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_4" );
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_5" );
	
		Util.MapDebugPrint( "documents_Returned" );
	},

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

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

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

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "^5Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "^1Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "^5The Allies have constructed the Guardtower!", Map.Guardtower_Built );
	OnTrigger( "^1The Axis have destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "^5The Allies have destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "^1The Axis have destroyed the Guardtower!", Map.Guardtower_Destroyed );
	OnTrigger( "^1The Axis have destroyed the Main Entrance!", Map.Main_Entrance_Destroyed );
	OnTrigger( "^1The Axis have breached the Side Wall!", Map.Side_Wall_Destroyed );
	OnTrigger( "Axis have stolen Documents!", Map.documents_Taken );
	OnTrigger( "Allies have returned Documents!", Map.documents_Returned );
	OnTrigger( "^1The Axis have transmited the Secret War Documents!", Map.documents_Secured );
	OnTrigger( "^1The Axis have captured the Forward Bunker!", Map.forward_bunker_Axis_Captured );
	OnTrigger( "^5The Allies have reclaimed the Forward Bunker!", Map.forward_bunker_Allies_Captured );
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Main_Entrance" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Side_Wall" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_2" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_3" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_4" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Transmitter_5" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_2" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_3" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_4" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Docs_5" );
	  
	 SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Side_Wall" ); 
	 SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Main_Entrance" ); 
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_1" ); 
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_2" );
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_3" );
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_4" );
	 SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Transmitter_5" );
	 SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Command_Post" ); 
	 
       SetGoalPriority("PLANT_Main_Entrance", 0.91);
	 SetGoalPriority("PLANT_Side_Wall", 0.91);

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

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

	// Camp times
	//SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );


	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 =
	{
		CHECKPOINT_forward_bunker =
		{
		},
		BUILD_Guardtower =
		{
		},
		PLANT_Guardtower =
		{
		},
		BUILD_Side_Wall =
		{
		},
		PLANT_Side_Wall =
		{
		},
		BUILD_Main_Entrance =
		{
		},
		PLANT_Main_Entrance =
		{
		},
		FLAG_documents =
		{
		},
		BUILD_Allied_Command_Post =
		{
		},
		PLANT_Allied_Command_Post =
		{
		},
		BUILD_Axis_Command_Post =
		{
		},
		PLANT_Axis_Command_Post =
		{
		},
	};
	Util.Routes(MapRoutes);
};
