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-08-26 06:29:12 -04:00
committed by GitHub
parent ceda478ae2
commit fd4a0a29b4
4 changed files with 42 additions and 7 deletions

View File

@@ -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;