HumanoidCharacterProfile and IdCardConsoleComponent constants moved to cvar. Sync id card length with character name length (#35407)

* commit

* mark TODOs

* compiles

* cleanup

* cleanup

* oops

* changed my mind

* requested changes

* genpop fix
This commit is contained in:
āda
2025-05-17 00:27:39 -05:00
committed by GitHub
parent 0fed68d240
commit de24413bd5
17 changed files with 158 additions and 35 deletions

View File

@@ -1,19 +1,25 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.CCVar;
using Content.Shared.Pinpointer;
using Content.Shared.Preferences;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
namespace Content.Client.Pinpointer.UI;
[GenerateTypedNameReferences]
public sealed partial class NavMapBeaconWindow : FancyWindow
{
[Dependency] private readonly IConfigurationManager _cfgManager = default!;
private string? _defaultLabel;
private bool _defaultEnabled;
private Color _defaultColor;
// CCVar.
private int _maxNameLength;
public event Action<string?, bool, Color>? OnApplyButtonPressed;
public NavMapBeaconWindow()
@@ -21,6 +27,7 @@ public sealed partial class NavMapBeaconWindow : FancyWindow
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_maxNameLength = _cfgManager.GetCVar(CCVars.MaxNameLength);
VisibleButton.OnPressed += args => UpdateVisibleButton(args.Button.Pressed);
LabelLineEdit.OnTextChanged += OnTextChanged;
@@ -53,8 +60,8 @@ public sealed partial class NavMapBeaconWindow : FancyWindow
private void OnTextChanged(LineEdit.LineEditEventArgs obj)
{
if (obj.Text.Length > HumanoidCharacterProfile.MaxNameLength)
obj.Control.Text = obj.Text.Substring(0, HumanoidCharacterProfile.MaxNameLength);
if (obj.Text.Length > _maxNameLength)
obj.Control.Text = obj.Text.Substring(0, _maxNameLength);
TryEnableApplyButton();
}