From 9b86624d3034c3b8c5ea7e63ac973f4d347508db Mon Sep 17 00:00:00 2001 From: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com> Date: Sat, 5 Apr 2025 14:05:42 -0700 Subject: [PATCH] Fix blocked UI interaction on unpowered devices (#36319) init --- .../StationAi/SharedStationAiSystem.Held.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs index afdf9c2b6d..374d9b8cbf 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs @@ -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) { -- 2.51.2