diff --git a/Content.Server/Materials/MaterialReclaimerSystem.cs b/Content.Server/Materials/MaterialReclaimerSystem.cs index 216bc10074..27a259fe2c 100644 --- a/Content.Server/Materials/MaterialReclaimerSystem.cs +++ b/Content.Server/Materials/MaterialReclaimerSystem.cs @@ -169,6 +169,8 @@ public sealed partial class MaterialReclaimerSystem : SharedMaterialReclaimerSys SpawnChemicalsFromComposition(uid, item, completion, true, component, xform); } + var eventArgs = new DestructionEventArgs(); + RaiseLocalEvent(item, eventArgs); QueueDel(item); } diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 6953554abd..a4c0da32bf 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; +using Content.Shared.Materials; using Content.Shared.Popups; using Content.Shared.Verbs; using Content.Shared.Whitelist; @@ -621,6 +622,29 @@ namespace Content.Shared.Containers.ItemSlots return true; } + /// + /// Unlocks all slots and ejects items from them on the floor. + /// + public void EjectFromAllSlots(Entity entity) + { + EjectFromAllSlots(entity, _ => true); + } + + /// + /// Unlocks all slots and ejects items from them on the floor. Works only while returns true. + /// + private void EjectFromAllSlots(Entity entity, Func shouldEject) + { + foreach (var slot in entity.Comp.Slots.Values) + { + if (slot.HasItem && shouldEject(slot)) + { + SetLock(entity.Owner, slot, false, entity.Comp); + TryEject(entity.Owner, slot, null, out _); + } + } + } + #endregion #region Verbs @@ -826,14 +850,7 @@ namespace Content.Shared.Containers.ItemSlots /// private void OnBreak(EntityUid uid, ItemSlotsComponent component, EntityEventArgs args) { - foreach (var slot in component.Slots.Values) - { - if (slot.EjectOnBreak && slot.HasItem) - { - SetLock(uid, slot, false, component); - TryEject(uid, slot, null, out var _); - } - } + EjectFromAllSlots((uid, component), slot => slot.EjectOnBreak); } /// diff --git a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml index cc820b1f9e..6925e80975 100644 --- a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml +++ b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml @@ -21,6 +21,7 @@ ejectVerbText: sheath-eject-verb insertSound: /Audio/Items/sheath.ogg ejectSound: /Audio/Items/unsheath.ogg + ejectOnBreak: true whitelist: tags: - CaptainSabre diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml b/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml index 7afde224f3..e799e3ed30 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/base_clothingshoes.yml @@ -49,6 +49,7 @@ item: name: clothing-boots-sidearm priority: 4 + ejectOnBreak: true whitelist: tags: - Knife diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index c6b3f42f95..1b3c41bb2c 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -19,6 +19,7 @@ slots: item: name: clothing-boots-sidearm + ejectOnBreak: true whitelist: tags: - ToyKnife diff --git a/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml b/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml index 85f7486d3f..161ee19ea6 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml @@ -54,7 +54,6 @@ name: id-card-console-privileged-id ejectSound: /Audio/Machines/id_swipe.ogg insertSound: /Audio/Weapons/Guns/MagIn/batrifle_magin.ogg - ejectOnBreak: true swap: false whitelist: components: @@ -136,7 +135,6 @@ startingItem: UniversalIDCard ejectSound: /Audio/Machines/id_swipe.ogg insertSound: /Audio/Weapons/Guns/MagIn/batrifle_magin.ogg - ejectOnBreak: true swap: false whitelist: components: @@ -164,7 +162,6 @@ startingItem: XenoborgIDCard ejectSound: /Audio/Machines/id_swipe.ogg insertSound: /Audio/Weapons/Guns/MagIn/batrifle_magin.ogg - ejectOnBreak: true disableEject: true swap: false whitelist: