class RegisterFastTravelPointsEvent extends Event
{
	mutable editable inlined var fastTravelNodes : array< FastTravelPointData >;

	public constexpr export function GetFriendlyDescription() : String
	{
		return "Register Fast Travel Points";
	}

}

class FastTravelComponent extends ScriptableComponent
{
	private mutable instanceeditable inlined var m_fastTravelNodes : array< FastTravelPointData >;

	protected export function OnGameAttach() {}

	protected export function OnGameDetach() {}

	public const function GetFasttravelNodes() : array< FastTravelPointData >
	{
		return m_fastTravelNodes;
	}

	private function GetFastTravelSystem() : FastTravelSystem
	{
		return ( ( FastTravelSystem )( GameInstance.GetScriptableSystemsContainer( GetOwner().GetGame() ).Get( 'FastTravelSystem' ) ) );
	}

	private function PerformFastTravel( pointData : FastTravelPointData, player : GameObject )
	{
		var request : PerformFastTravelRequest;
		if( player == NULL )
		{
			return;
		}
		request = new PerformFastTravelRequest;
		request.pointData = pointData;
		request.player = player;
		GetFastTravelSystem().QueueRequest( request );
	}

	protected event OnRegisterFastTravelPoints( evt : RegisterFastTravelPointsEvent )
	{
		var i : Int32;
		var request : RegisterFastTravelPointRequest;
		for( i = 0; i < evt.fastTravelNodes.Size(); i += 1 )
		{
			m_fastTravelNodes.PushBack( evt.fastTravelNodes[ i ] );
		}
		for( i = 0; i < m_fastTravelNodes.Size(); i += 1 )
		{
			request = new RegisterFastTravelPointRequest;
			request.pointData = m_fastTravelNodes[ i ];
			request.requesterID = GetOwner().GetEntityID();
			GetFastTravelSystem().QueueRequest( request );
		}
	}

	protected event OnFastTravelAction( evt : FastTravelDeviceAction )
	{
		PerformFastTravel( evt.GetFastTravelPointData(), evt.GetExecutor() );
	}

}

