Don't draw debug overlay if quest window isn't visible
authorLiza Carvelli <liza@carvel.li>
Mon, 28 Jul 2025 20:49:33 +0000 (22:49 +0200)
committerLiza Carvelli <liza@carvel.li>
Mon, 28 Jul 2025 20:49:49 +0000 (22:49 +0200)
Questionable/Controller/QuestController.cs
Questionable/Windows/DebugOverlay.cs
Questionable/Windows/QuestWindow.cs

index 255aff2..7c52b73 100644 (file)
@@ -153,7 +153,8 @@ internal sealed class QuestController : MiniTaskController<QuestController>
 
     public string? DebugState { get; private set; }
 
-    public Func<bool> IsQuestWindowOpen { private get; set; } = () => true;
+    public bool IsQuestWindowOpen => IsQuestWindowOpenFunction?.Invoke() ?? true;
+    public Func<bool>? IsQuestWindowOpenFunction { private get; set; } = () => true;
 
     public void Reload()
     {
@@ -191,7 +192,7 @@ internal sealed class QuestController : MiniTaskController<QuestController>
             }
         }
 
-        if (AutomationType == EAutomationType.Manual && !IsRunning && !IsQuestWindowOpen())
+        if (AutomationType == EAutomationType.Manual && !IsRunning && !IsQuestWindowOpen)
             return;
 
         UpdateCurrentQuest();
index 6842d2b..9916dc0 100644 (file)
@@ -68,6 +68,9 @@ internal sealed class DebugOverlay : Window
         if (_clientState is not { IsLoggedIn: true, LocalPlayer: not null, IsPvPExcludingDen: false })
             return;
 
+        if (!_questController.IsQuestWindowOpen)
+            return;
+
         DrawCurrentQuest();
         DrawHighlightedQuest();
 
index 5723c0d..9438524 100644 (file)
@@ -104,7 +104,7 @@ internal sealed class QuestWindow : LWindow, IPersistableWindowConfig
 
         _activeQuestComponent.Reload += OnReload;
         _quickAccessButtonsComponent.Reload += OnReload;
-        _questController.IsQuestWindowOpen = () => IsOpen;
+        _questController.IsQuestWindowOpenFunction = () => IsOpen;
     }
 
     public WindowConfig WindowConfig => _configuration.DebugWindowConfig;