global Map =
{
	Ammo_Cabinet_first_ammocabinet = "AMMOCAB_first_ammocabinet",
	Ammo_Cabinet_first_ammocabinet_1 = "AMMOCAB_first_ammocabinet_1",
	Ammo_Cabinet_first_ammocabinet_2 = "AMMOCAB_first_ammocabinet_2",
	Health_Cabinet_first_healthcabinet = "HEALTHCAB_first_healthcabinet",
	Health_Cabinet_first_healthcabinet_1 = "HEALTHCAB_first_healthcabinet_1",
	Health_Cabinet_first_healthcabinet_2 = "HEALTHCAB_first_healthcabinet_2",
	Checkpoint_forward_flag = "CHECKPOINT_forward_flag",
	Flag_gold_crate1 = "FLAG_gold_crate1",
	Cappoint_real = "CAPPOINT_real",
	Build_Neutral_Command_Post = "BUILD_Neutral_Command_Post",
	Build_Tank = "BUILD_Tank",
	Build_Tank_Barrier = "BUILD_Tank_Barrier",
	Build_footbridge = "BUILD_footbridge",
	Build_footbridge_gate = "BUILD_footbridge_gate",
	Plant_Axis_Destructible = "PLANT_Axis_Destructible",
	Plant_Neutral_Command_Post = "PLANT_Neutral_Command_Post",
	Plant_Tank_Barrier = "PLANT_Tank_Barrier",
	Plant_footbridge = "PLANT_footbridge",
	Plant_footbridge_gate = "PLANT_footbridge_gate",
	Mount_bank = "MOUNTMG42_bank",
	Mount_broken = "MOUNTMG42_broken",
	Mount_brokentruck = "MOUNTMG42_brokentruck",
	Mount_flag = "MOUNTMG42_flag",
	Mount_footbridge = "MOUNTMG42_footbridge",
	Repair_bank = "REPAIRMG42_bank",
	Repair_broken = "REPAIRMG42_broken",
	Repair_brokentruck = "REPAIRMG42_brokentruck",
	Repair_flag = "REPAIRMG42_flag",
	Repair_footbridge = "REPAIRMG42_footbridge",
	Mover_tank = "MOVER_tank",

	bridge_built = false,
	gate_open = true,

	forward_flag_Axis_Captured = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"AMMOCAB_first_ammocabinet_2",
			"HEALTHCAB_first_healthcabinet_2",
			"MOUNTMG42_broken",
			"REPAIRMG42_broken",
		});


		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"AMMOCAB_first_ammocabinet_2",
			"HEALTHCAB_first_healthcabinet_2",
			"REPAIRMG42_broken",
			"MOUNTMG42_broken",
		});

		print( "forward_flag_Axis_Captured" );
	},

	forward_flag_Allies_Captured = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"AMMOCAB_first_ammocabinet_2",
			"HEALTHCAB_first_healthcabinet_2",
			"MOUNTMG42_broken",
			"REPAIRMG42_broken",
		});

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"AMMOCAB_first_ammocabinet_2",
			"HEALTHCAB_first_healthcabinet_2",
			"REPAIRMG42_broken",
			"MOUNTMG42_broken",
		});

		print( "forward_flag_Allies_Captured" );
	},

	Neutral_Command_Post_Built = function()
	{
		print( "Neutral_Command_Post_Built" );
	},

	Neutral_Command_Post_Destroyed = function()
	{
		print( "Neutral_Command_Post_Destroyed" );
	},

	Tank_Built = function()
	{
		print( "Tank_Built" );
	},

	Tank_Stolen = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"REPAIRMG42_brokentruck",
			"MOUNTMG42_brokentruck",
			"BUILD_Neutral_Command_Post",
		});

		print( "Tank_Stolen" );
	},

	Tank_Destroyed = function()
	{
		print( "Tank_Destroyed" );
	},

	Tank_Barrier_Built = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Tank_Barrier" );

		print( "Tank_Barrier_Built" );
	},

	Tank_Barrier_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Tank_Barrier" );

		print( "Tank_Barrier_Destroyed" );
	},

	Past_Barrier = function()
	{

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, false, "Plant_Tank_Barrier" );

		print( "Past_Barrier" );
	},

	Bank_Door_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Tank",
			"MOVER_tank",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"FLAG_gold_crate1",
			"PLANT_Axis_Destructible",
			"PLANT_footbridge_gate",
			"BUILD_footbridge",
		});
		SetGoalPriority( "BUILD_footbridge", 0.8 );

		print( "Bank_Door_Destroyed" );
	},

	Axis_Destructible_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Axis_Destructible" );

		print( "Axis_Destructible_Destroyed" );
	},

	footbridge_Built = function()
	{

		if ( Map.gate_open == true ) {

		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_fake.*" );
		print( "footbridge_Built_cap_real" );
		}

		Map.bridge_built = true;

		print( "footbridge_Built" );
	},

	footbridge_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_fake.*" );
		Map.bridge_built = false;

		print( "footbridge_Destroyed" );
	},

	footbridge_gate_Built = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_fake.*" );
		Map.gate_open = false;

		print( "footbridge_gate_Built" );
	},

	footbridge_gate_Destroyed = function()
	{

		if ( Map.bridge_built == true ) {

		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_fake.*" );
		print( "footbridge_gate_Destroyed_cap_real" );
		}
		Map.gate_open = true;

		print( "footbridge_gate_Destroyed" );
	},


	Spear_Taken = function()
	{
		print( "Spear_Taken" );
	},

	Spear_Returned = function()
	{
		print( "Spear_Returned" );
	},

	Spear_Captured = function()
	{
		print( "Spear_Captured" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "Axis have captured the Forward Flag!", Map.forward_flag_Axis_Captured );
	OnTrigger( "axis_capture_forward_flag", Map.forward_flag_Axis_Captured );
	OnTrigger( "Allies have captured the Forward Flag!", Map.forward_flag_Allies_Captured );
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Neutral_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Neutral_Command_Post_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Neutral_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Neutral_Command_Post_Destroyed );

	OnTrigger( "The tank has been repaired!", Map.Tank_Built );
	OnTrigger( "Axis have stolen the tank!!!", Map.Tank_Stolen );
	OnTrigger( "The tank has been damaged!", Map.Tank_Destroyed );
	OnTrigger( "The Tank Barrier has been constructed.", Map.Tank_Barrier_Built );
	OnTrigger( "The Tank Barrier has been destroyed.", Map.Tank_Barrier_Destroyed );
	OnTrigger( "sod2_axis_tankbar_past", Map.Past_Barrier );

	OnTrigger( "Axis team has destroyed the Bank Doors!", Map.Bank_Door_Destroyed );
	OnTrigger( "The Axis have destroyed the bank side wall!", Map.Axis_Destructible_Destroyed );

	OnTrigger( "Axis team has rebuilt the footbridge!", Map.footbridge_Built );
	OnTrigger( "Allied team has rebuilt the footbridge gate!", Map.footbridge_gate_Built );
	OnTrigger( "Allied team has destroyed the footbridge!", Map.footbridge_Destroyed );
	OnTrigger( "Axis team has destroyed the footbridge gate!", Map.footbridge_gate_Destroyed );

	OnTrigger( "Axis team have stolen the Spear of Destiny!", Map.Spear_Taken );
	OnTrigger( "Allied team has returned the Spear of Destiny!", Map.Spear_Returned );
	OnTrigger( "The Axis forces have secured the Spear of Destiny!", Map.Spear_Captured );

	Util.DisableGoal(".*");

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"CHECKPOINT_forward_flag",
		"BUILD_Tank",
		"MOVER_tank",
		"CAPPOINT.*",
		"HEALTHCAB_first_healthcabinet",
		"AMMOCAB_first_ammocabinet",
		"AMMOCAB_first_ammocabinet_2",
		"HEALTHCAB_first_healthcabinet_2",
	});

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"CHECKPOINT_forward_flag",
		"AMMOCAB_first_ammocabinet_2",
		"HEALTHCAB_first_healthcabinet_2",
		"BUILD_Tank_Barrier",
		"BUILD_footbridge_gate",
		"BUILD_Neutral_Command_Post",
		"PLANT_Neutral_Command_Post",
		"AMMOCAB_first_ammocabinet_1",
		"HEALTHCAB_first_healthcabinet_1",
		"MOUNTMG42_bank",
		"REPAIRMG42_bank",
		"PLANT_footbridge_gate",
	});

	Util.SetGoalOffset( 0, 20, 0, "PLANT_footbridge_gate" );
	Util.SetMaxUsersInProgress( 1, "MOUNTMG42.*" );
	SetGoalPriority( "BUILD_footbridge", 0.79 );
	SetGoalPriority( "CAPPOINT.*", 0.8 );
	SetGoalPriority( "BUILD_Tank_Barrier", 0.9 );
	SetGoalPriority( "BUILD_Neutral_Command_Post", 0.79 );
	SetGoalPriority( "PLANT_Neutral_Command_Post", 0.79 );

	SetGoalPriority( "PLANT_footbridge_gate", 0.0, TEAM.AXIS, CLASS.ENGINEER, true);

	print( "OnMapLoad" );
};
