//==========================================================================================
//
//	greece6.gm
//
//	Who       When			What
//------------------------------------------------------------------------------------------
//	McQ		30 April 2013	Initial Script III
//
//==========================================================================================
//

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

	gate_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }
	
	SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_Axis_Entr.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Villa.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "SMOKEBOMB_Axis_smoke1" );
	//SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_villa_door" ); //Disabled to force axis to barricade
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_villa_barricade" );
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_barricade_1" );
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Entrance_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "SNIPE_Entrance_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Villa_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "SNIPE_Villa_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "CALLARTILLERY_Villa_arty1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "ARTILLERY_S_Villa_arty1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMORTAR_Villa_1" );	
	SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNTMG42_379" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "REPAIRMG42_379" );
	
		Util.MapDebugPrint( "gate_Destroyed" );
	},

	villa_barricade_Built = function( trigger ) // Trigger ok
	{
		if ( TestMap )
			{ return; }
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_InnerBarricade" );
	
		Util.MapDebugPrint( "villa_barricade_Built" );
	},

	entrance_barricade_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "entrance_barricade_Destroyed" );
	},

	villa_barricade_Destroyed = function( trigger ) // Trigger NOT ok
	{
		if ( TestMap )
			{ return; }
	
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_InnerBarricade" );
	
		Util.MapDebugPrint( "villa_barricade_Destroyed" );
	},

	villa_door_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }
	
	SetAvailableMapGoals( TEAM.AXIS, false, "SMOKEBOMB_Axis_smoke1" );
	SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_InnerVilla.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMORTAR_axis_1" );
	SetAvailableMapGoals( TEAM.AXIS, true, "REPAIRMG42_319" );
	SetAvailableMapGoals( TEAM.AXIS, true, "MOUNTMG42_319" );
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "SNIPE_Villa_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CALLARTILLERY_Villa_arty1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "MOBILEMORTAR_Villa_1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_InnerVilla_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "MOBILEMG42_MG.*" );
	
		Util.MapDebugPrint( "villa_door_Destroyed" );
	},

};

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

	// Register callback functions
	OnTrigger( "The gate is destroyed!", Map.gate_Destroyed );
	OnTrigger( "Allied team has built the door barricade", Map.villa_barricade_Built );
	OnTrigger( "MISSING_STRING", Map.entrance_barricade_Destroyed );
	OnTrigger( "Axis team had destroyed the door barricade!", Map.villa_barricade_Destroyed );
	OnTrigger( "The villa door is destroyed!", Map.villa_door_Destroyed );

	Util.DisableGoal( ".*", true ); // all but routes
	Util.EnableGoal( "AMMOCAB.*", true );
	Util.EnableGoal( "HEALTHCAB.*", true );
	
	SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_Axis_Entr.*" );
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_gate.*" );
	
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Entrance_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "SNIPE_Entrance_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_villa_barricade" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_InnerBarricade" );

	// Max users per goal
	Util.SetMaxUsers( 1, "ATTACK_.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "SNIPE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMORTAR_.*" );
	Util.SetMaxUsers( 1, "AIRSTRIKE_.*" );
	Util.SetMaxUsers( 1, "CALLARTILLERY_.*" );

	// 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 =
	{
		PLANT_barricade_1 = 
		{
			ROUTE_axis_spawn  = 
			{
				ROUTE_barricade_1  = 
				{
					ROUTE_barricade_2  = 
					{
						ROUTE_barricade_4  = 
						{
						},
					},
					ROUTE_barricade_3  = 
					{
						ROUTE_barricade_4  = 
						{
						},
					},
				},
			},
		},
	};



	Util.Routes(MapRoutes);
};
