]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
network airlock AutoClose (#32124)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Sat, 14 Sep 2024 00:51:51 +0000 (00:51 +0000)
committerGitHub <noreply@github.com>
Sat, 14 Sep 2024 00:51:51 +0000 (10:51 +1000)
* network airlock AutoClose

* least stupid language

* great language

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Server/Doors/Systems/AirlockSystem.cs
Content.Shared/Doors/Components/AirlockComponent.cs
Content.Shared/Doors/Systems/SharedAirlockSystem.cs

index e9f1db13ffb9d1d129161d1a7aef958334bb5195..ca3d133bd05e70c7a1af03fe4e58cc627815cbf1 100644 (file)
@@ -35,9 +35,10 @@ public sealed class AirlockSystem : SharedAirlockSystem
 
     private void OnSignalReceived(EntityUid uid, AirlockComponent component, ref SignalReceivedEvent args)
     {
-        if (args.Port == component.AutoClosePort)
+        if (args.Port == component.AutoClosePort && component.AutoClose)
         {
             component.AutoClose = false;
+            Dirty(uid, component);
         }
     }
 
@@ -84,10 +85,11 @@ public sealed class AirlockSystem : SharedAirlockSystem
             return;
         }
 
-        if (component.KeepOpenIfClicked)
+        if (component.KeepOpenIfClicked && component.AutoClose)
         {
             // Disable auto close
             component.AutoClose = false;
+            Dirty(uid, component);
         }
     }
 }
index b2fa7574f76f51cb0e7d4ae595287e3c1647b6c5..6577b1942ac9270a02e647840980a82e822269ea 100644 (file)
@@ -48,7 +48,7 @@ public sealed partial class AirlockComponent : Component
     /// <summary>
     /// Whether the airlock should auto close. This value is reset every time the airlock closes.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite)]
+    [DataField, AutoNetworkedField]
     public bool AutoClose = true;
 
     /// <summary>
index 5a6d45d9ec0b08b3f4456cbfe6f7872d711bc3d2..c0c274207b62b68f8c0fabfec9dab47e2674b458 100644 (file)
@@ -56,7 +56,10 @@ public abstract class SharedAirlockSystem : EntitySystem
 
         // Make sure the airlock auto closes again next time it is opened
         if (args.State == DoorState.Closed)
+        {
             component.AutoClose = true;
+            Dirty(uid, component);
+        }
     }
 
     private void OnBeforeDoorOpened(EntityUid uid, AirlockComponent component, BeforeDoorOpenedEvent args)