diff --git a/Content.Client/Standing/LayingDownSystem.cs b/Content.Client/Standing/LayingDownSystem.cs index 8b8b51ff7d7..1a928d7a1c9 100644 --- a/Content.Client/Standing/LayingDownSystem.cs +++ b/Content.Client/Standing/LayingDownSystem.cs @@ -21,7 +21,7 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnMovementInput); - SubscribeNetworkEvent(OnDowned); + SubscribeNetworkEvent(OnDowned); SubscribeLocalEvent(OnStood); SubscribeNetworkEvent(OnCheckAutoGetUp); @@ -51,12 +51,9 @@ private void OnMovementInput(EntityUid uid, LayingDownComponent component, MoveE sprite.Rotation = Angle.FromDegrees(90); } - private void OnDowned(DownedEvent ev, EntitySessionEventArgs args) + private void OnDowned(DrawDownedEvent args) { - if (!args.SenderSession.AttachedEntity.HasValue) - return; - - var uid = args.SenderSession.AttachedEntity.Value; + var uid = GetEntity(args.Uid); if (!TryComp(uid, out var sprite) || !TryComp(uid, out var component)) return; diff --git a/Content.Shared/Standing/LayingDownComponent.cs b/Content.Shared/Standing/LayingDownComponent.cs index 2b15e4ee0da..363c6f15987 100644 --- a/Content.Shared/Standing/LayingDownComponent.cs +++ b/Content.Shared/Standing/LayingDownComponent.cs @@ -27,3 +27,9 @@ public sealed class CheckAutoGetUpEvent(NetEntity user) : CancellableEntityEvent { public NetEntity User = user; } + +[Serializable, NetSerializable] +public sealed class DrawDownedEvent(NetEntity uid) : EntityEventArgs +{ + public NetEntity Uid = uid; +} diff --git a/Content.Shared/Standing/StandingStateSystem.cs b/Content.Shared/Standing/StandingStateSystem.cs index 8fb9bf5344e..724c71fabd0 100644 --- a/Content.Shared/Standing/StandingStateSystem.cs +++ b/Content.Shared/Standing/StandingStateSystem.cs @@ -69,8 +69,8 @@ public bool Down(EntityUid uid, bool playSound = true, bool dropHeldItems = true RaiseLocalEvent(uid, new DownedEvent(), false); // Raising this event will lower the entity's draw depth to the same as a small mob. - if (_config.GetCVar(CCVars.CrawlUnderTables)) - RaiseNetworkEvent(new DownedEvent(), uid); + if (!_config.GetCVar(CCVars.CrawlUnderTables)) + RaiseNetworkEvent(new DrawDownedEvent(GetNetEntity(uid))); // Seemed like the best place to put it _appearance.SetData(uid, RotationVisuals.RotationState, RotationState.Horizontal, appearance); @@ -165,6 +165,4 @@ public sealed class StoodEvent : EntityEventArgs { } /// /// Raised when an entity is not standing /// - -[Serializable, NetSerializable] public sealed class DownedEvent : EntityEventArgs { }