]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make the panic bunker UI send cvar updates on focus exit, add erase verb tooltip...
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Sat, 14 Oct 2023 09:28:08 +0000 (02:28 -0700)
committerGitHub <noreply@github.com>
Sat, 14 Oct 2023 09:28:08 +0000 (02:28 -0700)
Content.Client/Administration/UI/Tabs/PanicBunkerTab/PanicBunkerTab.xaml.cs
Content.Server/Administration/Systems/AdminVerbSystem.cs
Resources/Changelog/Admin.yml
Resources/Locale/en-US/administration/admin-verbs.ftl

index e9d3b95c5d8d97d4a2e9e509f7a6afde76ab5636..f6212cd5ee1066a0757335393490c3f48af1623f 100644 (file)
@@ -11,6 +11,9 @@ public sealed partial class PanicBunkerTab : Control
 {
     [Dependency] private readonly IConsoleHost _console = default!;
 
+    private string _minAccountAge;
+    private string _minOverallHours;
+
     public PanicBunkerTab()
     {
         RobustXamlLoader.Load(this);
@@ -18,21 +21,37 @@ public sealed partial class PanicBunkerTab : Control
 
         DisableAutomaticallyButton.ToolTip = Loc.GetString("admin-ui-panic-bunker-disable-automatically-tooltip");
 
-        MinAccountAge.OnTextEntered += args =>
+        MinAccountAge.OnTextEntered += args => SendMinAccountAge(args.Text);
+        MinAccountAge.OnFocusExit += args => SendMinAccountAge(args.Text);
+        _minAccountAge = MinAccountAge.Text;
+
+        MinOverallHours.OnTextEntered += args => SendMinOverallHours(args.Text);
+        MinOverallHours.OnFocusExit += args => SendMinOverallHours(args.Text);
+        _minOverallHours = MinOverallHours.Text;
+    }
+
+    private void SendMinAccountAge(string text)
+    {
+        if (string.IsNullOrWhiteSpace(text) ||
+            text == _minAccountAge ||
+            !int.TryParse(text, out var minutes))
         {
-            if (string.IsNullOrWhiteSpace(args.Text) || !int.TryParse(args.Text, out var minutes))
-                return;
+            return;
+        }
 
-            _console.ExecuteCommand($"panicbunker_min_account_age {minutes}");
-        };
+        _console.ExecuteCommand($"panicbunker_min_account_age {minutes}");
+    }
 
-        MinOverallHours.OnTextEntered += args =>
+    private void SendMinOverallHours(string text)
+    {
+        if (string.IsNullOrWhiteSpace(text) ||
+            text == _minOverallHours ||
+            !int.TryParse(text, out var hours))
         {
-            if (string.IsNullOrWhiteSpace(args.Text) || !int.TryParse(args.Text, out var hours))
-                return;
+            return;
+        }
 
-            _console.ExecuteCommand($"panicbunker_min_overall_hours {hours}");
-        };
+        _console.ExecuteCommand($"panicbunker_min_overall_hours {hours}");
     }
 
     public void UpdateStatus(PanicBunkerStatus status)
@@ -48,7 +67,11 @@ public sealed partial class PanicBunkerTab : Control
         EnableAutomaticallyButton.Pressed = status.EnableWithoutAdmins;
         CountDeadminnedButton.Pressed = status.CountDeadminnedAdmins;
         ShowReasonButton.Pressed = status.ShowReason;
+
         MinAccountAge.Text = status.MinAccountAgeHours.ToString();
+        _minAccountAge = MinAccountAge.Text;
+
         MinOverallHours.Text = status.MinOverallHours.ToString();
+        _minOverallHours = MinOverallHours.Text;
     }
 }
index e493cea6a7b9f9d2da2c9ab0f4b35cc4eda92ff3..4ed8e19f553f7af38404dd210e2f75ad961d5520 100644 (file)
@@ -146,6 +146,7 @@ namespace Content.Server.Administration.Systems
                     args.Verbs.Add(new Verb
                     {
                         Text = Loc.GetString("admin-verbs-erase"),
+                        Message = Loc.GetString("admin-verbs-erase-description"),
                         Category = VerbCategory.Admin,
                         Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png")),
                         Act = () =>
index 93db39b973bd449c9af4d252ec315066b49d33c9..728859e3f426b4ebb5b929080f7f1aea29637654 100644 (file)
@@ -24,3 +24,10 @@ Entries:
   - {message: 'Added admin Erase verb, add checkbox to erase from the ban panel.', type: Add}
   id: 4
   time: '2023-10-14T09:00:00.0000000+00:00'
+- author: DrSmugleaf
+  changes:
+  - {message: 'Made the panic bunker UI also set the minimum account age/playtime
+      requirements when the two inputs lose focus, not just when pressing enter.', type: Tweak}
+  - {message: 'Added message tooltip to the erase verb.', type: Tweak}
+  id: 5
+  time: '2023-10-14T09:21:00.0000000+00:00'
index 224ada4b63962757d609ec27148ca4b737aa5eaa..03f92f7c420f01835c08d1c248bff7b5f17b7757 100644 (file)
@@ -8,5 +8,8 @@ admin-verbs-teleport-here = Teleport Here
 admin-verbs-freeze = Freeze
 admin-verbs-unfreeze = Unfreeze
 admin-verbs-erase = Erase
+admin-verbs-erase-description = Removes the player from the round and crew manifest and deletes their chat messages.
+    Their items are dropped on the ground.
+    Players are shown a popup indicating them to play as if they never existed.
 toolshed-verb-mark = Mark
 toolshed-verb-mark-description = Places this entity into the $marked variable, a list of entities, replacing it's prior value.