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); } ///