mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using Content.Shared.Morgue.Components;
|
|
using Content.Shared.Standing;
|
|
using Content.Shared.Storage.Components;
|
|
|
|
namespace Content.Shared.Morgue;
|
|
|
|
public sealed partial class EntityStorageLayingDownOverrideSystem : EntitySystem
|
|
{
|
|
[Dependency] private StandingStateSystem _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)
|
|
{
|
|
// Explicitly check for standing state component, as entities without it will return false for IsDown()
|
|
// which prevents inserting any kind of non-mobs into this container (which is unintended)
|
|
if (TryComp<StandingStateComponent>(ent, out var standingState) && !_standing.IsDown((ent, standingState)))
|
|
args.Contents.Remove(ent);
|
|
}
|
|
}
|
|
}
|