//==========================================================================================
//
//	ho_chi_minh_trail.gm
//
//	Who    	When		What
//------------------------------------------------------------------------------------------
//	BubbaG1	03 January 2014	Initial Script
//
//==========================================================================================
//

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

	Allied_Command_Post_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	bridge_1_Dyno = 0,
	bridge_2_Dyno = 0,
	bridge_3_Dyno = 0,
	stone_barrier_Dyno = 0,
	wooden_barrier_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" );
	},

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

		Util.MapDebugPrint( "bridge_1_Built" );
	},

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

		Util.MapDebugPrint( "bridge_2_Built" );
	},

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

		Util.MapDebugPrint( "bridge_3_Built" );
	},

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

		Util.MapDebugPrint( "stone_barrier_Built" );
	},

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

		Util.MapDebugPrint( "truck_Built" );
	},

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

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

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

		Map.bridge_1_Dyno += 1;
		Util.MapDebugPrint( "bridge_1_Planted" );
	},

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

		Map.bridge_2_Dyno += 1;
		Util.MapDebugPrint( "bridge_2_Planted" );
	},

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

		Map.bridge_3_Dyno += 1;
		Util.MapDebugPrint( "bridge_3_Planted" );
	},

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

		Map.stone_barrier_Dyno += 1;
		Util.MapDebugPrint( "stone_barrier_Planted" );
	},

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

		Map.wooden_barrier_Dyno += 1;
		Util.MapDebugPrint( "wooden_barrier_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" );
	},

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

		Map.bridge_1_Dyno -= 1;
		Util.MapDebugPrint( "bridge_1_Defused" );
	},

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

		Map.bridge_2_Dyno -= 1;
		Util.MapDebugPrint( "bridge_2_Defused" );
	},

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

		Map.bridge_3_Dyno -= 1;
		Util.MapDebugPrint( "bridge_3_Defused" );
	},

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

		Map.stone_barrier_Dyno -= 1;
		Util.MapDebugPrint( "stone_barrier_Defused" );
	},

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

		Map.wooden_barrier_Dyno -= 1;
		Util.MapDebugPrint( "wooden_barrier_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" );
	},

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

		Map.bridge_1_Dyno = 0;

		Util.MapDebugPrint( "bridge_1_Destroyed" );
	},

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

		Map.bridge_2_Dyno = 0;

		Util.MapDebugPrint( "bridge_2_Destroyed" );
	},

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

		Map.bridge_3_Dyno = 0;

		Util.MapDebugPrint( "bridge_3_Destroyed" );
	},

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

		Map.stone_barrier_Dyno = 0;

		Util.MapDebugPrint( "stone_barrier_Destroyed" );
	},

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

		Map.wooden_barrier_Dyno = 0;

		Util.MapDebugPrint( "wooden_barrier_Destroyed" );
	},

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

		Util.MapDebugPrint( "spawnflagforwardspawn_Axis_Captured" );
	},

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

		Util.MapDebugPrint( "spawnflagforwardspawn_Allies_Captured" );
	},

};

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.bridge_1_Built );
	OnTrigger( "MISSING_STRING", Map.bridge_2_Built );
	OnTrigger( "MISSING_STRING", Map.bridge_3_Built );
	OnTrigger( "MISSING_STRING", Map.stone_barrier_Built );
	OnTrigger( "MISSING_STRING", Map.truck_Built );
	OnTrigger( "MISSING_STRING", Map.wooden_barrier_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.bridge_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.bridge_2_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.bridge_3_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.stone_barrier_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.wooden_barrier_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.bridge_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.bridge_2_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.bridge_3_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.stone_barrier_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.wooden_barrier_Defused );
	OnTrigger( "MISSING_STRING", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "MISSING_STRING", Map.bridge_1_Destroyed );
	OnTrigger( "MISSING_STRING", Map.bridge_2_Destroyed );
	OnTrigger( "MISSING_STRING", Map.bridge_3_Destroyed );
	OnTrigger( "MISSING_STRING", Map.stone_barrier_Destroyed );
	OnTrigger( "MISSING_STRING", Map.wooden_barrier_Destroyed );
	OnTrigger( "MISSING_STRING", Map.spawnflagforwardspawn_Axis_Captured );
	OnTrigger( "MISSING_STRING", Map.spawnflagforwardspawn_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, "DEFEND_.*" );
	//Util.SetMaxUsers( 1, "GRENADE_.*" );
	//Util.SetMaxUsers( 1, "MOUNTMG42_.*" );

	// 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_wooden_barrier =
		{
		},
		BUILD_stone_barrier =
		{
		},
		BUILD_bridge_2 =
		{
		},
		BUILD_bridge_3 =
		{
		},
		BUILD_Allied_Command_Post =
		{
		},
		BUILD_bridge_1 =
		{
		},
		BUILD_truck =
		{
		},
		BUILD_Axis_Command_Post =
		{
		},
		PLANT_Axis_Command_Post =
		{
		},
		PLANT_bridge_3 =
		{
		},
		PLANT_wooden_barrier =
		{
		},
		PLANT_bridge_2 =
		{
		},
		PLANT_stone_barrier =
		{
		},
		PLANT_bridge_1 =
		{
		},
		PLANT_Allied_Command_Post =
		{
		},
		CHECKPOINT_spawnflagforwardspawn =
		{
		},
	};
	Util.Routes(MapRoutes);
};

