From 87467a358bfb874f15e7aa4afef5abd76423d22f Mon Sep 17 00:00:00 2001 From: Luiz Costa <33888056+luizwritescode@users.noreply.github.com> Date: Sat, 13 Jul 2024 23:59:45 -0300 Subject: [PATCH] Fix lizards losing snouts when equipping a head bandana (#29979) * say goodbye to no-snout lizards * remove snout from plague doctor hat HideLayerClothing component --- .../Components/FoldableClothingComponent.cs | 13 +++++++++++++ .../EntitySystems/FoldableClothingSystem.cs | 7 +++++++ .../Prototypes/Entities/Clothing/Head/bandanas.yml | 2 ++ .../Prototypes/Entities/Clothing/Head/hats.yml | 1 - .../Prototypes/Entities/Clothing/Masks/bandanas.yml | 3 +++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Clothing/Components/FoldableClothingComponent.cs b/Content.Shared/Clothing/Components/FoldableClothingComponent.cs index 1a40d1dca1..ffcb52b457 100644 --- a/Content.Shared/Clothing/Components/FoldableClothingComponent.cs +++ b/Content.Shared/Clothing/Components/FoldableClothingComponent.cs @@ -1,3 +1,4 @@ +using Content.Shared.Humanoid; using Content.Shared.Inventory; using Robust.Shared.GameStates; @@ -30,4 +31,16 @@ public sealed partial class FoldableClothingComponent : Component /// [DataField] public string? FoldedHeldPrefix; + + /// + /// Which layers does this hide when Unfolded? See and + /// + [DataField] + public HashSet UnfoldedHideLayers = new(); + + /// + /// Which layers does this hide when folded? See and + /// + [DataField] + public HashSet FoldedHideLayers = new(); } diff --git a/Content.Shared/Clothing/EntitySystems/FoldableClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/FoldableClothingSystem.cs index be55588ddd..603af4099c 100644 --- a/Content.Shared/Clothing/EntitySystems/FoldableClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/FoldableClothingSystem.cs @@ -47,6 +47,10 @@ public sealed class FoldableClothingSystem : EntitySystem if (ent.Comp.FoldedHeldPrefix != null) _itemSystem.SetHeldPrefix(ent.Owner, ent.Comp.FoldedHeldPrefix, false, itemComp); + + if (TryComp(ent.Owner, out var hideLayerComp)) + hideLayerComp.Slots = ent.Comp.FoldedHideLayers; + } else { @@ -59,6 +63,9 @@ public sealed class FoldableClothingSystem : EntitySystem if (ent.Comp.FoldedHeldPrefix != null) _itemSystem.SetHeldPrefix(ent.Owner, null, false, itemComp); + if (TryComp(ent.Owner, out var hideLayerComp)) + hideLayerComp.Slots = ent.Comp.UnfoldedHideLayers; + } } } diff --git a/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml b/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml index 51a56f1f1d..da56194f71 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml @@ -20,6 +20,8 @@ - state: icon_mask map: [ "unfoldedLayer" ] visible: false + - type: HideLayerClothing # needed since head bandana inherits from mask bandana + slots: [] - type: Tag tags: - Bandana diff --git a/Resources/Prototypes/Entities/Clothing/Head/hats.yml b/Resources/Prototypes/Entities/Clothing/Head/hats.yml index d220d55f1f..8eeb82cbf4 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hats.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hats.yml @@ -391,7 +391,6 @@ - type: HideLayerClothing slots: - Hair - - Snout - HeadTop - HeadSide diff --git a/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml b/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml index f5ad2fb6c8..8021030095 100644 --- a/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml +++ b/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml @@ -11,6 +11,9 @@ - HEAD unfoldedSlots: - MASK + foldedHideLayers: [] + unfoldedHideLayers: + - Snout - type: Mask - type: IngestionBlocker - type: IdentityBlocker -- 2.51.2