]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add firelock warnings popup when opening on access allowed (#28420)
authorShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Fri, 31 May 2024 14:56:20 +0000 (07:56 -0700)
committerGitHub <noreply@github.com>
Fri, 31 May 2024 14:56:20 +0000 (10:56 -0400)
Content.Shared/Doors/Systems/SharedFirelockSystem.cs

index 4afe26039ba466aa53582d14f8c723294822fce3..03350d2e6444bbc7862323805b5356817bb434fd 100644 (file)
@@ -56,23 +56,34 @@ public abstract class SharedFirelockSystem : EntitySystem
 
         if (!component.Powered || (!overrideAccess && component.IsLocked))
             args.Cancel();
+        else if (args.User != null)
+            WarnPlayer((uid, component), args.User.Value);
     }
 
     private void OnDoorGetPryTimeModifier(EntityUid uid, FirelockComponent component, ref GetPryTimeModifierEvent args)
     {
-        if (component.Temperature)
+        WarnPlayer((uid, component), args.User);
+
+        if (component.IsLocked)
+            args.PryTimeModifier *= component.LockedPryTimeModifier;
+    }
+
+    private void WarnPlayer(Entity<FirelockComponent> ent, EntityUid user)
+    {
+        if (ent.Comp.Temperature)
         {
             _popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-fire-message"),
-                uid, args.User, PopupType.MediumCaution);
+                ent.Owner,
+                user,
+                PopupType.MediumCaution);
         }
-        else if (component.Pressure)
+        else if (ent.Comp.Pressure)
         {
             _popupSystem.PopupClient(Loc.GetString("firelock-component-is-holding-pressure-message"),
-                uid, args.User, PopupType.MediumCaution);
+                ent.Owner,
+                user,
+                PopupType.MediumCaution);
         }
-
-        if (component.IsLocked)
-            args.PryTimeModifier *= component.LockedPryTimeModifier;
     }
 
     private void OnAfterPried(EntityUid uid, FirelockComponent component, ref PriedEvent args)