//==========================================================================================
//
//	total_tankrace_beta3.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	ETPlayer	23 June 2018	Initial Script
//
//==========================================================================================
//

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

	Allied_Tank_Barrier_1_Dyno = 0,
	Allied_rebuildable_bank_door_Dyno = 0,
	Axis_Tank_Barrier_1_Dyno = 0,
	Axis_Tank_Barrier_2_Dyno = 0,
	Axis_rebuildable_bank_door_Dyno = 0,
	Command_Post_Dyno = 0,
	Tank_Barrier_Dyno = 0,
	Truck_Barrier_1_Dyno = 0,
	Truck_Barrier_1_1_Dyno = 0,
	Truck_Barrier_2_Dyno = 0,
	Truck_Barrier_2_1_Dyno = 0,

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

		Util.MapDebugPrint( "Allied_Tank_Built" );
	},

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

		Util.MapDebugPrint( "Allied_Tank_Barrier_1_Built" );
	},

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

		Util.MapDebugPrint( "Allied_Truck_Built" );
	},

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

		Util.MapDebugPrint( "Allied_rebuildable_bank_door_Built" );
	},

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

		Util.MapDebugPrint( "Axis_Tank_Built" );
	},

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

		Util.MapDebugPrint( "Axis_Tank_Barrier_1_Built" );
	},

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

		Util.MapDebugPrint( "Axis_Tank_Barrier_2_Built" );
	},

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

		Util.MapDebugPrint( "Axis_Truck_Built" );
	},

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

		Util.MapDebugPrint( "Axis_rebuildable_bank_door_Built" );
	},

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

		Util.MapDebugPrint( "Command_Post_Built" );
	},

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

		Util.MapDebugPrint( "Tank_Barrier_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Barrier_1_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Barrier_1_1_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Barrier_2_Built" );
	},

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

		Util.MapDebugPrint( "Truck_Barrier_2_1_Built" );
	},

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

		Map.Allied_Tank_Barrier_1_Dyno += 1;
		Util.MapDebugPrint( "Allied_Tank_Barrier_1_Planted" );
	},

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

		Map.Allied_rebuildable_bank_door_Dyno += 1;
		Util.MapDebugPrint( "Allied_rebuildable_bank_door_Planted" );
	},

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

		Map.Axis_Tank_Barrier_1_Dyno += 1;
		Util.MapDebugPrint( "Axis_Tank_Barrier_1_Planted" );
	},

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

		Map.Axis_Tank_Barrier_2_Dyno += 1;
		Util.MapDebugPrint( "Axis_Tank_Barrier_2_Planted" );
	},

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

		Map.Axis_rebuildable_bank_door_Dyno += 1;
		Util.MapDebugPrint( "Axis_rebuildable_bank_door_Planted" );
	},

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

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

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

		Map.Tank_Barrier_Dyno += 1;
		Util.MapDebugPrint( "Tank_Barrier_Planted" );
	},

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

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

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

		Map.Truck_Barrier_1_1_Dyno += 1;
		Util.MapDebugPrint( "Truck_Barrier_1_1_Planted" );
	},

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

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

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

		Map.Truck_Barrier_2_1_Dyno += 1;
		Util.MapDebugPrint( "Truck_Barrier_2_1_Planted" );
	},

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

		Map.Allied_Tank_Barrier_1_Dyno -= 1;
		Util.MapDebugPrint( "Allied_Tank_Barrier_1_Defused" );
	},

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

		Map.Allied_rebuildable_bank_door_Dyno -= 1;
		Util.MapDebugPrint( "Allied_rebuildable_bank_door_Defused" );
	},

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

		Map.Axis_Tank_Barrier_1_Dyno -= 1;
		Util.MapDebugPrint( "Axis_Tank_Barrier_1_Defused" );
	},

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

		Map.Axis_Tank_Barrier_2_Dyno -= 1;
		Util.MapDebugPrint( "Axis_Tank_Barrier_2_Defused" );
	},

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

		Map.Axis_rebuildable_bank_door_Dyno -= 1;
		Util.MapDebugPrint( "Axis_rebuildable_bank_door_Defused" );
	},

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

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

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

		Map.Tank_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "Tank_Barrier_Defused" );
	},

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

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

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

		Map.Truck_Barrier_1_1_Dyno -= 1;
		Util.MapDebugPrint( "Truck_Barrier_1_1_Defused" );
	},

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

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

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

		Map.Truck_Barrier_2_1_Dyno -= 1;
		Util.MapDebugPrint( "Truck_Barrier_2_1_Defused" );
	},

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

		Map.Allied_Tank_Barrier_1_Dyno = 0;

		Util.MapDebugPrint( "Allied_Tank_Barrier_1_Destroyed" );
	},

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

		Map.Allied_rebuildable_bank_door_Dyno = 0;

		Util.MapDebugPrint( "Allied_rebuildable_bank_door_Destroyed" );
	},

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

		Map.Axis_Tank_Barrier_1_Dyno = 0;

		Util.MapDebugPrint( "Axis_Tank_Barrier_1_Destroyed" );
	},

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

		Map.Axis_Tank_Barrier_2_Dyno = 0;

		Util.MapDebugPrint( "Axis_Tank_Barrier_2_Destroyed" );
	},

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

		Map.Axis_rebuildable_bank_door_Dyno = 0;

		Util.MapDebugPrint( "Axis_rebuildable_bank_door_Destroyed" );
	},

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

		Map.Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

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

		Map.Tank_Barrier_Dyno = 0;

		Util.MapDebugPrint( "Tank_Barrier_Destroyed" );
	},

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

		Map.Truck_Barrier_1_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_1_Destroyed" );
	},

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

		Map.Truck_Barrier_1_1_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_1_1_Destroyed" );
	},

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

		Map.Truck_Barrier_2_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_2_Destroyed" );
	},

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

		Map.Truck_Barrier_2_1_Dyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_2_1_Destroyed" );
	},

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

		Util.MapDebugPrint( "Allied_Gold_Taken" );
	},

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

		Util.MapDebugPrint( "Axis_Gold_Taken" );
	},

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

		Util.MapDebugPrint( "Allied_Gold_Returned" );
	},

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

		Util.MapDebugPrint( "Axis_Gold_Returned" );
	},

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

		Util.MapDebugPrint( "Allied_Gold_Secured" );
	},

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

		Util.MapDebugPrint( "Axis_Gold_Secured" );
	},

};

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

	// Register callback functions
	OnTrigger( "MISSING_STRING", Map.Allied_Tank_Built );
	OnTrigger( "MISSING_STRING", Map.Allied_Tank_Barrier_1_Built );
	OnTrigger( "MISSING_STRING", Map.Allied_Truck_Built );
	OnTrigger( "MISSING_STRING", Map.Allied_rebuildable_bank_door_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_Tank_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_Tank_Barrier_1_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_Tank_Barrier_2_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_Truck_Built );
	OnTrigger( "MISSING_STRING", Map.Axis_rebuildable_bank_door_Built );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Built );
	OnTrigger( "MISSING_STRING", Map.Tank_Barrier_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_1_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_1_1_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_2_Built );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_2_1_Built );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Allied_Tank_Barrier_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Allied_rebuildable_bank_door_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Axis_Tank_Barrier_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Axis_Tank_Barrier_2_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Axis_rebuildable_bank_door_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Command_Post_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Tank_Barrier_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Truck_Barrier_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Truck_Barrier_1_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Truck_Barrier_2_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Truck_Barrier_2_1_Planted );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Allied_Tank_Barrier_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Allied_rebuildable_bank_door_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Axis_Tank_Barrier_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Axis_Tank_Barrier_2_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Axis_rebuildable_bank_door_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Command_Post_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Tank_Barrier_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Truck_Barrier_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Truck_Barrier_1_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Truck_Barrier_2_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Truck_Barrier_2_1_Defused );
	OnTrigger( "MISSING_STRING", Map.Allied_Tank_Barrier_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Allied_rebuildable_bank_door_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_Tank_Barrier_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_Tank_Barrier_2_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_rebuildable_bank_door_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Tank_Barrier_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_1_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_2_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Truck_Barrier_2_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Allied_Gold_Taken );
	OnTrigger( "MISSING_STRING", Map.Axis_Gold_Taken );
	OnTrigger( "MISSING_STRING", Map.Allied_Gold_Returned );
	OnTrigger( "MISSING_STRING", Map.Axis_Gold_Returned );
	OnTrigger( "MISSING_STRING", Map.Allied_Gold_Secured );
	OnTrigger( "MISSING_STRING", Map.Axis_Gold_Secured );

	//~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 =
	{
		BUILD_Allied_Tank_Barrier_1 =
		{
		},
		BUILD_Tank_Barrier =
		{
		},
		BUILD_Truck_Barrier_2 =
		{
		},
		BUILD_Axis_Truck =
		{
		},
		BUILD_Axis_Tank_Barrier_1 =
		{
		},
		BUILD_Axis_rebuildable_bank_door =
		{
		},
		BUILD_Truck_Barrier_1_1 =
		{
		},
		BUILD_Allied_Tank =
		{
		},
		BUILD_Axis_Tank =
		{
		},
		BUILD_Allied_Truck =
		{
		},
		BUILD_Allied_rebuildable_bank_door =
		{
		},
		BUILD_Truck_Barrier_1 =
		{
		},
		BUILD_Axis_Tank_Barrier_2 =
		{
		},
		BUILD_Truck_Barrier_2_1 =
		{
		},
		BUILD_Command_Post =
		{
		},
		PLANT_Axis_Tank_Barrier_2 =
		{
		},
		PLANT_Allied_rebuildable_bank_door =
		{
		},
		PLANT_Command_Post =
		{
		},
		PLANT_Truck_Barrier_1_1 =
		{
		},
		PLANT_Truck_Barrier_2_1 =
		{
		},
		PLANT_Allied_Tank_Barrier_1 =
		{
		},
		PLANT_Axis_rebuildable_bank_door =
		{
		},
		PLANT_Truck_Barrier_2 =
		{
		},
		PLANT_Tank_Barrier =
		{
		},
		PLANT_Truck_Barrier_1 =
		{
		},
		PLANT_Axis_Tank_Barrier_1 =
		{
		},
		FLAG_Allied_Gold =
		{
		},
		FLAG_Axis_Gold =
		{
		},
	};
	Util.Routes(MapRoutes);
};
