//==========================================================================================
//
//	uje_mountain_attack.gm
//
//	Who       	When		What
//------------------------------------------------------------------------------------------
//	[UJE]Niek	19 January 2013	Initial Script
//
//==========================================================================================
//

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

	Command_Post_Dyno = 0,
	Truck_Barrier_Dyno = 0,
	warehouse_Entrance_Dyno = 0,

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

		Util.MapDebugPrint( "Command_Post_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Barrier_Built" );
	},

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

		Util.MapDebugPrint( "defence1_Built" );
	},

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

		Map.Command_Post_Dyno += 1;
		Util.MapDebugPrint( "Command_Post_Planted" );
	},

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

		Map.Truck_Barrier_Dyno += 1;
		Util.MapDebugPrint( "Truck_Barrier_Planted" );
	},

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

		Map.warehouse_Entrance_Dyno += 1;
		Util.MapDebugPrint( "warehouse_Entrance_Planted" );
	},

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

		Map.Command_Post_Dyno -= 1;
		Util.MapDebugPrint( "Command_Post_Defused" );
	},

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

		Map.Truck_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "Truck_Barrier_Defused" );
	},

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

		Map.warehouse_Entrance_Dyno -= 1;
		Util.MapDebugPrint( "warehouse_Entrance_Defused" );
	},

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

		Map.Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

		Map.Truck_Barrier_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_Destroyed" );
	},

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

		Map.warehouse_Entrance_Dyno = 0;

		Util.MapDebugPrint( "warehouse_Entrance_Destroyed" );
	},

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

		Util.MapDebugPrint( "gold_crate_Taken" );
	},

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

		Util.MapDebugPrint( "gold_crate_Returned" );
	},

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

		Util.MapDebugPrint( "gold_crate_Secured" );
	},

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

		Util.MapDebugPrint( "bunker_flag_Axis_Captured" );
	},

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

		Util.MapDebugPrint( "bunker_flag_Allies_Captured" );
	},

};

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

	// Register callback functions
	OnTrigger( "MISSING_STRING", Map.Command_Post_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_Built );
	OnTrigger( "MISSING_STRING", Map.defence1_Built );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Command_Post_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Truck_Barrier_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.warehouse_Entrance_Planted );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Command_Post_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Truck_Barrier_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.warehouse_Entrance_Defused );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_Destroyed );
	OnTrigger( "MISSING_STRING", Map.warehouse_Entrance_Destroyed );
	OnTrigger( "MISSING_STRING", Map.gold_crate_Taken );
	OnTrigger( "MISSING_STRING", Map.gold_crate_Returned );
	OnTrigger( "MISSING_STRING", Map.gold_crate_Secured );
	OnTrigger( "MISSING_STRING", Map.bunker_flag_Axis_Captured );
	OnTrigger( "MISSING_STRING", Map.bunker_flag_Allies_Captured );

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

	// 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 =
	{
		BUILD_Truck =
		{
		},
		BUILD_defence1 =
		{
		},
		BUILD_Command_Post =
		{
		},
		BUILD_Truck_Barrier =
		{
		},
		PLANT_Truck_Barrier =
		{
		},
		PLANT_Command_Post =
		{
		},
		PLANT_warehouse_Entrance =
		{
		},
		FLAG_gold_crate =
		{
		},
		CHECKPOINT_bunker_flag =
		{
		},
	};
	Util.Routes(MapRoutes);
};
