diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index 767e7ac325..c4f3b14495 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -59,7 +59,8 @@ namespace Content.Client.Actions if (args.Current is not ActionsComponentState state) return; - var serverActions = new SortedSet(state.Actions); + state.SortedActions ??= new SortedSet(state.Actions); + var serverActions = state.SortedActions; var removed = new List(); foreach (var act in component.Actions.ToList()) diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index 529d0dd1ae..f3cb004887 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -123,7 +123,7 @@ namespace Content.Client.IconSmoothing public void DirtyNeighbours(EntityUid uid, IconSmoothComponent? comp = null, TransformComponent? transform = null, EntityQuery? smoothQuery = null) { smoothQuery ??= GetEntityQuery(); - if (!smoothQuery.Value.Resolve(uid, ref comp)) + if (!smoothQuery.Value.Resolve(uid, ref comp) || !comp.Running) return; _dirtyEntities.Enqueue(uid); @@ -195,8 +195,9 @@ namespace Content.Client.IconSmoothing // Generation on the component is set after an update so we can cull updates that happened this generation. if (!smoothQuery.Resolve(uid, ref smooth, false) || smooth.Mode == IconSmoothingMode.NoSprite - || smooth.UpdateGeneration == _generation || - !smooth.Enabled) + || smooth.UpdateGeneration == _generation + || !smooth.Enabled + || !smooth.Running) { if (smooth is { Enabled: true } && TryComp(uid, out var edge) && diff --git a/Content.Shared/Actions/ActionTypes/ActionType.cs b/Content.Shared/Actions/ActionTypes/ActionType.cs index 202465a4fe..1a295d6628 100644 --- a/Content.Shared/Actions/ActionTypes/ActionType.cs +++ b/Content.Shared/Actions/ActionTypes/ActionType.cs @@ -37,6 +37,13 @@ public abstract class ActionType : IEquatable, IComparable, ICloneab [DataField("name")] public string DisplayName = string.Empty; + /// + /// This is just with localized strings resolved and markup removed. If null, will be + /// inferred from . This is cached to speed up game state handling. + /// + [NonSerialized] + public string? RawName; + /// /// Description to show in UI. Accepts formatting. /// @@ -179,10 +186,11 @@ public abstract class ActionType : IEquatable, IComparable, ICloneab if (Priority != otherAction.Priority) return otherAction.Priority - Priority; - var name = FormattedMessage.RemoveMarkup(Loc.GetString(DisplayName)); - var otherName = FormattedMessage.RemoveMarkup(Loc.GetString(otherAction.DisplayName)); - if (name != otherName) - return string.Compare(name, otherName, StringComparison.CurrentCulture); + RawName ??= FormattedMessage.RemoveMarkup(Loc.GetString(DisplayName)); + otherAction.RawName ??= FormattedMessage.RemoveMarkup(Loc.GetString(otherAction.DisplayName)); + var cmp = string.Compare(RawName, otherAction.RawName, StringComparison.CurrentCulture); + if (cmp != 0) + return cmp; if (Provider != otherAction.Provider) { @@ -217,6 +225,7 @@ public abstract class ActionType : IEquatable, IComparable, ICloneab Icon = toClone.Icon; IconOn = toClone.IconOn; DisplayName = toClone.DisplayName; + RawName = null; Description = toClone.Description; Provider = toClone.Provider; AttachedEntity = toClone.AttachedEntity; diff --git a/Content.Shared/Actions/ActionsComponent.cs b/Content.Shared/Actions/ActionsComponent.cs index ba2aedb6da..d422fcdbc2 100644 --- a/Content.Shared/Actions/ActionsComponent.cs +++ b/Content.Shared/Actions/ActionsComponent.cs @@ -22,6 +22,9 @@ public sealed class ActionsComponentState : ComponentState { public readonly List Actions; + [NonSerialized] + public SortedSet? SortedActions; + public ActionsComponentState(List actions) { Actions = actions; diff --git a/Content.Shared/Storage/Components/SharedMapLayerData.cs b/Content.Shared/Storage/Components/SharedMapLayerData.cs index 112a787401..741f832af7 100644 --- a/Content.Shared/Storage/Components/SharedMapLayerData.cs +++ b/Content.Shared/Storage/Components/SharedMapLayerData.cs @@ -1,3 +1,4 @@ +using System.Collections.ObjectModel; using Content.Shared.Whitelist; using Robust.Shared.Serialization; @@ -37,21 +38,22 @@ namespace Content.Shared.Storage.Components [Serializable, NetSerializable] public sealed class ShowLayerData : ICloneable { - public IReadOnlyList QueuedEntities { get; internal set; } + public readonly IReadOnlyList QueuedEntities; public ShowLayerData() { QueuedEntities = new List(); } - public ShowLayerData(IEnumerable other) + public ShowLayerData(IReadOnlyList other) { - QueuedEntities = new List(other); + QueuedEntities = other; } public object Clone() { - return new ShowLayerData(QueuedEntities); + // QueuedEntities should never be getting modified after this object is created. + return this; } } } diff --git a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs index fcd76e1515..0688d35400 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs @@ -79,7 +79,7 @@ namespace Content.Shared.Storage.EntitySystems /// false if msg.Container.Owner is not a storage, true otherwise. private bool TryGetLayers(ContainerModifiedMessage msg, ItemMapperComponent itemMapper, - out IReadOnlyList showLayers) + out List showLayers) { var containedLayers = _container.GetAllContainers(msg.Container.Owner) .Where(c => itemMapper.ContainerWhitelist?.Contains(c.ID) ?? true).SelectMany(cont => cont.ContainedEntities).ToArray();