global Map =
{
	Ammo_Cabinet_t22 = "AMMO_CABINET_t22",
	Ammo_Cabinet_t52 = "AMMO_CABINET_t52",
	Ammo_Cabinet_t3 = "AMMO_CABINET_t3",
	Ammo_Cabinet_t49 = "AMMO_CABINET_t49",
	Ammo_Cabinet_t25 = "AMMO_CABINET_t25",
	Ammo_Cabinet_t32 = "AMMO_CABINET_t32",
	Ammo_Cabinet_t18 = "AMMO_CABINET_t18",
	Ammo_Cabinet_t6 = "AMMO_CABINET_t6",
	Ammo_Cabinet_t9 = "AMMO_CABINET_t9",
	Health_Cabinet_t8 = "HEALTH_CABINET_t8",
	Health_Cabinet_t2 = "HEALTH_CABINET_t2",
	Health_Cabinet_t17 = "HEALTH_CABINET_t17",
	Health_Cabinet_t51 = "HEALTH_CABINET_t51",
	Health_Cabinet_t5 = "HEALTH_CABINET_t5",
	Health_Cabinet_t24 = "HEALTH_CABINET_t24",
	Health_Cabinet_t48 = "HEALTH_CABINET_t48",
	Health_Cabinet_t31 = "HEALTH_CABINET_t31",
	Health_Cabinet_t21 = "HEALTH_CABINET_t21",
	Build_defense2 = "MAP_CONSTRUCTION_defense2",
	Build_generator = "MAP_CONSTRUCTION_generator",
	Build_tank_construct = "MAP_CONSTRUCTION_tank_construct",
	Build_allied_radio_built = "MAP_CONSTRUCTION_allied_radio_built",
	Build_defense1 = "MAP_CONSTRUCTION_defense1",
	Build_scaffolding = "MAP_CONSTRUCTION_scaffolding",
	Build_bridge = "MAP_CONSTRUCTION_bridge",
	Build_axis_radio_built = "MAP_CONSTRUCTION_axis_radio_built",
	Destroy_bridge = "MAP_DYNAMITE_TARGET_bridge",
  Destroy_gun_2 = "MAP_DYNAMITE_TARGET_gun_2",
  Destroy_gun_1 = "MAP_DYNAMITE_TARGET_gun_1",
	Destroy_generator = "MAP_DYNAMITE_TARGET_generator",
	Destroy_sidewall = "MAP_DYNAMITE_TARGET_sidewall",
	Destroy_defense1 = "MAP_DYNAMITE_TARGET_defense1",
	Destroy_allied_radio_built = "MAP_DYNAMITE_TARGET_allied_radio_built",
	Destroy_axis_radio_built = "MAP_DYNAMITE_TARGET_axis_radio_built",
	Destroy_scaffolding = "MAP_DYNAMITE_TARGET_scaffolding",
	Destroy_defense2 = "MAP_DYNAMITE_TARGET_defense2",
	Destroy_big_wall = "MAP_DYNAMITE_TARGET_big_wall",
	Mount_466 = "MAP_MOUNTABLE_MG42_466",
	Mount_464 = "MAP_MOUNTABLE_MG42_464",
	Mount_463 = "MAP_MOUNTABLE_MG42_463",
	Mount_465 = "MAP_MOUNTABLE_MG42_465",
	Repair_465 = "MAP_REPAIR_MG42_465",
	Repair_466 = "MAP_REPAIR_MG42_466",
	Repair_464 = "MAP_REPAIR_MG42_464",
	Repair_463 = "MAP_REPAIR_MG42_463",
	Mover_tank = "MAP_MOVER_tank",
	Flag_objective01_book = "MAP_FLAG_objective01_book",

	TankStatus = 1, //tank is repaired by default

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

		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Destroy_axis_radio_built );

		Util.ResetGoals();

		print( "axis_radio_built_Built" );
	},

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

		SetAvailableMapGoals( TEAM.AXIS, true, Map.Destroy_scaffolding );

		Util.ResetGoals();

		print( "scaffolding_Built" );
	},

	defense2_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }
		
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Destroy_defense2 );

		Util.ResetGoals();

		print( "defense2_Built" );
	},

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

		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_bridge );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Destroy_defense1 );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.DEFEND_defense1 );

		Util.ResetGoals();

		print( "defense1_Built" );
	},

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

		print( "generator_Built" );
	},

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

		Map.TankStatus = 1;

		print( "tank_construct_Built" );
	},

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

		Map.TankStatus = 0;

