diff --git a/Content.Client/Decals/DecalOverlay.cs b/Content.Client/Decals/DecalOverlay.cs index 6cb43432dc..a5e5a2d831 100644 --- a/Content.Client/Decals/DecalOverlay.cs +++ b/Content.Client/Decals/DecalOverlay.cs @@ -19,6 +19,8 @@ namespace Content.Client.Decals public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowEntities; + private readonly Dictionary _cachedTextures = new(64); + public DecalOverlay( DecalSystem decals, SharedTransformSystem transforms, @@ -37,10 +39,8 @@ namespace Content.Client.Decals protected override void Draw(in OverlayDrawArgs args) { + // Shouldn't need to clear cached textures unless the prototypes get reloaded. var handle = args.WorldHandle; - - Dictionary cachedTextures = new(); - var xformQuery = _entManager.GetEntityQuery(); foreach (var (gridId, zIndexDictionary) in _decals.DecalRenderIndex) @@ -54,11 +54,11 @@ namespace Content.Client.Decals { foreach (var (_, decal) in decals) { - if (!cachedTextures.TryGetValue(decal.Id, out var texture)) + if (!_cachedTextures.TryGetValue(decal.Id, out var texture)) { var sprite = GetDecalSprite(decal.Id); texture = _sprites.Frame0(sprite); - cachedTextures[decal.Id] = texture; + _cachedTextures[decal.Id] = texture; } if (decal.Angle.Equals(Angle.Zero))