]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
ToggleVisualLayers hair disappeared fix (#28949)
authorFunTust <49007663+FunTust@users.noreply.github.com>
Sat, 15 Jun 2024 21:42:13 +0000 (00:42 +0300)
committerGitHub <noreply@github.com>
Sat, 15 Jun 2024 21:42:13 +0000 (17:42 -0400)
* Update ClothingSystem.cs

* did it in a better way

* Update ClothingSystem.cs

Content.Shared/Clothing/EntitySystems/ClothingSystem.cs

index e8bfb789613e1dc732ce74ac1ae082bb4f552ce8..1e2825a49a5b26da93e9e92b1562e661d20321d7 100644 (file)
@@ -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;
-                        }
                     }
                 }
             }