Cleaner BoundUserInterfaces (#17736)
This commit is contained in:
@@ -5,10 +5,8 @@ using Content.Shared.Actions;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.VoiceMask;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.VoiceMask;
|
||||
|
||||
@@ -71,11 +69,11 @@ public sealed partial class VoiceMaskSystem : EntitySystem
|
||||
private void OpenUI(EntityUid player, ActorComponent? actor = null)
|
||||
{
|
||||
if (!Resolve(player, ref actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!_uiSystem.TryGetUi(player, VoiceMaskUIKey.Key, out var bui))
|
||||
return;
|
||||
|
||||
_uiSystem.GetUiOrNull(player, VoiceMaskUIKey.Key)?.Open(actor.PlayerSession);
|
||||
_uiSystem.OpenUi(bui, actor.PlayerSession);
|
||||
UpdateUI(player);
|
||||
}
|
||||
|
||||
@@ -86,7 +84,8 @@ public sealed partial class VoiceMaskSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
_uiSystem.GetUiOrNull(owner, VoiceMaskUIKey.Key)?.SetState(new VoiceMaskBuiState(component.VoiceName));
|
||||
if (_uiSystem.TryGetUi(owner, VoiceMaskUIKey.Key, out var bui))
|
||||
UserInterfaceSystem.SetUiState(bui, new VoiceMaskBuiState(component.VoiceName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user