From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 29 May 2024 18:19:06 +0000 (+1000) Subject: Block gas analyzer updates if the UI doesn't open (#28376) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=962a1192bd0b0b4a6853baa78c330d9aa74050b1;p=space-station-14.git Block gas analyzer updates if the UI doesn't open (#28376) Fixes the gas analyzer UI coming up when used with a target. --- diff --git a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs index b42f362629..c2cdd4a107 100644 --- a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs @@ -68,7 +68,6 @@ namespace Content.Server.Atmos.EntitySystems return; } ActivateAnalyzer(uid, component, args.User, args.Target); - OpenUserInterface(uid, args.User, component); args.Handled = true; } @@ -86,6 +85,9 @@ namespace Content.Server.Atmos.EntitySystems /// private void ActivateAnalyzer(EntityUid uid, GasAnalyzerComponent component, EntityUid user, EntityUid? target = null) { + if (!TryOpenUserInterface(uid, user, component)) + return; + component.Target = target; component.User = user; if (target != null) @@ -97,7 +99,6 @@ namespace Content.Server.Atmos.EntitySystems UpdateAppearance(uid, component); EnsureComp(uid); UpdateAnalyzer(uid, component); - OpenUserInterface(uid, user, component); } /// @@ -134,12 +135,12 @@ namespace Content.Server.Atmos.EntitySystems DisableAnalyzer(uid, component); } - private void OpenUserInterface(EntityUid uid, EntityUid user, GasAnalyzerComponent? component = null) + private bool TryOpenUserInterface(EntityUid uid, EntityUid user, GasAnalyzerComponent? component = null) { if (!Resolve(uid, ref component, false)) - return; + return false; - _userInterface.OpenUi(uid, GasAnalyzerUiKey.Key, user); + return _userInterface.TryOpenUi(uid, GasAnalyzerUiKey.Key, user); } ///