fix: Block EntityStorage from inserting into mechs (#37942)

This additionally moves the hard-coded check for HandsComp that
previously did this, and moves it into an event which now both
HandsSystem and MechSystem subscribe to.
This commit is contained in:
Perry Fraser
2025-11-23 15:22:31 -06:00
committed by Vanessa
parent ec7ca3bdea
commit ffe77c6071
4 changed files with 42 additions and 7 deletions
@@ -305,10 +305,13 @@ public abstract class SharedEntityStorageSystem : EntitySystem
_container.Remove(toRemove, component.Contents);
if (_container.IsEntityInContainer(container))
if (_container.IsEntityInContainer(container)
&& _container.TryGetOuterContainer(container, Transform(container), out var outerContainer))
{
if (_container.TryGetOuterContainer(container, Transform(container), out var outerContainer) &&
!HasComp<HandsComponent>(outerContainer.Owner))
var attemptEvent = new EntityStorageIntoContainerAttemptEvent(outerContainer);
RaiseLocalEvent(outerContainer.Owner, ref attemptEvent);
if (!attemptEvent.Cancelled)
{
_container.Insert(toRemove, outerContainer);
return true;