Files
tbd-station-14/Content.Server/Morgue/EntityStorageLayingDownOverrideSystem.cs
Nemanja c6c319f7e4 move lockcomponent to shared (#13722)
* move lockcomponent to shared

* ajcm review
2023-02-12 01:12:29 +00:00

28 lines
850 B
C#

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);
}
}
}