//==========================================================================================
//
//	uje_warzone.gm
//
//	Who       	When		What
//------------------------------------------------------------------------------------------
//	^1[UJE]^3Niek	31 January 2013	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 1, // please set to zero before distributing your script
	Movers = 
    { 
        "MOVER_tap", 
        "MOVER_dart_deurR", 
 	"MOVER_dart_deurL",
	"MOVER_dart_bullseye",
	"MOVER_rondje",
	"MOVER_biertje",
    }, 

	ShowMovers = false,

	Allied_Command_Post_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	Axis_MG42_Dyno = 0,
	Axis_communication_Dyno = 0,

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

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

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

		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

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

		Util.MapDebugPrint( "Axis_MG42_Built" );
	},

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

		Util.MapDebugPrint( "Tank_Built" );
	},

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

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

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

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

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

		Map.Axis_MG42_Dyno += 1;
		Util.MapDebugPrint( "Axis_MG42_Planted" );
	},

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

		Map.Axis_communication_Dyno += 1;
		Util.MapDebugPrint( "Axis_communication_Planted" );
	},

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

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

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

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

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

		Map.Axis_MG42_Dyno -= 1;
		Util.MapDebugPrint( "Axis_MG42_Defused" );
	},

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

		Map.Axis_communication_Dyno -= 1;
		Util.MapDebugPrint( "Axis_communication_Defused" );
	},

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

		Map.Allied_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

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

		Map.Axis_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

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

		Map.Axis_MG42_Dyno = 0;

		Util.MapDebugPrint( "Axis_MG42_Destroyed" );
	},

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

		Map.Axis_communication_Dyno = 0;

		Util.MapDebugPrint( "Axis_communication_Destroyed" );
	},

};

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

	// Register callback functions
	OnTrigger( "MISSING_STRING", Map.Allied_Command_Post_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_Command_Post_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_MG42_Built );
	OnTrigger( "MISSING_STRING", Map.Tank_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( "Planted at the MISSING_STRING.", Map.Axis_MG42_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Axis_communication_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( "Defused at the MISSING_STRING.", Map.Axis_MG42_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Axis_communication_Defused );
	OnTrigger( "MISSING_STRING", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_MG42_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_communication_Destroyed );

	//~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 )
{
    		bot.IgnoreTarget( GetGoal("MOVER_tap").GetEntity(), 9999 );
    		bot.IgnoreTarget( GetGoal("MOVER_dart_deurR").GetEntity(), 9999 );
    		bot.IgnoreTarget( GetGoal("MOVER_dart_deurL").GetEntity(), 9999 );
    		bot.IgnoreTarget( GetGoal("MOVER_dart_bullseye").GetEntity(), 9999 );
    		bot.IgnoreTarget( GetGoal("MOVER_rondje").GetEntity(), 9999 );
    		bot.IgnoreTarget( GetGoal("MOVER_biertje").GetEntity(), 9999 );
	// 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_Axis_MG42 =
		{
		},
		BUILD_Allied_Command_Post =
		{
		},
		BUILD_Tank =
		{
		},
		BUILD_Axis_Command_Post =
		{
		},
		PLANT_Axis_Command_Post =
		{
		},
		PLANT_Allied_Command_Post =
		{
		},
		PLANT_Axis_communication =
		{
		},
		PLANT_Axis_MG42 =
		{
		},
	};
	Util.Routes(MapRoutes);
};
