Skip to content

Commit

Permalink
Fix Laying Down Bugs (#933)
Browse files Browse the repository at this point in the history
# Description

This fixes prediction issues, both where pressing the Lay down key
causes all entities on your screen to glitch and lay down, as well as
the bug where upon receiving ANY movement input, a player would be
visually changed on their screen to be laying down.

# Changelog

:cl:
- fix: Fixed issues with the LayingDownSystem. Laying down no longer
causes all entities on your screen to lay down at once. Using any
movement input no longer causes the character to appear to the player as
to be laying down.
  • Loading branch information
VMSolidus committed Sep 19, 2024
1 parent 6d1aae9 commit 0aa49c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Content.Client/Standing/LayingDownSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Buckle;
using Content.Shared.Rotation;
using Content.Shared.Standing;
using Robust.Client.GameObjects;
Expand All @@ -11,8 +11,9 @@ public sealed class LayingDownSystem : SharedLayingDownSystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
[Dependency] private readonly AnimationPlayerSystem _animation = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly SharedBuckleSystem _buckle = default!;

public override void Initialize()
{
Expand All @@ -26,7 +27,8 @@ public override void Initialize()
private void OnMovementInput(EntityUid uid, LayingDownComponent component, MoveEvent args)
{
if (!_timing.IsFirstTimePredicted
|| !_actionBlocker.CanMove(uid)
|| !_standing.IsDown(uid)
|| _buckle.IsBuckled(uid)
|| _animation.HasRunningAnimation(uid, "rotate")
|| !TryComp<TransformComponent>(uid, out var transform)
|| !TryComp<SpriteComponent>(uid, out var sprite)
Expand Down
3 changes: 2 additions & 1 deletion Content.Shared/Standing/SharedLayingDownSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public override void Shutdown()

private void ToggleStanding(ICommonSession? session)
{
if (session?.AttachedEntity == null
if (session is not { AttachedEntity: { Valid: true } uid } _
|| !Exists(uid)
|| !HasComp<LayingDownComponent>(session.AttachedEntity)
|| _gravity.IsWeightless(session.AttachedEntity.Value))
return;
Expand Down

0 comments on commit 0aa49c1

Please sign in to comment.