From 37ca1fe9fe596bdcda65317d9bd5127c88b7f8c7 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 18 May 2023 19:27:59 +1000 Subject: [PATCH] Fix decal sorting ignoring colors (#16553) --- .../Decals/DecalGridChunkCollectionTypeSerializer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs b/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs index bd48a93e92..fe27df0866 100644 --- a/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs +++ b/Content.Shared/Decals/DecalGridChunkCollectionTypeSerializer.cs @@ -133,7 +133,6 @@ namespace Content.Shared.Decals } } - var lookupIndex = 0; var lookupNodes = lookup.Keys.ToList(); lookupNodes.Sort(); @@ -223,6 +222,16 @@ namespace Content.Shared.Decals if (idComparison != 0) return idComparison; + var colorComparison = string.Compare(Color?.ToHex(), other.Color?.ToHex(), StringComparison.Ordinal); + + if (colorComparison != 0) + return colorComparison; + + var angleComparison = Angle.Theta.CompareTo(other.Angle.Theta); + + if (angleComparison != 0) + return angleComparison; + var zIndexComparison = ZIndex.CompareTo(other.ZIndex); if (zIndexComparison != 0) return zIndexComparison;