Fix inventory contents not being dropped on gibbing (#42504)

This commit is contained in:
pathetic meowmeow 2026-01-18 16:08:15 -05:00 committed by Coryler
parent 9661e4138e
commit e53f356512
1 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
using Content.Shared.Armor;
using Content.Shared.Clothing.Components;
using Content.Shared.DoAfter;
using Content.Shared.Gibbing;
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
@ -43,6 +44,8 @@ public abstract partial class InventorySystem
SubscribeLocalEvent<InventoryComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
SubscribeAllEvent<UseSlotNetworkMessage>(OnUseSlot);
SubscribeLocalEvent<InventoryComponent, BeingGibbedEvent>(OnBeingGibbed);
}
private void OnEntRemoved(EntityUid uid, InventoryComponent component, EntRemovedFromContainerMessage args)
@ -563,4 +566,12 @@ public abstract partial class InventorySystem
_interactionSystem.DoContactInteraction(uid, item, null, true); // Stellar - Interaction particles
}
}
private void OnBeingGibbed(Entity<InventoryComponent> ent, ref BeingGibbedEvent args)
{
foreach (var item in GetHandOrInventoryEntities((ent, null, ent)))
{
args.Giblets.Add(item);
}
}
}