From 0484b7f07e32e7b985f4c243ec1a5aa387a020e5 Mon Sep 17 00:00:00 2001
From: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Date: Thu, 10 Jul 2025 08:31:39 +0200
Subject: [PATCH] Add VV button to the solution editor (#38889)
add vv button to solution editor
---
.../ManageSolutions/EditSolutionsWindow.xaml | 15 +++++++++
.../EditSolutionsWindow.xaml.cs | 33 +++++++++++++++++++
.../ui/manage-solutions/manage-solutions.ftl | 6 +++-
3 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml b/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml
index 01259b60f7..6146240824 100644
--- a/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml
+++ b/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml
@@ -8,6 +8,21 @@
+
+
+
+
+
diff --git a/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs b/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs
index 812f2de3a0..a6b61a4393 100644
--- a/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs
+++ b/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs
@@ -1,3 +1,4 @@
+using Content.Client.Administration.Managers;
using Content.Shared.Administration;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
@@ -20,6 +21,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IClientGameTiming _timing = default!;
+ [Dependency] private readonly IClientAdminManager _admin = default!;
private NetEntity _target = NetEntity.Invalid;
private string? _selectedSolution;
@@ -34,6 +36,11 @@ namespace Content.Client.Administration.UI.ManageSolutions
SolutionOption.OnItemSelected += SolutionSelected;
AddButton.OnPressed += OpenAddReagentWindow;
+ VVButton.OnPressed += OpenVVWindow;
+ SolutionButton.OnPressed += OpenSolutionWindow;
+
+ VVButton.Disabled = !_admin.CanViewVar();
+ SolutionButton.Disabled = !_admin.CanViewVar();
}
public override void Close()
@@ -271,6 +278,32 @@ namespace Content.Client.Administration.UI.ManageSolutions
_addReagentWindow.OpenCentered();
}
+ ///
+ /// Open the corresponding solution entity in a ViewVariables window.
+ ///
+ private void OpenVVWindow(BaseButton.ButtonEventArgs obj)
+ {
+ if (_solutions == null
+ || _selectedSolution == null
+ || !_solutions.TryGetValue(_selectedSolution, out var uid)
+ || !_entityManager.TryGetNetEntity(uid, out var netEntity))
+ return;
+ _consoleHost.ExecuteCommand($"vv {netEntity}");
+ }
+
+ ///
+ /// Open the corresponding Solution instance in a ViewVariables window.
+ ///
+ private void OpenSolutionWindow(BaseButton.ButtonEventArgs obj)
+ {
+ if (_solutions == null
+ || _selectedSolution == null
+ || !_solutions.TryGetValue(_selectedSolution, out var uid)
+ || !_entityManager.TryGetNetEntity(uid, out var netEntity))
+ return;
+ _consoleHost.ExecuteCommand($"vv /entity/{netEntity}/Solution/Solution");
+ }
+
///
/// When a new solution is selected, set _selectedSolution and update the reagent list.
///
diff --git a/Resources/Locale/en-US/administration/ui/manage-solutions/manage-solutions.ftl b/Resources/Locale/en-US/administration/ui/manage-solutions/manage-solutions.ftl
index e5c0b33d4e..9374644985 100644
--- a/Resources/Locale/en-US/administration/ui/manage-solutions/manage-solutions.ftl
+++ b/Resources/Locale/en-US/administration/ui/manage-solutions/manage-solutions.ftl
@@ -1,5 +1,9 @@
admin-solutions-window-title = Solution Editor - {$targetName}
admin-solutions-window-solution-label = Target solution:
+admin-solutions-window-solution-button = Solution
+admin-solutions-window-solution-button-tooltip = Opens the corresponding server-side Solution instance in ViewVariables. Useful for debugging prediction issues.
+admin-solutions-window-vv-button = VV
+admin-solutions-window-vv-button-tooltip = Opens the corresponding solution entity in ViewVariables.
admin-solutions-window-add-new-button = Add new reagent
admin-solutions-window-volume-label = Volume {$currentVolume}/{$maxVolume}u
admin-solutions-window-capacity-label = Capacity (u):
@@ -7,4 +11,4 @@ admin-solutions-window-specific-heat-label = Specific Heat: {$specificHeat} J/(K
admin-solutions-window-heat-capacity-label = Heat Capacity: {$heatCapacity} J/K
admin-solutions-window-temperature-label = Temperature (K):
admin-solutions-window-thermal-energy-label = Thermal Energy (J):
-admin-solutions-window-thermals = Thermals
\ No newline at end of file
+admin-solutions-window-thermals = Thermals
--
2.51.2