//==========================================================================================
//
//	byzantine-final.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
//	d00d		28 September 2012	Minor corrections
//	Insane	21 September 2010	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 1,

	AlliesGold_Secured = 0,
	AlliesTapes_Secured = 0,
	AxisGold_Secured = 0,
	AxisRadar_Secured = 0,

	Navigation =
	{
		crates =
		{
			navigate = function( _this )
			{
				_this.Goto( Vec3(-317, -3207, 128) );
			}
		},
		crates2 =
		{
			navigate = function( _this )
			{
				_this.Goto( Vec3(2813, 1388, 160) );
			}
		},
		crates3 =
		{
			navigate = function( _this )
			{
				_this.Goto( Vec3(-4832, 2920, 240) );
			}
		},
	},

	Allied_radar_transponder_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_axis_radar" );

		Util.MapDebugPrint( "Allied_radar_transponder_Built" );
	},

	Axis_radio_intercept_unit_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_allied_radar" );

		Util.MapDebugPrint( "Axis_radio_intercept_unit_Built" );
	},

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

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

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

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

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

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

	Allied_safe_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_allied_gold" );
		Util.MapDebugPrint( "Allied_safe_Destroyed" );
	},

	Axis_radio_intercept_unit_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_axis_radar" );

		Util.MapDebugPrint( "Axis_radio_intercept_unit_Destroyed" );
	},

	Axis_safehouse_door_Destroyed = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Axis_radio_intercept_unit" );

		Util.MapDebugPrint( "Axis_safehouse_door_Destroyed" );
	},

	Axis_vault_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_axis_gold" );

		Util.MapDebugPrint( "Axis_vault_Destroyed" );
	},

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

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

	Dock_Warehouse_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Allied_radar_transponder" );
		Util.MapDebugPrint( "Dock_Warehouse_Destroyed" );
	},

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

	allied_gold_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis_truck.*" );
		Util.MapDebugPrint( "allied_gold_Taken" );
	},

	allied_radar_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis_truck.*" );
		Util.MapDebugPrint( "allied_radar_Taken" );
	},

	axis_gold_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_ally_truck.*" );
		Util.MapDebugPrint( "axis_gold_Taken" );
	},

	axis_radar_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_ally_truck.*" );
		Util.MapDebugPrint( "axis_radar_Taken" );
	},

	allied_gold_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_ally_gold" );
		Util.MapDebugPrint( "allied_gold_Returned" );
	},

	allied_radar_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_ally_radar" );
		Util.MapDebugPrint( "allied_radar_Returned" );
	},

	axis_gold_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis_gold" );
		Util.MapDebugPrint( "axis_gold_Returned" );
	},

	axis_radar_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_axis_radar" );
		Util.MapDebugPrint( "axis_radar_Returned" );
	},

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

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

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

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

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

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

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "The Allies have disassembled the radio cabinet", Map.Allied_radar_transponder_Built );
	OnTrigger( "The Axis have disassembled the radar cabinet", Map.Axis_radio_intercept_unit_Built );
	OnTrigger( "The Axis safehouse door has been constructed", Map.Axis_safehouse_door_Built );
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "Allied team has built the dock MG nest!", Map.Dock_MG_nest_Built );
	OnTrigger( "The Dock Warehouse door has been built", Map.Dock_Warehouse_Built );
	OnTrigger( "Axis team has built the North Patio MG nest!", Map.North_Patio_MG_nest_Built );
	OnTrigger( "MISSING_STRING", Map.Allied_radar_transponder_Destroyed );
	OnTrigger( "Axis have opened the Allied gold safe", Map.Allied_safe_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Axis_radio_intercept_unit_Destroyed );
	OnTrigger( "The Axis safehouse has been breached", Map.Axis_safehouse_door_Destroyed );
	OnTrigger( "Allies have opened the Axis gold safe", Map.Axis_vault_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Axis team has destroyed the dock MG nest!", Map.Dock_MG_nest_Destroyed );
	OnTrigger( "The Axis have destroyed the Dock Warehouse door", Map.Dock_Warehouse_Destroyed );
	OnTrigger( "Allied team has destroyed the North Patio MG nest!", Map.North_Patio_MG_nest_Destroyed );
	OnTrigger( "Axis have stolen the Allied gold!", Map.allied_gold_Taken );
	OnTrigger( "Axis have stolen the radar beacon!", Map.allied_radar_Taken );
	OnTrigger( "Allies have stolen the Axis gold!", Map.axis_gold_Taken );
	OnTrigger( "Allies have stolen the radio tapes!", Map.axis_radar_Taken );
	OnTrigger( "Flag returned allied_gold!", Map.allied_gold_Returned );
	OnTrigger( "Flag returned allied_radar!", Map.allied_radar_Returned );
	OnTrigger( "Flag returned axis_gold!", Map.axis_gold_Returned );
	OnTrigger( "Flag returned axis_radar!", Map.axis_radar_Returned );
	OnTrigger( "The Allies have secured the Axis gold", Map.axis_gold_Secured );
	OnTrigger( "The Allies have secured the radio codes", Map.axis_radar_Secured );
	OnTrigger( "The Axis have secured the Allied gold", Map.allied_gold_Secured );
	OnTrigger( "The Axis have secured the transponder module", Map.allied_radar_Secured );
	OnTrigger( "Axis captures the Mosque Courtyard!", Map.forward_spawn_Axis_Captured );
	OnTrigger( "Allies capture the Mosque Courtyard!", Map.forward_spawn_Allies_Captured );

	Util.DisableGoal( ".*", true ); // all but routes

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"CAPPOINT_Allies",
		"PLANT_Axis_safehouse_door",
		"PLANT_Axis_vault",
		"PLANT_Command_Post",
		"BUILD_Dock_MG_nest",
		"REPAIRMG42_Dock_MG_nest",
		"MOUNTMG42_Dock_MG_nest",
		"BUILD_Command_Post",
		"CHECKPOINT_forward_spawn",
		"HEALTHCAB_healthcabinet",
		"AMMOCAB_supplycabinet",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"CAPPOINT_Axis",
		"PLANT_Allied_safe",
		"REPAIRMG42_North_Patio_MG_nest",
		"MOUNTMG42_North_Patio_MG_nest",
		"BUILD_North_Patio_MG_nest",
		"PLANT_Dock_Warehouse",
		"PLANT_Command_Post",
		"BUILD_Command_Post",
		"CHECKPOINT_forward_spawn",
		"HEALTHCAB_healthcabinet",
		"AMMOCAB_supplycabinet",
	});

	// Max users per goal
	Util.SetMaxUsers( 1, "PLANT_.*" );
	Util.SetMaxUsers( 1, "BUILD_.*" );
	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} );

	if ( Map.Debug > 1 )
		{ Util.ShowActiveGoals(); }

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

global OnBotJoin = function( bot )
{
};
