]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix improper prediction on unpryable doors (#24738)
authornikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
Tue, 30 Jan 2024 18:03:15 +0000 (20:03 +0200)
committerGitHub <noreply@github.com>
Tue, 30 Jan 2024 18:03:15 +0000 (13:03 -0500)
Fix improper prediction on unpryable doors.

Entities that had CanPry to false on their components would get
improperly predicted as pryable on the client because the check was only
preformed on the server. Same problem existed for welded doors. Moved
the check from server to shared.

Content.Server/Doors/Systems/DoorSystem.cs
Content.Shared/Doors/Systems/SharedDoorSystem.cs

index 560149f2289af821a10534ab51c787444ed42bce..fffc0a4e1faf8ab693046f0282979b256cde30cb 100644 (file)
@@ -28,8 +28,6 @@ public sealed class DoorSystem : SharedDoorSystem
     {
         base.Initialize();
 
-
-        SubscribeLocalEvent<DoorComponent, BeforePryEvent>(OnBeforeDoorPry);
         SubscribeLocalEvent<DoorComponent, WeldableAttemptEvent>(OnWeldAttempt);
         SubscribeLocalEvent<DoorComponent, WeldableChangedEvent>(OnWeldChanged);
         SubscribeLocalEvent<DoorComponent, GotEmaggedEvent>(OnEmagged);
@@ -124,12 +122,6 @@ public sealed class DoorSystem : SharedDoorSystem
         else if (component.State == DoorState.Welded)
             SetState(uid, DoorState.Closed, component);
     }
-
-    private void OnBeforeDoorPry(EntityUid id, DoorComponent door, ref BeforePryEvent args)
-    {
-        if (door.State == DoorState.Welded || !door.CanPry)
-            args.Cancelled = true;
-    }
     #endregion
 
 
index 74ce120cd06899c74a09fc16f0e0a9389d66225a..954c22df382a73324f4db6ee8bfad4e034c9eb94 100644 (file)
@@ -60,6 +60,7 @@ public abstract class SharedDoorSystem : EntitySystem
 
         SubscribeLocalEvent<DoorComponent, StartCollideEvent>(HandleCollide);
         SubscribeLocalEvent<DoorComponent, PreventCollideEvent>(PreventCollision);
+        SubscribeLocalEvent<DoorComponent, BeforePryEvent>(OnBeforePry);
         SubscribeLocalEvent<DoorComponent, GetPryTimeModifierEvent>(OnPryTimeModifier);
 
     }
@@ -175,6 +176,12 @@ public abstract class SharedDoorSystem : EntitySystem
         args.BaseTime = door.PryTime;
     }
 
+    private void OnBeforePry(EntityUid uid, DoorComponent door, ref BeforePryEvent args)
+    {
+        if (door.State == DoorState.Welded || !door.CanPry)
+            args.Cancelled = true;
+    }
+
     /// <summary>
     ///     Update the door state/visuals and play an access denied sound when a user without access interacts with the
     ///     door.
@@ -460,7 +467,7 @@ public abstract class SharedDoorSystem : EntitySystem
             //If the colliding entity is a slippable item ignore it by the airlock
             if (otherPhysics.CollisionLayer == (int)CollisionGroup.SlipLayer && otherPhysics.CollisionMask == (int)CollisionGroup.ItemMask)
                 continue;
-            
+
             //For when doors need to close over conveyor belts
             if (otherPhysics.CollisionLayer == (int) CollisionGroup.ConveyorMask)
                 continue;