From 8400ed7fbb289ec9dc61c972880eccf7f8ad22fc Mon Sep 17 00:00:00 2001 From: Zoldorf Date: Tue, 11 Apr 2023 10:28:56 -0600 Subject: [PATCH] add the ability to override the equipped state sprite clothing system uses for custom prototypes. (#15294) --- Content.Client/Clothing/ClientClothingSystem.cs | 12 +++++++++--- .../Clothing/Components/ClothingComponent.cs | 9 +++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Content.Client/Clothing/ClientClothingSystem.cs b/Content.Client/Clothing/ClientClothingSystem.cs index abf715191f..e2e96bcc30 100644 --- a/Content.Client/Clothing/ClientClothingSystem.cs +++ b/Content.Client/Clothing/ClientClothingSystem.cs @@ -142,9 +142,15 @@ public sealed class ClientClothingSystem : ClothingSystem var correctedSlot = slot; TemporarySlotMap.TryGetValue(correctedSlot, out correctedSlot); - var state = (clothing.EquippedPrefix == null) - ? $"equipped-{correctedSlot}" - : $"{clothing.EquippedPrefix}-equipped-{correctedSlot}"; + + + var state = $"equipped-{correctedSlot}"; + + if (clothing.EquippedPrefix != null) + state = $"{clothing.EquippedPrefix}-equipped-{correctedSlot}"; + + if (clothing.EquippedState != null) + state = $"{clothing.EquippedState}"; // species specific if (speciesId != null && rsi.TryGetState($"{state}-{speciesId}", out _)) diff --git a/Content.Shared/Clothing/Components/ClothingComponent.cs b/Content.Shared/Clothing/Components/ClothingComponent.cs index 9ba64d2c94..e79bee3b54 100644 --- a/Content.Shared/Clothing/Components/ClothingComponent.cs +++ b/Content.Shared/Clothing/Components/ClothingComponent.cs @@ -40,6 +40,15 @@ public sealed class ClothingComponent : Component [DataField("equippedPrefix")] public string? EquippedPrefix; + /// + /// Allows the equipped state to be directly overwritten. + /// useful when prototyping INNERCLOTHING items into OUTERCLOTHING items without duplicating/modifying RSIs etc. + /// + [Access(typeof(ClothingSystem))] + [ViewVariables(VVAccess.ReadWrite)] + [DataField("equippedState")] + public string? EquippedState; + [ViewVariables(VVAccess.ReadWrite)] [DataField("sprite")] public string? RsiPath; -- 2.51.2