Fix context menu for admin menu (#20030)

This commit is contained in:
metalgearsloth
2023-09-12 14:34:20 +10:00
committed by GitHub
parent ace2ddbb73
commit 748ca93f5c
3 changed files with 6 additions and 6 deletions

View File

@@ -121,7 +121,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
player.Antag ? "YES" : "NO",
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
player.Connected);
entry.PlayerUid = _entManager.GetEntity(player.NetEntity);
entry.PlayerEntity = player.NetEntity;
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
PlayerList.AddChild(entry);

View File

@@ -8,7 +8,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab;
[GenerateTypedNameReferences]
public sealed partial class PlayerTabEntry : ContainerButton
{
public EntityUid? PlayerUid;
public NetEntity? PlayerEntity;
public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected)
{

View File

@@ -154,16 +154,16 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
private void PlayerTabEntryPressed(ButtonEventArgs args)
{
if (args.Button is not PlayerTabEntry button
|| button.PlayerUid == null)
|| button.PlayerEntity == null)
return;
var uid = button.PlayerUid.Value;
var entity = button.PlayerEntity.Value;
var function = args.Event.Function;
if (function == EngineKeyFunctions.UIClick)
_conHost.ExecuteCommand($"vv {uid}");
_conHost.ExecuteCommand($"vv {entity}");
else if (function == EngineKeyFunctions.UseSecondary)
_verb.OpenVerbMenu(uid, true);
_verb.OpenVerbMenu(EntityManager.GetEntity(entity), true);
else
return;