//==========================================================================================
//
//	tnt_intrusion.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	TNT|*Cinco	22 May 2013	Initial Script
//
//==========================================================================================
//

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

	Command_Post_Dyno = 0,
	Control_Antenne_Dyno = 0,
	Door_Control_Antenne_Dyno = 0,
	Door_Garage_Dyno = 0,
	Wall_Bunker_Dyno = 0,
	Water_Pump_Dyno = 0,

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

		Util.MapDebugPrint( "Command_Post_Built" );
	},

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

		Util.MapDebugPrint( "Door_Control_Antenne_Built" );
	},

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

		Util.MapDebugPrint( "Door_Garage_Built" );
	},

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

		Util.MapDebugPrint( "Water_Pump_Built" );
	},

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

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

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

		Map.Control_Antenne_Dyno += 1;
		Util.MapDebugPrint( "Control_Antenne_Planted" );
	},

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

		Map.Door_Control_Antenne_Dyno += 1;
		Util.MapDebugPrint( "Door_Control_Antenne_Planted" );
	},

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

		Map.Door_Garage_Dyno += 1;
		Util.MapDebugPrint( "Door_Garage_Planted" );
	},

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

		Map.Wall_Bunker_Dyno += 1;
		Util.MapDebugPrint( "Wall_Bunker_Planted" );
	},

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

		Map.Water_Pump_Dyno += 1;
		Util.MapDebugPrint( "Water_Pump_Planted" );
	},

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

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

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

		Map.Control_Antenne_Dyno -= 1;
		Util.MapDebugPrint( "Control_Antenne_Defused" );
	},

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

		Map.Door_Control_Antenne_Dyno -= 1;
		Util.MapDebugPrint( "Door_Control_Antenne_Defused" );
	},

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

		Map.Door_Garage_Dyno -= 1;
		Util.MapDebugPrint( "Door_Garage_Defused" );
	},

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

		Map.Wall_Bunker_Dyno -= 1;
		Util.MapDebugPrint( "Wall_Bunker_Defused" );
	},

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

		Map.Water_Pump_Dyno -= 1;
		Util.MapDebugPrint( "Water_Pump_Defused" );
	},

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

		Map.Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

		Map.Control_Antenne_Dyno = 0;

		Util.MapDebugPrint( "Control_Antenne_Destroyed" );
	},

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

		Map.Door_Control_Antenne_Dyno = 0;

		Util.MapDebugPrint( "Door_Control_Antenne_Destroyed" );
	},

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

		Map.Door_Garage_Dyno = 0;

		Util.MapDebugPrint( "Door_Garage_Destroyed" );
	},

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

		Map.Wall_Bunker_Dyno = 0;

		Util.MapDebugPrint( "Wall_Bunker_Destroyed" );
	},
	
	Wall_Bunker_bot_Destroyed = function( trigger )
	{
		TestMap.Pass();

		Util.MapDebugPrint( "Wall_Bunker_bot_Destroyed" );
	},
	
	Water_Pump_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Water_Pump_Dyno = 0;

		Util.MapDebugPrint( "Water_Pump_Destroyed" );
	},

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

		Util.MapDebugPrint( "forward_spawn_Axis_Captured" );
	},

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

		Util.MapDebugPrint( "forward_spawn_Allies_Captured" );
	},

};

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

	// Register callback functions
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "Axis Have Built the DOOR CONTROL ANTENNE", Map.Door_Control_Antenne_Built );
	OnTrigger( "Axis Have built The Garage Access" , Map.Door_Garage_Built );
	OnTrigger( "Allies have built the Water Pump! Old mines Clearing.", Map.Water_Pump_Built );
	OnTrigger( "Planted at the Command Post.", Map.Command_Post_Planted );
	OnTrigger( "Planted at the Control Antenne.", Map.Control_Antenne_Planted );
	OnTrigger( "Planted at Door Control Antenne.", Map.Door_Control_Antenne_Planted );
	OnTrigger( "Planted at the Door Garage.", Map.Door_Garage_Planted );
	OnTrigger( "Planted at Wall Bunker.", Map.Wall_Bunker_Planted );
	OnTrigger( "Planted at the Water Pump.", Map.Water_Pump_Planted );
	OnTrigger( "Defused at the Command Post.", Map.Command_Post_Defused );
	OnTrigger( "Defused at the Control Antenne.", Map.Control_Antenne_Defused );
	OnTrigger( "Defused at Door Control Antenne.", Map.Door_Control_Antenne_Defused );
	OnTrigger( "Defused at the Door Garage.", Map.Door_Garage_Defused );
	OnTrigger( "Defused at the Wall Bunker.", Map.Wall_Bunker_Defused );
	OnTrigger( "Defused at the Water Pump.", Map.Water_Pump_Defused );
	OnTrigger( "The Allies have breached the Wall Bunker!", Map.Wall_Bunker_bot_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed Axis ANTENNA CONTROL", Map.Control_Antenne_Destroyed );
	OnTrigger( "Allied team has destroyed THE DOOR CONTROL ANTENNE!", Map.Door_Control_Antenne_Destroyed );
	OnTrigger( "Allies have Destroyed The Garage Access", Map.Door_Garage_Destroyed );
	OnTrigger( "The Allies have breached the Wall Bunker!", Map.Wall_Bunker_Destroyed );
	OnTrigger( "Axis have damaged the Water Pump! Old mines flooding.", Map.Water_Pump_Destroyed );
	OnTrigger( "Axis capture the forward spawn!", Map.forward_spawn_Axis_Captured );
	OnTrigger( "Allies capture the forward spawn!", Map.forward_spawn_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;
};
