From 9bebdf57069f8c2e2b045009a98bcf46caa68732 Mon Sep 17 00:00:00 2001 From: nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com> Date: Tue, 30 Jan 2024 20:03:15 +0200 Subject: [PATCH] Fix improper prediction on unpryable doors (#24738) 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 | 8 -------- Content.Shared/Doors/Systems/SharedDoorSystem.cs | 9 ++++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Content.Server/Doors/Systems/DoorSystem.cs b/Content.Server/Doors/Systems/DoorSystem.cs index 560149f228..fffc0a4e1f 100644 --- a/Content.Server/Doors/Systems/DoorSystem.cs +++ b/Content.Server/Doors/Systems/DoorSystem.cs @@ -28,8 +28,6 @@ public sealed class DoorSystem : SharedDoorSystem { base.Initialize(); - - SubscribeLocalEvent(OnBeforeDoorPry); SubscribeLocalEvent(OnWeldAttempt); SubscribeLocalEvent(OnWeldChanged); SubscribeLocalEvent(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 diff --git a/Content.Shared/Doors/Systems/SharedDoorSystem.cs b/Content.Shared/Doors/Systems/SharedDoorSystem.cs index 74ce120cd0..954c22df38 100644 --- a/Content.Shared/Doors/Systems/SharedDoorSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorSystem.cs @@ -60,6 +60,7 @@ public abstract class SharedDoorSystem : EntitySystem SubscribeLocalEvent(HandleCollide); SubscribeLocalEvent(PreventCollision); + SubscribeLocalEvent(OnBeforePry); SubscribeLocalEvent(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; + } + /// /// 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; -- 2.52.0