//==========================================================================================
//
//	vara.gm
//
//	Who                  	When		What
//------------------------------------------------------------------------------------------
//	maker@bigsighstudios.com	07 October 2017	Initial Script
//
//==========================================================================================
//

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

	Allied_West_beach_MG_nest_Dyno = 0,
	Axis_North_West_MG_nest_Dyno = 0,
	Axis_North_West_MG_nest_1_Dyno = 0,
	Command_Post_Dyno = 0,
	East_Beachbarrier_Dyno = 0,
	Radarcontrol_Dyno = 0,
	Truck_Barrier_1_Dyno = 0,
	Truck_Barrier_2_Dyno = 0,
	West_Beachbarrier_Dyno = 0,

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

		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Built" );
	},

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

		Util.MapDebugPrint( "Axis_North_West_MG_nest_Built" );
	},

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

		Util.MapDebugPrint( "Axis_North_West_MG_nest_1_Built" );
	},

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

		Util.MapDebugPrint( "Command_Post_Built" );
	},

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

		Util.MapDebugPrint( "East_Beachbarrier_Built" );
	},

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

		Util.MapDebugPrint( "Radarcontrol_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Barrier_1_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Barrier_2_Built" );
	},

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

		Util.MapDebugPrint( "West_Beachbarrier_Built" );
	},

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

		Map.Allied_West_beach_MG_nest_Dyno += 1;
		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Planted" );
	},

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

		Map.Axis_North_West_MG_nest_Dyno += 1;
		Util.MapDebugPrint( "Axis_North_West_MG_nest_Planted" );
	},

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

		Map.Axis_North_West_MG_nest_1_Dyno += 1;
		Util.MapDebugPrint( "Axis_North_West_MG_nest_1_Planted" );
	},

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

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

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

		Map.East_Beachbarrier_Dyno += 1;
		Util.MapDebugPrint( "East_Beachbarrier_Planted" );
	},

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

		Map.Radarcontrol_Dyno += 1;
		Util.MapDebugPrint( "Radarcontrol_Planted" );
	},

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

		Map.Truck_Barrier_1_Dyno += 1;
		Util.MapDebugPrint( "Truck_Barrier_1_Planted" );
	},

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

		Map.Truck_Barrier_2_Dyno += 1;
		Util.MapDebugPrint( "Truck_Barrier_2_Planted" );
	},

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

		Map.West_Beachbarrier_Dyno += 1;
		Util.MapDebugPrint( "West_Beachbarrier_Planted" );
	},

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

		Map.Allied_West_beach_MG_nest_Dyno -= 1;
		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Defused" );
	},

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

		Map.Axis_North_West_MG_nest_Dyno -= 1;
		Util.MapDebugPrint( "Axis_North_West_MG_nest_Defused" );
	},

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

		Map.Axis_North_West_MG_nest_1_Dyno -= 1;
		Util.MapDebugPrint( "Axis_North_West_MG_nest_1_Defused" );
	},

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

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

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

		Map.East_Beachbarrier_Dyno -= 1;
		Util.MapDebugPrint( "East_Beachbarrier_Defused" );
	},

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

		Map.Radarcontrol_Dyno -= 1;
		Util.MapDebugPrint( "Radarcontrol_Defused" );
	},

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

		Map.Truck_Barrier_1_Dyno -= 1;
		Util.MapDebugPrint( "Truck_Barrier_1_Defused" );
	},

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

		Map.Truck_Barrier_2_Dyno -= 1;
		Util.MapDebugPrint( "Truck_Barrier_2_Defused" );
	},

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

		Map.West_Beachbarrier_Dyno -= 1;
		Util.MapDebugPrint( "West_Beachbarrier_Defused" );
	},

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

		Map.Allied_West_beach_MG_nest_Dyno = 0;

		Util.MapDebugPrint( "Allied_West_beach_MG_nest_Destroyed" );
	},

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

		Map.Axis_North_West_MG_nest_Dyno = 0;

		Util.MapDebugPrint( "Axis_North_West_MG_nest_Destroyed" );
	},

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

		Map.Axis_North_West_MG_nest_1_Dyno = 0;

		Util.MapDebugPrint( "Axis_North_West_MG_nest_1_Destroyed" );
	},

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

		Map.Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

		Map.East_Beachbarrier_Dyno = 0;

		Util.MapDebugPrint( "East_Beachbarrier_Destroyed" );
	},

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

		Map.Radarcontrol_Dyno = 0;

		Util.MapDebugPrint( "Radarcontrol_Destroyed" );
	},

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

		Map.Truck_Barrier_1_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_1_Destroyed" );
	},

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

		Map.Truck_Barrier_2_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_2_Destroyed" );
	},

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

		Map.West_Beachbarrier_Dyno = 0;

		Util.MapDebugPrint( "West_Beachbarrier_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" );
	},

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

		Util.MapDebugPrint( "westbunker_flag_Axis_Captured" );
	},

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

		Util.MapDebugPrint( "westbunker_flag_Allies_Captured" );
	},

};

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

	// Register callback functions
	OnTrigger( "MISSING_STRING", Map.Allied_West_beach_MG_nest_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_North_West_MG_nest_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_North_West_MG_nest_1_Built );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Built );
	OnTrigger( "MISSING_STRING", Map.East_Beachbarrier_Built );
	OnTrigger( "MISSING_STRING", Map.Radarcontrol_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_1_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_2_Built );
	OnTrigger( "MISSING_STRING", Map.West_Beachbarrier_Built );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Allied_West_beach_MG_nest_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Axis_North_West_MG_nest_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Axis_North_West_MG_nest_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Command_Post_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.East_Beachbarrier_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Radarcontrol_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Truck_Barrier_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Truck_Barrier_2_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.West_Beachbarrier_Planted );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Allied_West_beach_MG_nest_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Axis_North_West_MG_nest_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Axis_North_West_MG_nest_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Command_Post_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.East_Beachbarrier_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Radarcontrol_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Truck_Barrier_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Truck_Barrier_2_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.West_Beachbarrier_Defused );
	OnTrigger( "MISSING_STRING", Map.Allied_West_beach_MG_nest_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_North_West_MG_nest_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_North_West_MG_nest_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Destroyed );
	OnTrigger( "MISSING_STRING", Map.East_Beachbarrier_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Radarcontrol_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_2_Destroyed );
	OnTrigger( "MISSING_STRING", Map.West_Beachbarrier_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.westbunker_flag_Axis_Captured );
	OnTrigger( "MISSING_STRING", Map.westbunker_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 =
	{
		FLAG_gold_crate =
		{
		},
		BUILD_Truck =
		{
		},
		BUILD_Truck_Barrier_1 =
		{
		},
		PLANT_Truck_Barrier_1 =
		{
		},
		BUILD_Truck_Barrier_2 =
		{
		},
		PLANT_Truck_Barrier_2 =
		{
		},
		BUILD_Axis_North_West_MG_nest =
		{
		},
		PLANT_Axis_North_West_MG_nest =
		{
		},
		BUILD_Allied_West_beach_MG_nest =
		{
		},
		PLANT_Allied_West_beach_MG_nest =
		{
		},
		CHECKPOINT_westbunker_flag =
		{
		},
		BUILD_Axis_North_West_MG_nest_1 =
		{
		},
		PLANT_Axis_North_West_MG_nest_1 =
		{
		},
		BUILD_Radarcontrol =
		{
		},
		PLANT_Radarcontrol =
		{
		},
		BUILD_East_Beachbarrier =
		{
		},
		PLANT_East_Beachbarrier =
		{
		},
		BUILD_West_Beachbarrier =
		{
		},
		PLANT_West_Beachbarrier =
		{
		},
		BUILD_Command_Post =
		{
		},
		PLANT_Command_Post =
		{
		},
	};
	Util.Routes(MapRoutes);
};
