//==========================================================================================
//
//	uje_2_towns.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	|TP|kaos	05 November 2011	Initial Script
//
//==========================================================================================
//

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

	Allied_Command_Post_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	Garrison_MG_Nest_Dyno = 0,
	North_PAK_75mm_Gun_Dyno = 0,
	Old_City_MG_Nest_Dyno = 0,
	Old_German_Monument_Dyno = 0,
	Old_German_Monument_1_Dyno = 0,
	South_PAK_75mm_Gun_Dyno = 0,

	Ammo_Cabinet_cabinet_ammo = "AMMOCAB_cabinet_ammo",
	Health_Cabinet_cabinet_health = "HEALTHCAB_cabinet_health",
	Checkpoint_oldcityflag = "CHECKPOINT_oldcityflag",
	Build_Allied_Command_Post = "BUILD_Allied_Command_Post",
	Build_Axis_Command_Post = "BUILD_Axis_Command_Post",
	Build_Garrison_MG_Nest = "BUILD_Garrison_MG_Nest",
	Build_Old_City_MG_Nest = "BUILD_Old_City_MG_Nest",
	Plant_Allied_Command_Post = "PLANT_Allied_Command_Post",
	Plant_Axis_Command_Post = "PLANT_Axis_Command_Post",
	Plant_Garrison_MG_Nest = "PLANT_Garrison_MG_Nest",
	Plant_North_PAK_75mm_Gun = "PLANT_North_PAK_75mm_Gun",
	Plant_Old_City_MG_Nest = "PLANT_Old_City_MG_Nest",
	Plant_Old_German_Monument = "PLANT_Old_German_Monument",
	Plant_Old_German_Monument_1 = "PLANT_Old_German_Monument_1",
	Plant_South_PAK_75mm_Gun = "PLANT_South_PAK_75mm_Gun",
	Mount_Garrison_MG_Nest = "MOUNTMG42_Garrison_MG_Nest",
	Mount_Old_City_MG_Nest = "MOUNTMG42_Old_City_MG_Nest",
	Repair_Garrison_MG_Nest = "REPAIRMG42_Garrison_MG_Nest",
	Repair_Old_City_MG_Nest = "REPAIRMG42_Old_City_MG_Nest",
	Mover_train = "MOVER_train",

	Allied_Command_Post_Built = function( trigger )
	{
		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Axis_Command_Post_Built = function( trigger )
	{
		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

	Garrison_MG_Nest_Built = function( trigger )
	{
		Util.MapDebugPrint( "Garrison_MG_Nest_Built" );
	},

	Old_City_MG_Nest_Built = function( trigger )
	{
		Util.MapDebugPrint( "Old_City_MG_Nest_Built" );
	},

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

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

	Garrison_MG_Nest_Planted = function( trigger )
	{
		Map.Garrison_MG_Nest_Dyno += 1;
		Util.MapDebugPrint( "Garrison_MG_Nest_Planted" );
	},

	North_PAK_75mm_Gun_Planted = function( trigger )
	{
		Map.North_PAK_75mm_Gun_Dyno += 1;
		Util.MapDebugPrint( "North_PAK_75mm_Gun_Planted" );
	},

	Old_City_MG_Nest_Planted = function( trigger )
	{
		Map.Old_City_MG_Nest_Dyno += 1;
		Util.MapDebugPrint( "Old_City_MG_Nest_Planted" );
	},

	Old_German_Monument_Planted = function( trigger )
	{
		Map.Old_German_Monument_Dyno += 1;
		Util.MapDebugPrint( "Old_German_Monument_Planted" );
	},

	Old_German_Monument_1_Planted = function( trigger )
	{
		Map.Old_German_Monument_1_Dyno += 1;
		Util.MapDebugPrint( "Old_German_Monument_1_Planted" );
	},

	South_PAK_75mm_Gun_Planted = function( trigger )
	{
		Map.South_PAK_75mm_Gun_Dyno += 1;
		Util.MapDebugPrint( "South_PAK_75mm_Gun_Planted" );
	},

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

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

	Garrison_MG_Nest_Defused = function( trigger )
	{
		Map.Garrison_MG_Nest_Dyno -= 1;
		Util.MapDebugPrint( "Garrison_MG_Nest_Defused" );
	},

	North_PAK_75mm_Gun_Defused = function( trigger )
	{
		Map.North_PAK_75mm_Gun_Dyno -= 1;
		Util.MapDebugPrint( "North_PAK_75mm_Gun_Defused" );
	},

	Old_City_MG_Nest_Defused = function( trigger )
	{
		Map.Old_City_MG_Nest_Dyno -= 1;
		Util.MapDebugPrint( "Old_City_MG_Nest_Defused" );
	},

	Old_German_Monument_Defused = function( trigger )
	{
		Map.Old_German_Monument_Dyno -= 1;
		Util.MapDebugPrint( "Old_German_Monument_Defused" );
	},

	Old_German_Monument_1_Defused = function( trigger )
	{
		Map.Old_German_Monument_1_Dyno -= 1;
		Util.MapDebugPrint( "Old_German_Monument_1_Defused" );
	},

	South_PAK_75mm_Gun_Defused = function( trigger )
	{
		Map.South_PAK_75mm_Gun_Dyno -= 1;
		Util.MapDebugPrint( "South_PAK_75mm_Gun_Defused" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		Map.Allied_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		Map.Axis_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

	Garrison_MG_Nest_Destroyed = function( trigger )
	{
		Map.Garrison_MG_Nest_Dyno = 0;

		Util.MapDebugPrint( "Garrison_MG_Nest_Destroyed" );
	},

	North_PAK_75mm_Gun_Destroyed = function( trigger )
	{
		Map.North_PAK_75mm_Gun_Dyno = 0;

		Util.MapDebugPrint( "North_PAK_75mm_Gun_Destroyed" );
	},

	Old_City_MG_Nest_Destroyed = function( trigger )
	{
		Map.Old_City_MG_Nest_Dyno = 0;

		Util.MapDebugPrint( "Old_City_MG_Nest_Destroyed" );
	},

	Old_German_Monument_Destroyed = function( trigger )
	{
		Map.Old_German_Monument_Dyno = 0;

		Util.MapDebugPrint( "Old_German_Monument_Destroyed" );
	},

	Old_German_Monument_1_Destroyed = function( trigger )
	{
		Map.Old_German_Monument_1_Dyno = 0;

		Util.MapDebugPrint( "Old_German_Monument_1_Destroyed" );
	},

	South_PAK_75mm_Gun_Destroyed = function( trigger )
	{
		Map.South_PAK_75mm_Gun_Dyno = 0;

		Util.MapDebugPrint( "South_PAK_75mm_Gun_Destroyed" );
	},

	oldcityflag_Axis_Captured = function( trigger )
	{
		Util.MapDebugPrint( "oldcityflag_Axis_Captured" );
	},

	oldcityflag_Allies_Captured = function( trigger )
	{
		Util.MapDebugPrint( "oldcityflag_Allies_Captured" );
	},

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "The Garrison MG Nest has been constructed!", Map.Garrison_MG_Nest_Built );
	OnTrigger( "The Old City MG Nest has been constructed!", Map.Old_City_MG_Nest_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.Garrison_MG_Nest_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.North_PAK_75mm_Gun_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Old_City_MG_Nest_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Old_German_Monument_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.Old_German_Monument_1_Planted );
	OnTrigger( "Planted at the MISSING_STRING.", Map.South_PAK_75mm_Gun_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.Garrison_MG_Nest_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.North_PAK_75mm_Gun_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Old_City_MG_Nest_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Old_German_Monument_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.Old_German_Monument_1_Defused );
	OnTrigger( "Defused at the MISSING_STRING.", Map.South_PAK_75mm_Gun_Defused );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "The Garrison MG Nest has been damaged!", Map.Garrison_MG_Nest_Destroyed );
	OnTrigger( "Allies have destroyed the North Anti-Tank Gun!", Map.North_PAK_75mm_Gun_Destroyed );
	OnTrigger( "The Old City MG Nest has been damaged!", Map.Old_City_MG_Nest_Destroyed );
	OnTrigger( "Allies have breached the Old City wall", Map.Old_German_Monument_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Old_German_Monument_1_Destroyed );
	OnTrigger( "Allied team has destroyed the South Anti-Tank Gun!", Map.South_PAK_75mm_Gun_Destroyed );
	OnTrigger( "Axis reclaim the Old City!", Map.oldcityflag_Axis_Captured );
	OnTrigger( "Allies capture the Old City!", Map.oldcityflag_Allies_Captured );

	//~Util.DisableGoal( ".*", true ); // all but routes
	//~SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Old_German_Monument_1" );

	// 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 )
{
};
