Cleaner BoundUserInterfaces (#17736)

This commit is contained in:
TemporalOroboros
2023-07-08 09:02:17 -07:00
committed by GitHub
parent 55b4fb1649
commit 3ac4cf85db
137 changed files with 1069 additions and 972 deletions

View File

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