Files
OldThink/Content.Shared/Morgue/EntityStorageLayingDownOverrideSystem.cs

28 lines
850 B
C#
Raw Normal View History

2022-07-13 19:11:59 -04:00
using Content.Shared.Body.Components;
using Content.Shared.Morgue.Components;
using Content.Shared.Standing;
using Content.Shared.Storage.Components;
2022-07-13 19:11:59 -04:00
namespace Content.Shared.Morgue;
2022-07-13 19:11:59 -04:00
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)
2022-07-13 19:11:59 -04:00
{
foreach (var ent in args.Contents)
{
if (HasComp<BodyComponent>(ent) && !_standing.IsDown(ent))
2022-07-13 19:11:59 -04:00
args.Contents.Remove(ent);
}
2022-07-13 19:11:59 -04:00
}
}