From 1f3a4bec1b81c83e119a6183b058e3cccf712ad4 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 10 Aug 2023 13:34:01 +1000 Subject: [PATCH] Fix marking color bands (#18934) I'm not entirely sure what happens, I know it's markings being loaded from DB with the same ID as a prototype that was modified don't jive, but I'm not entirely sure if it's the best fix. --- Content.Client/Humanoid/HumanoidAppearanceSystem.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs index 78e20594db..05c9f2eb52 100644 --- a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs +++ b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs @@ -303,7 +303,9 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem for (var j = 0; j < markingPrototype.Sprites.Count; j++) { - if (markingPrototype.Sprites[j] is not SpriteSpecifier.Rsi rsi) + var markingSprite = markingPrototype.Sprites[j]; + + if (markingSprite is not SpriteSpecifier.Rsi rsi) { continue; } @@ -312,7 +314,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem if (!sprite.LayerMapTryGet(layerId, out _)) { - var layer = sprite.AddLayer(markingPrototype.Sprites[j], targetLayer + j + 1); + var layer = sprite.AddLayer(markingSprite, targetLayer + j + 1); sprite.LayerMapSet(layerId, layer); sprite.LayerSetSprite(layerId, rsi); } @@ -324,7 +326,10 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem continue; } - if (colors != null) + // Okay so if the marking prototype is modified but we load old marking data this may no longer be valid + // and we need to check the index is correct. + // So if that happens just default to white? + if (colors != null && j < colors.Count) { sprite.LayerSetColor(layerId, colors[j]); }