From b90e49486fae2a530dcf4f414c1c5d3057636e38 Mon Sep 17 00:00:00 2001 From: BlankenshipG Date: Sun, 4 Oct 2026 20:42:27 -0400 Subject: [PATCH] feat(engine): wire RynthAi panel Map and Lua buttons to remote window toggles Co-authored-by: Cursor --- ...026-10-04-dashboard-map-and-lua-buttons.md | 34 +++++++++++++++++++ .../UI/Panels/RynthAiPanel.cs | 34 +++++++++++++++---- 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 Changelog/2026-10-04-dashboard-map-and-lua-buttons.md diff --git a/Changelog/2026-10-04-dashboard-map-and-lua-buttons.md b/Changelog/2026-10-04-dashboard-map-and-lua-buttons.md new file mode 100644 index 0000000..48f25dc --- /dev/null +++ b/Changelog/2026-10-04-dashboard-map-and-lua-buttons.md @@ -0,0 +1,34 @@ +# Avalonia RynthAi panel: Map and Lua buttons (2026-10-04) + +Engine `RynthAiPanel` plus RynthAi 0.6.21. Ships in the next installer after 2026.10.4.16. + +## Problem + +The right halves of the split launcher buttons, **Lua** (next to Meta) and **Map** (next to +Nav), had no click handler, so they did nothing. Both windows are ImGui windows inside +RynthAi, and in Avalonia mode RynthAi's overlay render path never drew either of them. + +There is no separate RynthLua plugin: the Lua Scripts editor is RynthAi's `LegacyLuaUi`, +controlled by `DashWindows.ShowLua`. So the Lua button follows the same pattern as Map and +the ILT Hub button. + +## Engine (`UI/Panels/RynthAiPanel.cs`) + +- **Map** sends the remote command `map toggle`, and **Lua** sends `lua toggle`. Both go through + `RynthPluginApplyRemoteCommand`, the same path as the ILT Hub button. Both buttons have tooltips. +- `AddSplitLauncher` now returns its two half buttons. + +## RynthAi 0.6.21 + +- New remote commands and chat commands `/ra map [show|hide]` and `/ra lua [show|hide]`. With no + argument they toggle. They go through `HandleWindowCommand` to `LegacyDashboardRenderer.SetDungeonMapVisible` / + `SetLuaWindowVisible`, which persist the choice and print a chat confirmation. Turning the map on + while outdoors says it will appear indoors. Both commands are listed in the `/ra` help. +- `OnRenderOverlay` (Avalonia mode) now calls `RenderMapWindow(includeRadarAndChat: false)`. + It draws only the dungeon map, because the Avalonia Radar panel and RynthChat already exist. + ImGui-shell mode still draws all three. +- `RenderOverlayWindows` now also draws the Lua Scripts editor. Opening it rescans the + `LuaScripts` folder. +- Fix: the dungeon map would not reopen after being closed with its title-bar X (its own `_open` + flag stayed false and closed it again on the same frame) until you went outdoors and back. + `DungeonMapUi.Render` now reopens whenever `ShowDungeonMap` is set. diff --git a/src/RynthCore.Engine/UI/Panels/RynthAiPanel.cs b/src/RynthCore.Engine/UI/Panels/RynthAiPanel.cs index 45c96c4..9407e99 100644 --- a/src/RynthCore.Engine/UI/Panels/RynthAiPanel.cs +++ b/src/RynthCore.Engine/UI/Panels/RynthAiPanel.cs @@ -700,14 +700,32 @@ internal static partial class RynthAiPanel RowDefinitions = new RowDefinitions("Auto,Auto,Auto"), Margin = new Thickness(0, 4, 0, 0) }; - AddSplitLauncher(launcherGrid, 0, 0, "Meta", "⚙", "Lua", "<>", - onLeftClick: () => AvaloniaOverlay.ActivateBarButton("Meta")); + // Lua: the Lua Scripts editor is an ImGui window inside RynthAi (drawn from its + // RynthPluginRenderOverlay), so the button toggles it like "/ra lua". + var (_, luaBtn) = AddSplitLauncher(launcherGrid, 0, 0, "Meta", "⚙", "Lua", "<>", + onLeftClick: () => AvaloniaOverlay.ActivateBarButton("Meta"), + onRightClick: () => + { + ClosePicker(); + if (_applyRemoteCommand == null) TryBind(); + SendRemoteCmd("lua", "toggle"); + }); + ToolTip.SetTip(luaBtn, "Show/hide the Lua Scripts editor (/ra lua)."); AddLauncher(launcherGrid, 0, 1, "Monsters", "◎", onClick: () => AvaloniaOverlay.ActivateBarButton("Monsters")); AddLauncher(launcherGrid, 0, 2, "Settings", "⚒", onClick: () => AvaloniaOverlay.ActivateBarButton("Settings")); - AddSplitLauncher(launcherGrid, 1, 0, "Nav", "➤", "Map", "🗺", - onLeftClick: () => AvaloniaOverlay.ActivateBarButton("Nav")); + // Map: the dungeon map is an ImGui window inside RynthAi (DashWindows.ShowDungeonMap), + // drawn from its RynthPluginRenderOverlay; the button toggles it like "/ra map". + var (_, mapBtn) = AddSplitLauncher(launcherGrid, 1, 0, "Nav", "➤", "Map", "🗺", + onLeftClick: () => AvaloniaOverlay.ActivateBarButton("Nav"), + onRightClick: () => + { + ClosePicker(); + if (_applyRemoteCommand == null) TryBind(); + SendRemoteCmd("map", "toggle"); + }); + ToolTip.SetTip(mapBtn, "Show/hide the dungeon map (/ra map). It appears when you are indoors."); AddLauncher(launcherGrid, 1, 1, "Items", "🛡", onClick: () => AvaloniaOverlay.ActivateBarButton("Items")); var patrolBtn = AddLauncher(launcherGrid, 1, 2, "Patrol", "⬡", @@ -1384,16 +1402,18 @@ internal static partial class RynthAiPanel /// by side. Used for Nav | Map so the user can pop the navigation panel /// or the dungeon map independently from the same row slot. /// - private static void AddSplitLauncher(Grid grid, int row, int col, + /// The left and right half buttons (e.g. for tooltips). + private static (Button Left, Button Right) AddSplitLauncher(Grid grid, int row, int col, string leftLabel, string leftIcon, string rightLabel, string rightIcon, Action? onLeftClick = null, Action? onRightClick = null) { var splitGrid = new Grid { ColumnDefinitions = new ColumnDefinitions("*,*") }; - AddLauncher(splitGrid, 0, 0, leftLabel, leftIcon, onLeftClick); - AddLauncher(splitGrid, 0, 1, rightLabel, rightIcon, onRightClick); + var left = AddLauncher(splitGrid, 0, 0, leftLabel, leftIcon, onLeftClick); + var right = AddLauncher(splitGrid, 0, 1, rightLabel, rightIcon, onRightClick); grid.Children.Add(splitGrid); Grid.SetRow(splitGrid, row); Grid.SetColumn(splitGrid, col); + return (left, right); } private static Button AddLauncher(Grid grid, int row, int col, string label, string icon, Action? onClick = null)