Make the panic bunker UI send cvar updates on focus exit, add erase verb tooltip message (#20987)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
_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;
|
||||
}
|
||||
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = () =>
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user