From 23887d5bd9444b81891d672463f1627aa62336cb Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Sun, 7 Jul 2024 02:20:53 -0400 Subject: [PATCH] Improve buckling's interactions with standing state (#29741) --- .../Buckle/SharedBuckleSystem.Buckle.cs | 9 +++------ Content.Shared/Standing/StandingStateSystem.cs | 16 +++++++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index 0ce8c99268..0fbfd51d69 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -196,7 +196,6 @@ public abstract partial class SharedBuckleSystem buckle.Comp.BuckleTime = _gameTiming.CurTime; ActionBlocker.UpdateCanMove(buckle); Appearance.SetData(buckle, StrapVisuals.State, buckle.Comp.Buckled); - Appearance.SetData(buckle, RotationVisuals.RotationState, RotationState.Horizontal); Dirty(buckle); } @@ -350,7 +349,6 @@ public abstract partial class SharedBuckleSystem SetBuckledTo(buckle, strap!); Appearance.SetData(strap, StrapVisuals.State, true); Appearance.SetData(buckle, BuckleVisuals.Buckled, true); - Appearance.SetData(buckle, RotationVisuals.RotationState, RotationState.Horizontal); _rotationVisuals.SetHorizontalAngle(buckle.Owner, strap.Comp.Rotation); @@ -363,10 +361,10 @@ public abstract partial class SharedBuckleSystem switch (strap.Comp.Position) { case StrapPosition.Stand: - _standing.Stand(buckle); + _standing.Stand(buckle, force: true); break; case StrapPosition.Down: - _standing.Down(buckle, false, false); + _standing.Down(buckle, false, false, force: true); break; } @@ -458,10 +456,9 @@ public abstract partial class SharedBuckleSystem _rotationVisuals.ResetHorizontalAngle(buckle.Owner); Appearance.SetData(strap, StrapVisuals.State, strap.Comp.BuckledEntities.Count != 0); Appearance.SetData(buckle, BuckleVisuals.Buckled, false); - Appearance.SetData(buckle, RotationVisuals.RotationState, RotationState.Vertical); if (HasComp(buckle) || _mobState.IsIncapacitated(buckle)) - _standing.Down(buckle); + _standing.Down(buckle, playSound: false); else _standing.Stand(buckle); diff --git a/Content.Shared/Standing/StandingStateSystem.cs b/Content.Shared/Standing/StandingStateSystem.cs index ed586e970d..8d9be9ab77 100644 --- a/Content.Shared/Standing/StandingStateSystem.cs +++ b/Content.Shared/Standing/StandingStateSystem.cs @@ -25,7 +25,10 @@ namespace Content.Shared.Standing return !standingState.Standing; } - public bool Down(EntityUid uid, bool playSound = true, bool dropHeldItems = true, + public bool Down(EntityUid uid, + bool playSound = true, + bool dropHeldItems = true, + bool force = false, StandingStateComponent? standingState = null, AppearanceComponent? appearance = null, HandsComponent? hands = null) @@ -49,11 +52,14 @@ namespace Content.Shared.Standing RaiseLocalEvent(uid, new DropHandItemsEvent(), false); } - var msg = new DownAttemptEvent(); - RaiseLocalEvent(uid, msg, false); + if (!force) + { + var msg = new DownAttemptEvent(); + RaiseLocalEvent(uid, msg, false); - if (msg.Cancelled) - return false; + if (msg.Cancelled) + return false; + } standingState.Standing = false; Dirty(uid, standingState); -- 2.51.2