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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user