//~		//keep them focused on the tank
//~		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_tank_construct );
			
//~		Util.ResetGoals();

		print( "tank_construct_Destroyed" );
	},

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

		SetAvailableMapGoals( TEAM.AXIS, true, Map.Destroy_bridge );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.DEFEND_defense1 );

		Util.ResetGoals();

		print( "bridge_Built" );
	},

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

		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_bridge );

		Util.ResetGoals();

		print( "allied_radio_built_Built" );
	},

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

		print( "sidewall_Destroyed" );
	},

	defense2_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }
	
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Destroy_generator );
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Destroy_sidewall );

		Util.ResetGoals();

		print( "defense2_Destroyed" );
	},

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

		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_bridge );

		Util.ResetGoals();
	
		print( "bridge_Destroyed" );
	},

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

		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_bridge );

		Util.ResetGoals();

		print( "defense1_Destroyed" );
	},

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

		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_axis_radio_built );

		Util.ResetGoals();

		print( "axis_radio_built_Destroyed" );
	},

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

		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_generator );

		Util.ResetGoals();

		print( "generator_Destroyed" );
	},

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

		print( "allied_radio_built_Destroyed" );
	},

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

		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_scaffolding );

		Util.ResetGoals();
	
		print( "scaffolding_Destroyed" );
	},

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

		print( "gun_2_Destroyed" );
	},

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

		print( "gun_1_Destroyed" );
	},

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

		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_scaffolding );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_defense2 );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_axis_radio_built );

		print( "big_wall_Destroyed" );
	},

//~ 	Allies_Capture_Flag = function( trigger )
//~ 	{
//~ 		if ( TestMapOn )
//~ 			{ ETUtil.AutoTestMap(); }
//~ 
//~ 		print( "Allies_Capture_Flag" );
//~ 	},

//~ 	Axis_Capture_Flag = function( trigger )
//~ 	{
//~ 		if ( TestMapOn )
//~ 			{ ETUtil.AutoTestMap(); }
//~ 
//~ 		print( "Axis_Capture_Flag" );
//~ 	},
};

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

	OnTrigger( "Tank Barrier #1 has been constructed.", Map.defense1_Built );
	OnTrigger( "Axis repaired the generator!", Map.generator_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.axis_radio_built_Built );
	OnTrigger( "The Tank has been repaired!", Map.tank_construct_Built );
	OnTrigger( "The Tank has been damaged!", Map.tank_construct_Destroyed );
	OnTrigger( "Bridge Completed!", Map.bridge_Built );
	OnTrigger( "Tank Barrier #2 has been constructed.", Map.defense2_Built );
	OnTrigger( "Allies have built the Scaffolding!", Map.scaffolding_Built );
	OnTrigger( "Allies Command Post constructed. Charge speed increased!", Map.allied_radio_built_Built );
	OnTrigger( "Axis have destroyed the Scaffolding!", Map.scaffolding_Destroyed );
	OnTrigger( "Allies have destroyed Gun #2!", Map.gun_2_Destroyed );
	OnTrigger( "Tank Barrier #2 has been destroyed.", Map.defense2_Destroyed );
	OnTrigger( "Bridge destroyed!", Map.bridge_Destroyed );
	OnTrigger( "Allies have destroyed Gun #1!", Map.gun_1_Destroyed );
	OnTrigger( "Allies have broken through the side wall!", Map.sidewall_Destroyed );
	OnTrigger( "Tank Barrier #1 has been destroyed.", Map.defense1_Destroyed );
	OnTrigger( "Axis have destroyed the Allies Command Post!", Map.allied_radio_built_Destroyed );
	OnTrigger( "Allies team has destroyed the Axis Command Post!", Map.axis_radio_built_Destroyed );
	OnTrigger( "Allies have damaged the generator!", Map.generator_Destroyed );
	OnTrigger( "Allies team has destroyed the Big Wall!", Map.big_wall_Destroyed );
