From 6d6da1267a666cc155b2682260939d7198ef252d Mon Sep 17 00:00:00 2001 From: FunTust <49007663+FunTust@users.noreply.github.com> Date: Sun, 16 Jun 2024 00:42:13 +0300 Subject: [PATCH] ToggleVisualLayers hair disappeared fix (#28949) * Update ClothingSystem.cs * did it in a better way * Update ClothingSystem.cs --- .../Clothing/EntitySystems/ClothingSystem.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs index e8bfb78961..1e2825a49a 100644 --- a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs @@ -92,26 +92,29 @@ public abstract class ClothingSystem : EntitySystem InventorySystem.InventorySlotEnumerator enumerator = _invSystem.GetSlotEnumerator(equipee); bool shouldLayerShow = true; - while (enumerator.NextItem(out EntityUid item)) + while (enumerator.NextItem(out EntityUid item, out SlotDefinition? slot)) { if (TryComp(item, out HideLayerClothingComponent? comp)) { if (comp.Slots.Contains(layer)) { - //Checks for mask toggling. TODO: Make a generic system for this - if (comp.HideOnToggle && TryComp(item, out MaskComponent? mask) && TryComp(item, out ClothingComponent? clothing)) + if (TryComp(item, out ClothingComponent? clothing) && clothing.Slots == slot.SlotFlags) { - if (clothing.EquippedPrefix != mask.EquippedPrefix) + //Checks for mask toggling. TODO: Make a generic system for this + if (comp.HideOnToggle && TryComp(item, out MaskComponent? mask)) + { + if (clothing.EquippedPrefix != mask.EquippedPrefix) + { + shouldLayerShow = false; + break; + } + } + else { shouldLayerShow = false; break; } } - else - { - shouldLayerShow = false; - break; - } } } } -- 2.51.2