//==========================================================================================
//
//	ctf_poola.gm
//
//	Who                  	When		What
//------------------------------------------------------------------------------------------
//	maker@bigsighstudios.com	31 December 2017	Initial Script
//	palota	10 June 2025	switches
//==========================================================================================
//

global Map =
{
	Allies_Door_Open = function()
	{
		Util.LimitToTeam(TEAM.AXIS, "SWITCH_Allies_Door");
		SetAvailableMapGoals( TEAM.ALLIES, 1, "CAPPOINT_Allies" );
		Util.MapDebugPrint( "Allies_Door_Open" );
	},
	Allies_Door_Closed = function()
	{
		Util.LimitToTeam(TEAM.ALLIES, "SWITCH_Allies_Door");
		SetAvailableMapGoals( TEAM.ALLIES, 0, "CAPPOINT_Allies" );
		Util.MapDebugPrint( "Allies_Door_Closed" );
	},

	Axis_Door_Open = function()
	{
		Util.LimitToTeam(TEAM.ALLIES, "SWITCH_Axis_Door");
		SetAvailableMapGoals( TEAM.AXIS, 1, "CAPPOINT_Axis" );
		Util.MapDebugPrint( "Axis_Door_Open" );
	},
	Axis_Door_Closed = function()
	{
		Util.LimitToTeam(TEAM.AXIS, "SWITCH_Axis_Door");
		SetAvailableMapGoals( TEAM.AXIS, 0, "CAPPOINT_Axis" );
		Util.MapDebugPrint( "Axis_Door_Closed" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "ALLIES door is now OPEN!", Map.Allies_Door_Open );
	OnTrigger( "ALLIES door is now CLOSED!", Map.Allies_Door_Closed );

	OnTrigger( "AXIS door is now OPEN!", Map.Axis_Door_Open );
	OnTrigger( "AXIS door is now CLOSED!", Map.Axis_Door_Closed );

	OnTriggerRegion(AABB(135.519,1255.152,385.125,368.875,1536.875,459.125), RegionTrigger.DisableCombatMovement);
	OnTriggerRegion(AABB(1935.125,255.125,385.125,2163.651,536.414,459.125), RegionTrigger.DisableCombatMovement);
	OnTriggerRegion(AABB(1010.665,383.125,257.125,1380.546,625.426,331.125), RegionTrigger.DisableCombatMovement);
	OnTriggerRegion(AABB(911.980,1151.125,257.125,1277.379,1408.875,331.125), RegionTrigger.DisableCombatMovement);

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

	SetAvailableMapGoals( TEAM.ALLIES, 1, {
		"FLAG_axis_gold_crate",
		"SWITCH_Axis_Door"
	});

	SetAvailableMapGoals( TEAM.AXIS, 1, {
		"FLAG_allies_gold_crate",
		"SWITCH_Allies_Door"
	});

	SetGoalPriority( "SWITCH.*", 0.8 );

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