1
0

EntityStorageLayingDownOverrideSystem.cs 850 B

123456789101112131415161718192021222324252627
  1. using Content.Shared.Body.Components;
  2. using Content.Shared.Morgue.Components;
  3. using Content.Shared.Standing;
  4. using Content.Shared.Storage.Components;
  5. namespace Content.Shared.Morgue;
  6. public sealed class EntityStorageLayingDownOverrideSystem : EntitySystem
  7. {
  8. [Dependency] private readonly StandingStateSystem _standing = default!;
  9. public override void Initialize()
  10. {
  11. base.Initialize();
  12. SubscribeLocalEvent<EntityStorageLayingDownOverrideComponent, StorageBeforeCloseEvent>(OnBeforeClose);
  13. }
  14. private void OnBeforeClose(EntityUid uid, EntityStorageLayingDownOverrideComponent component, ref StorageBeforeCloseEvent args)
  15. {
  16. foreach (var ent in args.Contents)
  17. {
  18. if (HasComp<BodyComponent>(ent) && !_standing.IsDown(ent))
  19. args.Contents.Remove(ent);
  20. }
  21. }
  22. }