// Updated September 4, 2018

global Map =
{
	// TANK
	Tank_Built = function()
	{
		Util.MapDebugPrint( "Tank_Built" );
	},

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

	Tank_has_reached_position_18 = function()
	{
		Wp.SetWaypointFlag( "axis_teleport_1", "closed", false );
		Util.EnableGoal( "MOUNT_tank" );
		Util.MapDebugPrint( "Tank_has_reached_position_18" );
	},

	// THE DOOR
	Door_Blown = function()
	{
		// Turn off tank completely
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Tank",
			"ESCORT_tank",
		});

		// Turn on the first objective (the mummy)
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_gold_crate" );

		// Turn on capture point (the truck)
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_truck01" );

		Util.MapDebugPrint( "Door_Blown" );
	},

	// THE MUMMY
	gold_crate_Taken = function()
	{
		Util.MapDebugPrint( "gold_crate_Taken" );
	},

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

	gold_crate_Secured = function()
	{
		// Turn off the first objective (the mummy)
		SetAvailableMapGoals( TEAM.AXIS, false, "FLAG_gold_crate" );

		// Turn on the second objective (the papyrus)
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_gold_crate_1" );

		Util.MapDebugPrint( "gold_crate_Secured" );
	},

	// THE PAPYRUS
	gold_crate_1_Taken = function()
	{
		Util.MapDebugPrint( "gold_crate_1_Taken" );
	},

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

	gold_crate_1_Secured = function()
	{
		// Turn off the second objective (the papyrus)
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"FLAG_gold_crate_1",
			"CAPPOINT_truck01"
		});

		// Turn on the truck
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"BUILD_Truck",
			"ESCORT_truck",
		});

		Util.MapDebugPrint( "gold_crate_1_Secured" );
	},

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

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

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

global OnMapLoad = function()
{
// TANK
	OnTrigger( "Tank is getting close to the pyramid!", Map.Tank_has_reached_position_18 );
	OnTrigger( "^1Axis have repaired the tank!", Map.Tank_Built );
	OnTrigger( "^4Allies have damaged the tank!", Map.Tank_Damaged );

// THE DOOR
	OnTrigger( "^1Axis have destroyed the Pyramid Door!", Map.Door_Blown );

// THE MUMMY
	OnTrigger( "Axis have stolen The Mummie!", Map.gold_crate_Taken );
	OnTrigger( "Allies have returned The Mummie!", Map.gold_crate_Returned );
	OnTrigger( "Axis captured goldbar_holder", Map.gold_crate_Secured );

// THE PAPYRUS
	OnTrigger( "Axis have stolen The Papyrus!", Map.gold_crate_1_Taken );
	OnTrigger( "Allies have returned The Papyrus!", Map.gold_crate_1_Returned );
	OnTrigger( "^1Axis is escaping with the Mummie and the Papyrus!", Map.gold_crate_1_Secured );

// TRUCK
	OnTrigger( "^1Axis have repaired the truck!", Map.Truck_Built );
	OnTrigger( "^4Allies have damaged the truck!", Map.Truck_Damaged );
	OnTrigger( "Truck is getting away!", Map.Truck_has_reached_position_30 );

	Util.DisableGoal( ".*", true );

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"BUILD_Tank",
		"ESCORT_tank",
		"DEFEND_ax.*",
	});

	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_al.*" );

	//
	//Wp.SetWaypointFlag( "axis_teleport_1", "closed", true );

	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};
