//==========================================================================================
//
//	uje_mountain_attack.gm
//
//	Who       	When		What
//------------------------------------------------------------------------------------------
//	[UJE]Niek	19 January 2013	Initial Script
//	d00d	19 February 2013	Allied bots can complete the map now, but still lots to do
//
//==========================================================================================
//

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

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

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

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

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

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

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

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

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

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

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

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

	Command_Post_Destroyed = function( trigger )
	{
		Map.Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

	Truck_Barrier_Destroyed = function( trigger )
	{
		Map.Truck_Barrier_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_Destroyed" );
	},

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

	warehouse_Entrance_Destroyed = function( trigger )
	{
		Map.warehouse_Entrance_Dyno = 0;

		Util.MapDebugPrint( "warehouse_Entrance_Destroyed" );
	},

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

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

	gold_crate_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_truck" );
		Util.MapDebugPrint( "gold_crate_Secured" );
	},

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

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

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "The Truck has been repaired!", Map.Truck_Built );
	OnTrigger( "Truck Barrier #1 has been constructed.", Map.Truck_Barrier_Built );
	OnTrigger( "the side door has been contructed", Map.defence1_Built );
	OnTrigger( "Planted at the Command Post.", Map.Command_Post_Planted );
	OnTrigger( "Planted at the Truck Barrier.", Map.Truck_Barrier_Planted );
	OnTrigger( "Planted at the warehouse Entrance.", Map.warehouse_Entrance_Planted );
	OnTrigger( "Defused at the Command Post.", Map.Command_Post_Defused );
	OnTrigger( "Defused at the Truck Barrier.", Map.Truck_Barrier_Defused );
	OnTrigger( "Defused at the warehouse Entrance.", Map.warehouse_Entrance_Defused );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Truck Barrier #1 has been destroyed.", Map.Truck_Barrier_Destroyed );
	OnTrigger( "The Truck has been damaged!", Map.Truck_Destroyed );
	OnTrigger( "the side door has been destroyed", Map.defence1_Destroyed );
	OnTrigger( "Allies have destroyed the warehouse Entrance", Map.warehouse_Entrance_Destroyed );
	OnTrigger( "MISSING_STRING", Map.gold_crate_Taken );
	OnTrigger( "MISSING_STRING", Map.gold_crate_Returned );
	OnTrigger( "Allied team is escaping with the Radar Parts!", Map.gold_crate_Secured );
	OnTrigger( "Axis capture the Rendevezous point!", Map.bunker_flag_Axis_Captured );
	OnTrigger( "Allies capture the rendevezous point!", Map.bunker_flag_Allies_Captured );

	// Util.DisableGoal( ".*", true ); // all but routes
	SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_truck" );

	// Goal positions
	Util.AddUsePoint( "PLANT_warehouse_Entrance", Vec3(3019,1872,45) );

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 2, "BUILD_.*" );
	Util.SetMaxUsers( 1, "PLANT_.*" );
	Util.SetMaxUsers( 3, "CHECKPOINT_bunker_flag" );

	// 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 )
{
	bot.MaxViewDistance = 3000;
};

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