diff --git a/Content.Client/Administration/AdminVerbSystem.cs b/Content.Client/Administration/AdminVerbSystem.cs index 5cc3300483..71651bdc94 100644 --- a/Content.Client/Administration/AdminVerbSystem.cs +++ b/Content.Client/Administration/AdminVerbSystem.cs @@ -1,10 +1,8 @@ -using Content.Client.Administration.UI.Tabs.AtmosTab; using Content.Shared.Verbs; using Robust.Client.Console; using Robust.Client.ViewVariables; using Robust.Shared.GameObjects; using Robust.Shared.IoC; -using Robust.Shared.Map; namespace Content.Client.Verbs { @@ -33,6 +31,7 @@ namespace Content.Client.Verbs verb.Text = "View Variables"; verb.IconTexture = "/Textures/Interface/VerbIcons/vv.svg.192dpi.png"; verb.Act = () => _viewVariablesManager.OpenVV(args.Target); + verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb. args.Verbs.Add(verb); } } diff --git a/Content.Client/ContextMenu/UI/EntityMenuElement.cs b/Content.Client/ContextMenu/UI/EntityMenuElement.cs index 40f386c451..96aa0c2243 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuElement.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuElement.cs @@ -57,7 +57,8 @@ namespace Content.Client.ContextMenu.UI /// public void UpdateEntity(IEntity? entity = null) { - entity ??= Entity; + if (Entity != null && !Entity.Deleted) + entity ??= Entity; EntityIcon.Sprite = entity?.GetComponentOrNull(); diff --git a/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs b/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs index d6bd1704a7..c5838f69cd 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs @@ -321,7 +321,7 @@ namespace Content.Client.ContextMenu.UI } /// - /// Look through a sub-menu and return the first entity. + /// Recursively look through a sub-menu and return the first entity. /// private IEntity? GetFirstEntityOrNull(ContextMenuPopup? menu) { @@ -334,8 +334,13 @@ namespace Content.Client.ContextMenu.UI continue; if (entityElement.Entity != null) - return entityElement.Entity; + { + if (!entityElement.Entity.Deleted) + return entityElement.Entity; + continue; + } + // if the element has no entity, its a group of entities with another attached sub-menu. var entity = GetFirstEntityOrNull(entityElement.SubMenu); if (entity != null) return entity; diff --git a/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs b/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs index e72bcae0e7..ba958693bb 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs @@ -37,8 +37,14 @@ namespace Content.Client.ContextMenu.UI (a, b) => a.Prototype!.ID == b.Prototype!.ID, (a, b) => { - var xStates = a.GetComponent().AllLayers.Where(e => e.Visible).Select(s => s.RsiState.Name); - var yStates = b.GetComponent().AllLayers.Where(e => e.Visible).Select(s => s.RsiState.Name); + a.TryGetComponent(out var spriteA); + b.TryGetComponent(out var spriteB); + + if (spriteA == null || spriteB == null) + return spriteA == spriteB; + + var xStates = spriteA.AllLayers.Where(e => e.Visible).Select(s => s.RsiState.Name); + var yStates = spriteB.AllLayers.Where(e => e.Visible).Select(s => s.RsiState.Name); return xStates.OrderBy(t => t).SequenceEqual(yStates.OrderBy(t => t)); },