diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index 6fc9bfb8b1..3a779c37ba 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -281,6 +281,18 @@ public abstract partial class InventorySystem return false; } + if (slotDefinition.Whitelist != null && !slotDefinition.Whitelist.IsValid(itemUid)) + { + reason = "inventory-component-can-equip-does-not-fit"; + return false; + } + + if (slotDefinition.Blacklist != null && slotDefinition.Blacklist.IsValid(itemUid)) + { + reason = "inventory-component-can-equip-does-not-fit"; + return false; + } + var attemptEvent = new IsEquippingAttemptEvent(actor, target, itemUid, slotDefinition); RaiseLocalEvent(target, attemptEvent, true); if (attemptEvent.Cancelled) diff --git a/Content.Shared/Inventory/InventoryTemplatePrototype.cs b/Content.Shared/Inventory/InventoryTemplatePrototype.cs index 89884c36a8..ad8f7a5993 100644 --- a/Content.Shared/Inventory/InventoryTemplatePrototype.cs +++ b/Content.Shared/Inventory/InventoryTemplatePrototype.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Prototypes; +using Content.Shared.Whitelist; +using Robust.Shared.Prototypes; namespace Content.Shared.Inventory; @@ -38,6 +39,16 @@ public sealed class SlotDefinition /// Offset for the clothing sprites. /// [DataField("offset")] public Vector2 Offset { get; } = Vector2.Zero; + + /// + /// Entity whitelist for CanEquip checks. + /// + [DataField("whitelist")] public EntityWhitelist? Whitelist = null; + + /// + /// Entity blacklist for CanEquip checks. + /// + [DataField("blacklist")] public EntityWhitelist? Blacklist = null; } public enum SlotUIContainer