]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix blocked UI interaction on unpowered devices (#36319)
authorArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
Sat, 5 Apr 2025 21:05:42 +0000 (14:05 -0700)
committerGitHub <noreply@github.com>
Sat, 5 Apr 2025 21:05:42 +0000 (23:05 +0200)
init

Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs

index afdf9c2b6d0538ac28bcd9976e05de9873be6fad..374d9b8cbfdf0b5e58656ae8d8adceb6c3663e31 100644 (file)
@@ -121,18 +121,19 @@ public abstract partial class SharedStationAiSystem
         if (ev.Actor == ev.Target)
             return;
 
-        // no need to show menu if device is not powered.
-        if (!PowerReceiver.IsPowered(ev.Target))
-        {
-            ShowDeviceNotRespondingPopup(ev.Actor);
-            ev.Cancel();
-            return;
-        }
-
         if (TryComp(ev.Actor, out StationAiHeldComponent? aiComp) &&
            (!TryComp(ev.Target, out StationAiWhitelistComponent? whitelistComponent) ||
             !ValidateAi((ev.Actor, aiComp))))
         {
+            // Don't allow the AI to interact with anything that isn't powered.
+            if (!PowerReceiver.IsPowered(ev.Target))
+            {
+                ShowDeviceNotRespondingPopup(ev.Actor);
+                ev.Cancel();
+                return;
+            }
+
+            // Don't allow the AI to interact with anything that it isn't allowed to (ex. AI wire is cut)
             if (whitelistComponent is { Enabled: false })
             {
                 ShowDeviceNotRespondingPopup(ev.Actor);
@@ -172,7 +173,7 @@ public abstract partial class SharedStationAiSystem
         var verb = new AlternativeVerb
         {
             Text = isOpen ? Loc.GetString("ai-close") : Loc.GetString("ai-open"),
-            Act = () => 
+            Act = () =>
             {
                 if (isOpen)
                 {