]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make suit storage only available for hardsuits, softsuits, and armor (#27546)
authorДжексон Миссиссиппи <tripwiregamer@gmail.com>
Fri, 10 May 2024 02:19:07 +0000 (21:19 -0500)
committerGitHub <noreply@github.com>
Fri, 10 May 2024 02:19:07 +0000 (20:19 -0600)
AAAAAAAAAAAAdd!

* o shit

* I FUCKING HATE INDENTATION GRAAAAAAAAAH

Content.Shared/Armor/AllowSuitStorageComponent.cs [new file with mode: 0644]
Content.Shared/Inventory/InventorySystem.Equip.cs
Content.Shared/Inventory/InventoryTemplatePrototype.cs
Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml
Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml
Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml
Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml
Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml
Resources/Prototypes/InventoryTemplates/human_inventory_template.yml
Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml

diff --git a/Content.Shared/Armor/AllowSuitStorageComponent.cs b/Content.Shared/Armor/AllowSuitStorageComponent.cs
new file mode 100644 (file)
index 0000000..aa7bce1
--- /dev/null
@@ -0,0 +1,10 @@
+namespace Content.Shared.Armor;
+
+/// <summary>
+///     Used on outerclothing to allow use of suit storage
+/// </summary>
+[RegisterComponent]
+public sealed partial class AllowSuitStorageComponent : Component
+{
+
+}
index 7c9279df20d28008f73e78c162c002d9c4be866f..400dfb0beb3df926c6bbd7d15027340b79568804 100644 (file)
@@ -1,4 +1,5 @@
 using System.Diagnostics.CodeAnalysis;
+using Content.Shared.Armor;
 using Content.Shared.Clothing.Components;
 using Content.Shared.DoAfter;
 using Content.Shared.Hands;
@@ -114,7 +115,7 @@ public abstract partial class InventorySystem
         if (!_handsSystem.CanDropHeld(actor, hands.ActiveHand!, checkActionBlocker: false))
             return;
 
-        RaiseLocalEvent(held.Value, new HandDeselectedEvent(actor), false);
+        RaiseLocalEvent(held.Value, new HandDeselectedEvent(actor));
 
         TryEquip(actor, actor, held.Value, ev.Slot, predicted: true, inventory: inventory, force: true, checkDoafter:true);
     }
@@ -243,8 +244,16 @@ public abstract partial class InventorySystem
             return false;
 
         DebugTools.Assert(slotDefinition.Name == slot);
-        if (slotDefinition.DependsOn != null && !TryGetSlotEntity(target, slotDefinition.DependsOn, out _, inventory))
-            return false;
+        if (slotDefinition.DependsOn != null)
+        {
+            if (!TryGetSlotEntity(target, slotDefinition.DependsOn, out EntityUid? slotEntity, inventory))
+                return false;
+
+            if (slotDefinition.DependsOnComponents is { } componentRegistry)
+                foreach (var (_, entry) in componentRegistry)
+                    if (!HasComp(slotEntity, entry.Component.GetType()))
+                        return false;
+        }
 
         var fittingInPocket = slotDefinition.SlotFlags.HasFlag(SlotFlags.POCKET) &&
                               item != null &&
@@ -301,7 +310,6 @@ public abstract partial class InventorySystem
             reason = itemAttemptEvent.Reason ?? reason;
             return false;
         }
-
         return true;
     }
 
index 3a605523bf8ccb48342ef014505701cc083cb63c..a4d77767e371431358980c0a26d17680b4798fa8 100644 (file)
@@ -34,6 +34,8 @@ public sealed partial class SlotDefinition
 
     [DataField("dependsOn")] public string? DependsOn { get; private set; }
 
+    [DataField("dependsOnComponents")] public ComponentRegistry? DependsOnComponents { get; private set; }
+
     [DataField("displayName", required: true)]
     public string DisplayName { get; private set; } = string.Empty;
 
index 6da428ee5f67ec77ac2e98a2cdbf33f327e13614..88f8a4ebc277c2de3b387b954d4e7d1e971eccf7 100644 (file)
@@ -21,6 +21,7 @@
         Heat: 0.80
   - type: ExplosionResistance
     damageCoefficient: 0.90
+  - type: AllowSuitStorage
 
 #Alternate / slim basic armor vest
 - type: entity
   - type: ExplosionResistance
     damageCoefficient: 0.65
   - type: GroupExamine
+  - type: AllowSuitStorage
 
 - type: entity
   parent: ClothingOuterBaseLarge
index 1ccecd52c4942d930266ad7a8fa45b8c0321b8c1..19d963bdebecaaa910d447ac99250f154e375dae 100644 (file)
     - WhitelistChameleon
   - type: ClothingRequiredStepTriggerImmune
     slots: WITHOUT_POCKET
+  - type: AllowSuitStorage
 
 - type: entity
   abstract: true
     size: Huge
   - type: ClothingRequiredStepTriggerImmune
     slots: WITHOUT_POCKET
+  - type: AllowSuitStorage
 
 - type: entity
   parent: ClothingOuterBase
index c0da3567c21b87b8eb67beb35a1ee7ac8abdf2ac..a9c7352ed8236e744d12f297368caa5eba83ac91 100644 (file)
       uiWindowPos: 2,0
       strippingWindowPos: 2,5
       dependsOn: outerClothing
+      dependsOnComponents:
+      - type: AllowSuitStorage
       displayName: Suit Storage
index a672e403b3a17d98733d1022f8dcbf1b3db40f32..878ccb3d6baabdc1ec051c8e074152c35cce00af 100644 (file)
@@ -83,6 +83,8 @@
       uiWindowPos: 2,0
       strippingWindowPos: 2,5
       dependsOn: outerClothing
+      dependsOnComponents:
+      - type: AllowSuitStorage
       displayName: Suit Storage
     - name: belt
       slotTexture: belt
index 5d909264fe4df5857017c22d0326c5b8189357a7..619aefddc34c4b6b2057bda05f6d903b8244bfa8 100644 (file)
@@ -84,6 +84,8 @@
       uiWindowPos: 2,0
       strippingWindowPos: 2,5
       dependsOn: outerClothing
+      dependsOnComponents:
+      - type: AllowSuitStorage
       displayName: Suit Storage
     - name: id
       slotTexture: id
index 2070f646b794c49c13ad4746f5e23e7ce59b0dcc..ff1447931fe324268571d784e44c370c8373ab2c 100644 (file)
@@ -90,6 +90,8 @@
       uiWindowPos: 2,0
       strippingWindowPos: 2,5
       dependsOn: outerClothing
+      dependsOnComponents:
+      - type: AllowSuitStorage
       displayName: Suit Storage
     - name: id
       slotTexture: id
index bdd51000844fd96c5df2360615f0e92c01d11c58..19875f7e1bf61ad43df85cc88beacd0b480f9a8c 100644 (file)
@@ -45,6 +45,8 @@
     uiWindowPos: 2,0
     strippingWindowPos: 2,5
     dependsOn: outerClothing
+    dependsOnComponents:
+    - type: AllowSuitStorage
     displayName: Suit Storage
   - name: outerClothing
     slotTexture: suit