From: Perry Fraser Date: Thu, 8 Jan 2026 19:25:43 +0000 (-0500) Subject: fix: respect AllowedSlots for gogo hat (#39189) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=e4ac948dec4a7e9e2c95a4650f3351cc7dc60af4;p=space-station-14.git fix: respect AllowedSlots for gogo hat (#39189) --- diff --git a/Content.Server/VoiceTrigger/StorageVoiceControlSystem.cs b/Content.Server/VoiceTrigger/StorageVoiceControlSystem.cs index ade861af98..7b58278d08 100644 --- a/Content.Server/VoiceTrigger/StorageVoiceControlSystem.cs +++ b/Content.Server/VoiceTrigger/StorageVoiceControlSystem.cs @@ -30,10 +30,9 @@ public sealed class StorageVoiceControlSystem : EntitySystem private void VoiceTriggered(Entity ent, ref VoiceTriggeredEvent args) { - // Check if the component has any slot restrictions via AllowedSlots // If it has slot restrictions, check if the item is in a slot that is allowed - if (ent.Comp.AllowedSlots != null && _inventory.TryGetContainingSlot(ent.Owner, out var itemSlot) && - (itemSlot.SlotFlags & ent.Comp.AllowedSlots) == 0) + if (ent.Comp.AllowedSlots is { } allowedSlots + && !_inventory.InSlotWithAnyFlags(ent.Owner, allowedSlots)) return; // Get the storage component diff --git a/Content.Shared/Inventory/InventorySystem.Helpers.cs b/Content.Shared/Inventory/InventorySystem.Helpers.cs index 259c3b6c8d..4c56a5da43 100644 --- a/Content.Shared/Inventory/InventorySystem.Helpers.cs +++ b/Content.Shared/Inventory/InventorySystem.Helpers.cs @@ -47,14 +47,26 @@ public partial class InventorySystem } /// - /// Returns true if the given entity is equipped to an inventory slot with the given inventory slot flags. + /// Returns true if the given entity is equipped to an inventory slot with exactly matching inventory slot flags. /// + /// public bool InSlotWithFlags(Entity entity, SlotFlags flags) { return TryGetContainingSlot(entity, out var slot) && (slot.SlotFlags & flags) == flags; } + /// + /// Returns true if the given entity is equipped to an inventory slot that + /// has any flags in common with the given ones. + /// + /// + public bool InSlotWithAnyFlags(Entity ent, SlotFlags flags) + { + return TryGetContainingSlot(ent, out var slot) + && (slot.SlotFlags & flags) != 0; + } + public bool SpawnItemInSlot(EntityUid uid, string slot, string prototype, bool silent = false, bool force = false, InventoryComponent? inventory = null) { if (!Resolve(uid, ref inventory, false))