]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
add the ability to override the equipped state sprite clothing system uses for custom...
authorZoldorf <silvertorch5@gmail.com>
Tue, 11 Apr 2023 16:28:56 +0000 (10:28 -0600)
committerGitHub <noreply@github.com>
Tue, 11 Apr 2023 16:28:56 +0000 (02:28 +1000)
Content.Client/Clothing/ClientClothingSystem.cs
Content.Shared/Clothing/Components/ClothingComponent.cs

index abf715191f7f7d04395b491948bf5ad17cd1bc77..e2e96bcc30d0c6ac98b88feb77fd784cd9a09c7b 100644 (file)
@@ -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 _))
index 9ba64d2c942c4c562c6b5d1705713958903b3aa2..e79bee3b5459b47b4f782059efbc3f13c98d5fb2 100644 (file)
@@ -40,6 +40,15 @@ public sealed class ClothingComponent : Component
     [DataField("equippedPrefix")]
     public string? EquippedPrefix;
 
+    /// <summary>
+    /// Allows the equipped state to be directly overwritten.
+    /// useful when prototyping INNERCLOTHING items into OUTERCLOTHING items without duplicating/modifying RSIs etc.
+    /// </summary>
+    [Access(typeof(ClothingSystem))]
+    [ViewVariables(VVAccess.ReadWrite)]
+    [DataField("equippedState")]
+    public string? EquippedState;
+
     [ViewVariables(VVAccess.ReadWrite)]
     [DataField("sprite")]
     public string? RsiPath;