Fix mispredict when closing a crematorium you are standing over (#20541)

This commit is contained in:
DrSmugleaf
2023-09-27 16:41:07 -07:00
committed by GitHub
parent 5eb8a1d88d
commit 0c881e6379
2 changed files with 3 additions and 4 deletions

View File

@@ -1,7 +0,0 @@
namespace Content.Server.Morgue.Components;
[RegisterComponent]
public sealed partial class EntityStorageLayingDownOverrideComponent : Component
{
}

View File

@@ -1,27 +0,0 @@
using Content.Server.Morgue.Components;
using Content.Shared.Body.Components;
using Content.Shared.Standing;
using Content.Shared.Storage.Components;
namespace Content.Server.Morgue;
public sealed class EntityStorageLayingDownOverrideSystem : EntitySystem
{
[Dependency] private readonly StandingStateSystem _standing = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EntityStorageLayingDownOverrideComponent, StorageBeforeCloseEvent>(OnBeforeClose);
}
private void OnBeforeClose(EntityUid uid, EntityStorageLayingDownOverrideComponent component, ref StorageBeforeCloseEvent args)
{
foreach (var ent in args.Contents)
{
if (HasComp<BodyComponent>(ent) && !_standing.IsDown(ent))
args.Contents.Remove(ent);
}
}
}