EntityStorage ECS (#9291)

This commit is contained in:
Nemanja
2022-07-13 19:11:59 -04:00
committed by GitHub
parent a655891a8d
commit 5edf2ccad5
46 changed files with 1057 additions and 1126 deletions

View File

@@ -0,0 +1,25 @@
using Content.Server.Morgue.Components;
using Content.Shared.Standing;
using Content.Server.Storage.Components;
using Content.Shared.Body.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, StorageBeforeCloseEvent args)
{
foreach (var ent in args.Contents)
if (HasComp<SharedBodyComponent>(ent) && !_standing.IsDown(ent))
args.Contents.Remove(ent);
}
}