//~ 	OnTrigger( "MISSING_STRING", Map.Allies_Capture_Flag );
//~ 	OnTrigger( "MISSING_STRING", Map.Axis_Capture_Flag );

	//~SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );
	//~SetAvailableMapGoals( TEAM.AXIS, false, ".*" );

	//move the bridge and axis cp dynamite goal to correct position
	Util.SetGoalPosition( 4094, 253, 170, "MAP_DYNAMITE_TARGET_bridge" );
	Util.SetGoalPosition( -4498, 4048, 1200, "MAP_DYNAMITE_TARGET_axis_radio_built" );

	//move certain destructables to a better place
	Util.SetGoalPosition( -4020, 2737, 688, "MAP_DYNAMITE_TARGET_sidewall" );
	Util.SetGoalPosition( -4271, 3280, 662, "MAP_DYNAMITE_TARGET_generator" );

	// Move defense1 construct to a better postition
	Util.SetGoalPosition( 1579, -5625, 193, "MAP_CONSTRUCTION_defense1" );

	//Move Bridge Construction to a better place
	Util.SetGoalPosition( 4498, -2186, 195, "MAP_CONSTRUCTION_bridge" );

	// Disable Bots trying to Blow Guns 1 & 2 they are not required
	// I guess it's better to disable them with SetAvailableMapGoals
	//	ETUtil.DisableGoal( "MAP_DYNAMITE_TARGET_gun_1" );
	//	ETUtil.DisableGoal( "MAP_DYNAMITE_TARGET_gun_2" );

	// Disable Build side wall
	//	ETUtil.DisableGoal( "MAP_CONSTRUCTION_sidewall" );


	//Allies Goals
	SetBiasGoals( 2.5, Map.Build_allied_radio_built );
	SetBiasGoals( 2.0, Map.Build_bridge );
	SetBiasGoals( 3.0, Map.Destroy_defense1 );
//~	SetBiasGoals( 1.7, Map.Destroy_gun_1 );
//~	SetBiasGoals( 1.7, Map.Destroy_gun_2 );
	SetBiasGoals( 1.6, Map.Build_scaffolding );
	SetBiasGoals( 1.6, Map.Destroy_defense2 );
	SetBiasGoals( 1.5, Map.Destroy_sidewall );
	SetBiasGoals( 1.4, Map.Destroy_axis_radio_built );
	SetBiasGoals( 1.3, Map.Destroy_generator );
	SetBiasGoals( 2.0, Map.Build_tank_construct );
	SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_allied_radio_built );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Destroy_defense1 );
	SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_bridge );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Destroy_gun_1 );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Destroy_gun_2 );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_scaffolding );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Destroy_defense2 );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Destroy_sidewall );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Destroy_axis_radio_built );
	SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_tank_construct );
	SetAvailableMapGoals( TEAM.ALLIES, false, Map.Destroy_generator );


	//Axis Goals
	SetBiasGoals( 3.0, Map.Build_defense1 );
	SetBiasGoals( 3.0, Map.Destroy_bridge );
	SetBiasGoals( 1.5, Map.Destroy_scaffolding );
	SetBiasGoals( 1.5, Map.Build_defense2 );
	SetBiasGoals( 1.1, Map.Build_axis_radio_built );
	SetBiasGoals( 1.2, Map.Build_generator );
	SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_defense1 );
	SetAvailableMapGoals( TEAM.AXIS, false, Map.Destroy_bridge );
	SetAvailableMapGoals( TEAM.AXIS, false, Map.Destroy_scaffolding );
	SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_axis_radio_built );
	SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_defense2 );
	SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_generator );
	SetAvailableMapGoals( TEAM.AXIS, false, Map.Destroy_allied_radio_built );


	print( "^6Map script loaded successfully!" );
};

// Uncomment for shootable breakables

global OnBotJoin = function( bot )
{
	//~ bot.TargetBreakableDist = 300.0;
	bot.MaxViewDistance = 4500;
};
