Fixes storage eating buckled players (#9096)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Buckle.Components;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Construction.Completions;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Storage.EntitySystems;
|
||||
@@ -215,8 +217,9 @@ namespace Content.Server.Storage.Components
|
||||
// 5. if this is NOT AN ITEM, then mobs can always be eaten unless unless a previous law prevents it
|
||||
// 6. if this is an item, then mobs must only be eaten if some other component prevents pick-up interactions while a mob is inside (e.g. foldable)
|
||||
|
||||
// Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events
|
||||
if (_entMan.HasComponent<GhostComponent>(entity))
|
||||
var attemptEvent = new InsertIntoEntityStorageAttemptEvent();
|
||||
_entMan.EventBus.RaiseLocalEvent(entity, attemptEvent);
|
||||
if (attemptEvent.Cancelled)
|
||||
return false;
|
||||
|
||||
// checks
|
||||
@@ -236,13 +239,9 @@ namespace Content.Server.Storage.Components
|
||||
{
|
||||
if (!storageIsItem)
|
||||
allowedToEat = true;
|
||||
else
|
||||
{
|
||||
// make an exception if this is a foldable-item that is currently un-folded (e.g., body bags).
|
||||
allowedToEat = _entMan.TryGetComponent(Owner, out FoldableComponent? foldable) && !foldable.IsFolded;
|
||||
}
|
||||
}
|
||||
|
||||
_entMan.EventBus.RaiseLocalEvent(entity, allowedToEat);
|
||||
return allowedToEat;
|
||||
}
|
||||
|
||||
@@ -365,6 +364,10 @@ namespace Content.Server.Storage.Components
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class InsertIntoEntityStorageAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
|
||||
}
|
||||
public sealed class StorageOpenAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user