]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Prevent dead players from turning bar stools (#24308)
authorMagnus Larsen <i.am.larsenml@gmail.com>
Fri, 15 Mar 2024 10:03:18 +0000 (10:03 +0000)
committerGitHub <noreply@github.com>
Fri, 15 Mar 2024 10:03:18 +0000 (21:03 +1100)
Prevent dead users from turning their bar stools

Previously, players could always turn a bar stool or office chair they
were buckled into; even while stone cold dead!

Content.IntegrationTests/Tests/Buckle/BuckleTest.cs
Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs
Content.Shared/Interaction/RotateToFaceSystem.cs

index 739bd549061a6329fe02f7829659a5be506712b3..6e2a080370d31cd73dd74b637e4703422b61659e 100644 (file)
@@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.Buckle
                     Assert.That(buckle.Buckled);
 
                     Assert.That(actionBlocker.CanMove(human), Is.False);
-                    Assert.That(actionBlocker.CanChangeDirection(human), Is.False);
+                    Assert.That(actionBlocker.CanChangeDirection(human));
                     Assert.That(standingState.Down(human), Is.False);
                     Assert.That(
                         (xformSystem.GetWorldPosition(human) - xformSystem.GetWorldPosition(chair)).LengthSquared,
index 731b2892aa87bcebfeb540a50db7347206f76f82..b58bdf83e4929a919668325822330cc353b69978 100644 (file)
@@ -7,7 +7,6 @@ using Content.Shared.Database;
 using Content.Shared.Hands.Components;
 using Content.Shared.IdentityManagement;
 using Content.Shared.Interaction;
-using Content.Shared.Interaction.Events;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Movement.Events;
 using Content.Shared.Popups;
@@ -39,7 +38,6 @@ public abstract partial class SharedBuckleSystem
         SubscribeLocalEvent<BuckleComponent, StandAttemptEvent>(OnBuckleStandAttempt);
         SubscribeLocalEvent<BuckleComponent, ThrowPushbackAttemptEvent>(OnBuckleThrowPushbackAttempt);
         SubscribeLocalEvent<BuckleComponent, UpdateCanMoveEvent>(OnBuckleUpdateCanMove);
-        SubscribeLocalEvent<BuckleComponent, ChangeDirectionAttemptEvent>(OnBuckleChangeDirectionAttempt);
     }
 
     private void OnBuckleComponentStartup(EntityUid uid, BuckleComponent component, ComponentStartup args)
@@ -142,12 +140,6 @@ public abstract partial class SharedBuckleSystem
             args.Cancel();
     }
 
-    private void OnBuckleChangeDirectionAttempt(EntityUid uid, BuckleComponent component, ChangeDirectionAttemptEvent args)
-    {
-        if (component.Buckled)
-            args.Cancel();
-    }
-
     public bool IsBuckled(EntityUid uid, BuckleComponent? component = null)
     {
         return Resolve(uid, ref component, false) && component.Buckled;
index 01dc572a73d08ae9ff37e8c0ffcad536e5bc7bde..ed950240af69eeecabff4889658db36c4ff99ff1 100644 (file)
@@ -80,14 +80,8 @@ namespace Content.Shared.Interaction
 
         public bool TryFaceAngle(EntityUid user, Angle diffAngle, TransformComponent? xform = null)
         {
-            if (_actionBlockerSystem.CanChangeDirection(user))
-            {
-                if (!Resolve(user, ref xform))
-                    return false;
-
-                _transform.SetWorldRotation(xform, diffAngle);
-                return true;
-            }
+            if (!_actionBlockerSystem.CanChangeDirection(user))
+                return false;
 
             if (EntityManager.TryGetComponent(user, out BuckleComponent? buckle) && buckle.Buckled)
             {
@@ -105,9 +99,16 @@ namespace Content.Shared.Interaction
                         return true;
                     }
                 }
+
+                return false;
             }
 
-            return false;
+            // user is not buckled in; apply to their transform
+            if (!Resolve(user, ref xform))
+                return false;
+
+            _transform.SetWorldRotation(xform, diffAngle);
+            return true;
         }
     }
 }