]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix prying shut unpowered doors (#35380)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Sat, 22 Feb 2025 03:05:22 +0000 (04:05 +0100)
committerGitHub <noreply@github.com>
Sat, 22 Feb 2025 03:05:22 +0000 (14:05 +1100)
Content.Shared/Doors/DoorEvents.cs
Content.Shared/Doors/Systems/SharedAirlockSystem.cs
Content.Shared/Doors/Systems/SharedDoorSystem.cs

index 849ea837303ac635b0bc3ad6ccfda48545f33a6e..1b6612358cb956691818922c49197010606ab3d0 100644 (file)
@@ -44,15 +44,20 @@ namespace Content.Shared.Doors
     /// </summary>
     /// <remarks>
     /// 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 &amp; 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".
     /// </remarks>
     public sealed class BeforeDoorClosedEvent : CancellableEntityEventArgs
     {
+        /// <summary>
+        /// If true, this check is being performed when the door is partially closing.
+        /// </summary>
+        public bool Partial;
         public bool PerformCollisionCheck;
 
-        public BeforeDoorClosedEvent(bool performCollisionCheck)
+        public BeforeDoorClosedEvent(bool performCollisionCheck, bool partial = false)
         {
+            Partial = partial;
             PerformCollisionCheck = performCollisionCheck;
         }
     }
index bdd119004e84a37f0721fa119adbea893a6413f1..5bbde04aedb70559731a1a7a5f4dc4e551758fe2 100644 (file)
@@ -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();
index 23bea0cdf14c55b438e597ebd49672ec681e3bca..a0d48b7d67555f1d8269d6b6b66a45f6652ea7c1 100644 (file)
@@ -427,7 +427,7 @@ public abstract partial class SharedDoorSystem : EntitySystem
     /// <param name="uid"> The uid of the door</param>
     /// <param name="door"> The doorcomponent of the door</param>
     /// <param name="user"> The user (if any) opening the door</param>
-    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;