//==========================================================================================
//
//	ia_drang.gm	CTF Map
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	Insane	23 October 2010	Initial Script
//	Tardis  01 February 2011 Fixed Script ##TODO: Needs Routing
//==========================================================================================
//

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

	Allied_Command_Post_Dyno = 0,
	Axis_Command_Post_Dyno = 0,

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

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

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

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

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

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

	Allied_Command_Post_Destroyed = function( trigger )
	{
		Map.Allied_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		Map.Axis_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

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

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

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

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

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

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

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

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

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

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

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "Planted at the Allied Command Post.", Map.Allied_Command_Post_Planted );
	OnTrigger( "Planted at the Axis Command Post.", Map.Axis_Command_Post_Planted );
	OnTrigger( "Defused at the Allied Command Post.", Map.Allied_Command_Post_Defused );
	OnTrigger( "Defused at the Axis Command Post.", Map.Axis_Command_Post_Defused );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "^1Axis ^6capture the allied HQ", Map.flag1_Axis_Captured );
	OnTrigger( "^4Allies ^6have the HQ flag", Map.flag1_Allies_Captured );
	OnTrigger( "^1Axis ^6capture the templespawn", Map.flag2_Axis_Captured );
	OnTrigger( "^4Allies ^6capture the templespawn", Map.flag2_Allies_Captured );
	OnTrigger( "^1Axis ^6capture the sandbagbunker", Map.flag3_Axis_Captured );
	OnTrigger( "^4Allies ^6capture the sandbagbunker", Map.flag3_Allies_Captured );
	OnTrigger( "^1Axis ^6capture the topbunker", Map.flag4_Axis_Captured );
	OnTrigger( "^4Allies ^6capture the topbunker", Map.flag4_Allies_Captured );
	OnTrigger( "^1Axis ^6capture the tunnelspawn", Map.flag5_Axis_Captured );
	OnTrigger( "^4Allies ^6capture the tunnelspawn", Map.flag5_Allies_Captured );

	Util.DisableGoal( ".*" );  //##To Add Routes## Util.DisableGoal( ".*", true ); // all but routes

	Util.EnableGoal( "CHECKPOINT_.*" );
	Util.EnableGoal( "BUILD_.*" );
	Util.EnableGoal( "PLANT_.*" );

	//set max users for goals
	Util.SetMaxUsersInProgress( 1, "BUILD.*" );
	Util.SetMaxUsersInProgress( 2, "PLANT.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_.*" );
	Util.SetMaxUsersInProgress( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsersInProgress( 3, "CHECKPOINT.*" );

	// 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.TargetBreakableDist = 90.0;
};
