From: DrSmugleaf Date: Sat, 14 Oct 2023 09:28:08 +0000 (-0700) Subject: Make the panic bunker UI send cvar updates on focus exit, add erase verb tooltip... X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=f02a54497dbf9b7df4e94315b4008ba5db40d385;p=space-station-14.git Make the panic bunker UI send cvar updates on focus exit, add erase verb tooltip message (#20987) --- diff --git a/Content.Client/Administration/UI/Tabs/PanicBunkerTab/PanicBunkerTab.xaml.cs b/Content.Client/Administration/UI/Tabs/PanicBunkerTab/PanicBunkerTab.xaml.cs index e9d3b95c5d..f6212cd5ee 100644 --- a/Content.Client/Administration/UI/Tabs/PanicBunkerTab/PanicBunkerTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/PanicBunkerTab/PanicBunkerTab.xaml.cs @@ -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; } } diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index e493cea6a7..4ed8e19f55 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -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 = () => diff --git a/Resources/Changelog/Admin.yml b/Resources/Changelog/Admin.yml index 93db39b973..728859e3f4 100644 --- a/Resources/Changelog/Admin.yml +++ b/Resources/Changelog/Admin.yml @@ -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' diff --git a/Resources/Locale/en-US/administration/admin-verbs.ftl b/Resources/Locale/en-US/administration/admin-verbs.ftl index 224ada4b63..03f92f7c42 100644 --- a/Resources/Locale/en-US/administration/admin-verbs.ftl +++ b/Resources/Locale/en-US/administration/admin-verbs.ftl @@ -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.