]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
tweak: add confirm to server restart button (#37849)
authorPerry Fraser <perryprog@users.noreply.github.com>
Tue, 27 May 2025 23:44:15 +0000 (19:44 -0400)
committerGitHub <noreply@github.com>
Tue, 27 May 2025 23:44:15 +0000 (19:44 -0400)
Content.Client/Administration/UI/Tabs/ServerTab.xaml
Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs

index b9984058358c4b2bb664fc394db4afec815f23ca..80c186f7fd07e36ee4e8c35dab2fc711d8c71ce0 100644 (file)
@@ -1,11 +1,12 @@
 <Control
     xmlns="https://spacestation14.io"
     xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
+    xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
     Margin="4"
     MinSize="50 50">
     <GridContainer
         Columns="4" >
-        <cc:CommandButton Command="shutdown" Text="{Loc server-shutdown}" />
+        <controls:ConfirmButton Name="ServerShutdownButton" Text="{Loc server-shutdown}" />
         <cc:CommandButton Name="SetOocButton" Command="setooc" Text="{Loc server-ooc-toggle}" ToggleMode="True" />
         <cc:CommandButton Name="SetLoocButton" Command="setlooc" Text="{Loc server-looc-toggle}" ToggleMode="True" />
     </GridContainer>
index 24b92e42ce784d7b7a1f8682d1f3ca9b1e7dbdd2..7a70e42d066bf46a73b1fcb836046d8b3df51598 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Shared.CCVar;
 using Robust.Client.AutoGenerated;
+using Robust.Client.Console;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.XAML;
 using Robust.Shared.Configuration;
@@ -10,6 +11,7 @@ namespace Content.Client.Administration.UI.Tabs
     public sealed partial class ServerTab : Control
     {
         [Dependency] private readonly IConfigurationManager _config = default!;
+        [Dependency] private readonly IClientConsoleHost _console = default!;
 
         public ServerTab()
         {
@@ -18,6 +20,8 @@ namespace Content.Client.Administration.UI.Tabs
 
             _config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true);
             _config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true);
+
+            ServerShutdownButton.OnPressed += _ => _console.ExecuteCommand("shutdown");
         }
 
         private void OocEnabledChanged(bool value)