From 80fd4a0ec61938c4139a10f54d6c03dfcbaed533 Mon Sep 17 00:00:00 2001 From: ike709 Date: Mon, 13 Jan 2025 22:20:09 -0600 Subject: [PATCH] Server hop support in `link()` (#2167) Co-authored-by: ike709 --- OpenDreamClient/Interface/DreamInterfaceManager.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OpenDreamClient/Interface/DreamInterfaceManager.cs b/OpenDreamClient/Interface/DreamInterfaceManager.cs index 4122393075..1e97447d53 100644 --- a/OpenDreamClient/Interface/DreamInterfaceManager.cs +++ b/OpenDreamClient/Interface/DreamInterfaceManager.cs @@ -41,6 +41,7 @@ internal sealed class DreamInterfaceManager : IDreamInterfaceManager { [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ITimerManager _timerManager = default!; [Dependency] private readonly IUriOpener _uriOpener = default!; + [Dependency] private readonly IGameController _gameController = default!; private readonly ISawmill _sawmill = Logger.GetSawmill("opendream.interface"); @@ -267,11 +268,17 @@ private void RxLink(MsgLink message) { return; } - // TODO: This can be a topic call or a connection to another server + // TODO: This can be a topic call + if (uri.Scheme is "http" or "https") { _uriOpener.OpenUri(message.Url); + } else if (uri.Scheme is "ss14" or "ss14s") { + if (_gameController.LaunchState.FromLauncher) + _gameController.Redial(message.Url, "link() used to connect to another server."); + else + _sawmill.Warning("link() only supports connecting to other servers when utilizing the launcher. Ignoring."); } else { - _sawmill.Warning($"Received link \"{message.Url}\" which is being ignored because it's not http or https"); + _sawmill.Warning($"Received link \"{message.Url}\" which is not supported. Ignoring."); } }