* Replace EntityUid parsing with NetEntity * fix * Other changes required for arch * And anothher
52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using Content.Server.Administration.Managers;
|
|
using Content.Server.EUI;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Eui;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Content.Server.Administration.UI
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class SetOutfitEui : BaseEui
|
|
{
|
|
[Dependency] private readonly IAdminManager _adminManager = default!;
|
|
private readonly NetEntity _target;
|
|
|
|
public SetOutfitEui(NetEntity entity)
|
|
{
|
|
_target = entity;
|
|
IoCManager.InjectDependencies(this);
|
|
}
|
|
|
|
public override void Opened()
|
|
{
|
|
base.Opened();
|
|
|
|
StateDirty();
|
|
_adminManager.OnPermsChanged += AdminManagerOnPermsChanged;
|
|
}
|
|
|
|
public override EuiStateBase GetNewState()
|
|
{
|
|
return new SetOutfitEuiState
|
|
{
|
|
TargetNetEntity = _target,
|
|
};
|
|
}
|
|
|
|
private void AdminManagerOnPermsChanged(AdminPermsChangedEventArgs obj)
|
|
{
|
|
// Close UI if user loses +FUN.
|
|
if (obj.Player == Player && !UserAdminFlagCheck(AdminFlags.Fun))
|
|
{
|
|
Close();
|
|
}
|
|
}
|
|
private bool UserAdminFlagCheck(AdminFlags flags)
|
|
{
|
|
return _adminManager.HasAdminFlag(Player, flags);
|
|
}
|
|
|
|
}
|
|
}
|