Files
OldThink/Content.Shared/Morgue/EntityStorageLayingDownOverrideSystem.cs
Remuchi 9565de0262 [Feat&Fix] Система лежания (#288)
* лежать

* лучше так сделать

* - remove: Gravity is fine.

* - add: Hit moving lying targets.

* - tweak: Lie down insted of stun on FTL.

* - fix: Fix double component.

* - remove: Disable recoil.

---------

Co-authored-by: Aviu00 <aviu00@protonmail.com>
2024-04-22 18:14:23 +03:00

29 lines
895 B
C#

using Content.Shared.Body.Components;
using Content.Shared.Morgue.Components;
using Content.Shared.Standing;
using Content.Shared.Standing.Systems;
using Content.Shared.Storage.Components;
namespace Content.Shared.Morgue;
public sealed class EntityStorageLayingDownOverrideSystem : EntitySystem
{
[Dependency] private readonly SharedStandingStateSystem _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);
}
}
}