diff --git a/Content.Shared/Armor/AllowSuitStorageComponent.cs b/Content.Shared/Armor/AllowSuitStorageComponent.cs new file mode 100644 index 0000000000..aa7bce1c87 --- /dev/null +++ b/Content.Shared/Armor/AllowSuitStorageComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Shared.Armor; + +/// +/// Used on outerclothing to allow use of suit storage +/// +[RegisterComponent] +public sealed partial class AllowSuitStorageComponent : Component +{ + +} diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index 7c9279df20..400dfb0beb 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -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; } diff --git a/Content.Shared/Inventory/InventoryTemplatePrototype.cs b/Content.Shared/Inventory/InventoryTemplatePrototype.cs index 3a605523bf..a4d77767e3 100644 --- a/Content.Shared/Inventory/InventoryTemplatePrototype.cs +++ b/Content.Shared/Inventory/InventoryTemplatePrototype.cs @@ -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; diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml index 6da428ee5f..88f8a4ebc2 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml @@ -21,6 +21,7 @@ Heat: 0.80 - type: ExplosionResistance damageCoefficient: 0.90 + - type: AllowSuitStorage #Alternate / slim basic armor vest - type: entity @@ -211,6 +212,7 @@ - type: ExplosionResistance damageCoefficient: 0.65 - type: GroupExamine + - type: AllowSuitStorage - type: entity parent: ClothingOuterBaseLarge diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml index 1ccecd52c4..19d963bdeb 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml @@ -138,6 +138,7 @@ - WhitelistChameleon - type: ClothingRequiredStepTriggerImmune slots: WITHOUT_POCKET + - type: AllowSuitStorage - type: entity abstract: true @@ -158,6 +159,7 @@ size: Huge - type: ClothingRequiredStepTriggerImmune slots: WITHOUT_POCKET + - type: AllowSuitStorage - type: entity parent: ClothingOuterBase diff --git a/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml index c0da3567c2..a9c7352ed8 100644 --- a/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/arachnid_inventory_template.yml @@ -137,4 +137,6 @@ uiWindowPos: 2,0 strippingWindowPos: 2,5 dependsOn: outerClothing + dependsOnComponents: + - type: AllowSuitStorage displayName: Suit Storage diff --git a/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml index a672e403b3..878ccb3d6b 100644 --- a/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/corpse_inventory_template.yml @@ -83,6 +83,8 @@ uiWindowPos: 2,0 strippingWindowPos: 2,5 dependsOn: outerClothing + dependsOnComponents: + - type: AllowSuitStorage displayName: Suit Storage - name: belt slotTexture: belt diff --git a/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml index 5d909264fe..619aefddc3 100644 --- a/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/diona_inventory_template.yml @@ -84,6 +84,8 @@ uiWindowPos: 2,0 strippingWindowPos: 2,5 dependsOn: outerClothing + dependsOnComponents: + - type: AllowSuitStorage displayName: Suit Storage - name: id slotTexture: id diff --git a/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml index 2070f646b7..ff1447931f 100644 --- a/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/human_inventory_template.yml @@ -90,6 +90,8 @@ uiWindowPos: 2,0 strippingWindowPos: 2,5 dependsOn: outerClothing + dependsOnComponents: + - type: AllowSuitStorage displayName: Suit Storage - name: id slotTexture: id diff --git a/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml b/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml index bdd5100084..19875f7e1b 100644 --- a/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml +++ b/Resources/Prototypes/InventoryTemplates/monkey_inventory_template.yml @@ -45,6 +45,8 @@ uiWindowPos: 2,0 strippingWindowPos: 2,5 dependsOn: outerClothing + dependsOnComponents: + - type: AllowSuitStorage displayName: Suit Storage - name: outerClothing slotTexture: suit