Add VV button to the solution editor (#38889)
add vv button to solution editor
This commit is contained in:
@@ -8,6 +8,21 @@
|
||||
<OptionButton Name="SolutionOption" HorizontalExpand="True"/>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="0 4">
|
||||
<Button Name="VVButton"
|
||||
Text="{Loc 'admin-solutions-window-vv-button'}"
|
||||
ToolTip="{Loc 'admin-solutions-window-vv-button-tooltip'}"
|
||||
Disabled="True"
|
||||
HorizontalExpand="True"
|
||||
StyleClasses="OpenRight"/>
|
||||
<Button Name="SolutionButton"
|
||||
Text="{Loc 'admin-solutions-window-solution-button'}"
|
||||
ToolTip="{Loc 'admin-solutions-window-solution-button-tooltip'}"
|
||||
Disabled="True"
|
||||
HorizontalExpand="True"
|
||||
StyleClasses="OpenLeft"/>
|
||||
</BoxContainer>
|
||||
|
||||
<!-- The total volume / capacity of the solution -->
|
||||
<BoxContainer Name="VolumeBox" Orientation="Vertical" HorizontalExpand="True" Margin="0 4"/>
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the corresponding solution entity in a ViewVariables window.
|
||||
/// </summary>
|
||||
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}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the corresponding Solution instance in a ViewVariables window.
|
||||
/// </summary>
|
||||
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");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When a new solution is selected, set _selectedSolution and update the reagent list.
|
||||
/// </summary>
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user