2022-07-13 19:11:59 -04:00
|
|
|
using Content.Shared.Body.Components;
|
2023-09-27 16:41:07 -07:00
|
|
|
using Content.Shared.Morgue.Components;
|
2022-10-23 00:46:28 +02:00
|
|
|
using Content.Shared.Standing;
|
2023-02-11 20:12:29 -05:00
|
|
|
using Content.Shared.Storage.Components;
|
2022-07-13 19:11:59 -04:00
|
|
|
|
2023-09-27 16:41:07 -07: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);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-11 20:12:29 -05:00
|
|
|
private void OnBeforeClose(EntityUid uid, EntityStorageLayingDownOverrideComponent component, ref StorageBeforeCloseEvent args)
|
2022-07-13 19:11:59 -04:00
|
|
|
{
|
|
|
|
|
foreach (var ent in args.Contents)
|
2023-02-11 20:12:29 -05:00
|
|
|
{
|
2022-10-23 00:46:28 +02:00
|
|
|
if (HasComp<BodyComponent>(ent) && !_standing.IsDown(ent))
|
2022-07-13 19:11:59 -04:00
|
|
|
args.Contents.Remove(ent);
|
2023-02-11 20:12:29 -05:00
|
|
|
}
|
2022-07-13 19:11:59 -04:00
|
|
|
}
|
|
|
|
|
}
|