From: Pieter-Jan Briers Date: Sat, 22 Feb 2025 03:05:22 +0000 (+0100) Subject: Fix prying shut unpowered doors (#35380) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=732d9dc2b7c5cab7aa183f532a636a84f428ca82;p=space-station-14.git Fix prying shut unpowered doors (#35380) --- diff --git a/Content.Shared/Doors/DoorEvents.cs b/Content.Shared/Doors/DoorEvents.cs index 849ea83730..1b6612358c 100644 --- a/Content.Shared/Doors/DoorEvents.cs +++ b/Content.Shared/Doors/DoorEvents.cs @@ -44,15 +44,20 @@ namespace Content.Shared.Doors /// /// /// This event is raised both when the door is initially closed, and when it is just about to become "partially" - /// closed (opaque & collidable). If canceled while partially closing, it will start opening again. Useful in case + /// closed (opaque & collidable). If canceled while partially closing, it will start opening again. Useful in case /// an entity entered the door just as it was about to become "solid". /// public sealed class BeforeDoorClosedEvent : CancellableEntityEventArgs { + /// + /// If true, this check is being performed when the door is partially closing. + /// + public bool Partial; public bool PerformCollisionCheck; - public BeforeDoorClosedEvent(bool performCollisionCheck) + public BeforeDoorClosedEvent(bool performCollisionCheck, bool partial = false) { + Partial = partial; PerformCollisionCheck = performCollisionCheck; } } diff --git a/Content.Shared/Doors/Systems/SharedAirlockSystem.cs b/Content.Shared/Doors/Systems/SharedAirlockSystem.cs index bdd119004e..5bbde04aed 100644 --- a/Content.Shared/Doors/Systems/SharedAirlockSystem.cs +++ b/Content.Shared/Doors/Systems/SharedAirlockSystem.cs @@ -42,7 +42,7 @@ public abstract class SharedAirlockSystem : EntitySystem // the initial power-check. if (TryComp(uid, out DoorComponent? door) - && !door.Partial + && !args.Partial && !CanChangeState(uid, airlock)) { args.Cancel(); diff --git a/Content.Shared/Doors/Systems/SharedDoorSystem.cs b/Content.Shared/Doors/Systems/SharedDoorSystem.cs index 23bea0cdf1..a0d48b7d67 100644 --- a/Content.Shared/Doors/Systems/SharedDoorSystem.cs +++ b/Content.Shared/Doors/Systems/SharedDoorSystem.cs @@ -427,7 +427,7 @@ public abstract partial class SharedDoorSystem : EntitySystem /// The uid of the door /// The doorcomponent of the door /// The user (if any) opening the door - public bool CanClose(EntityUid uid, DoorComponent? door = null, EntityUid? user = null) + public bool CanClose(EntityUid uid, DoorComponent? door = null, EntityUid? user = null, bool partial = false) { if (!Resolve(uid, ref door)) return false; @@ -437,7 +437,7 @@ public abstract partial class SharedDoorSystem : EntitySystem if (door.State is DoorState.Welded or DoorState.Closed) return false; - var ev = new BeforeDoorClosedEvent(door.PerformCollisionCheck); + var ev = new BeforeDoorClosedEvent(door.PerformCollisionCheck, partial); RaiseLocalEvent(uid, ev); if (ev.Cancelled) return false; @@ -472,7 +472,7 @@ public abstract partial class SharedDoorSystem : EntitySystem return false; // Make sure no entity walked into the airlock when it started closing. - if (!CanClose(uid, door)) + if (!CanClose(uid, door, partial: true)) { door.NextStateChange = GameTiming.CurTime + door.OpenTimeTwo; door.State = DoorState.Open;