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:
@@ -1,11 +1,13 @@
|
||||
using System.Numerics;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Preferences.Loadouts;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
@@ -23,12 +25,18 @@ public sealed partial class LoadoutWindow : FancyWindow
|
||||
|
||||
public HumanoidCharacterProfile Profile;
|
||||
|
||||
// CCvar.
|
||||
private int _maxLoadoutNameLength;
|
||||
|
||||
public LoadoutWindow(HumanoidCharacterProfile profile, RoleLoadout loadout, RoleLoadoutPrototype proto, ICommonSession session, IDependencyCollection collection)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
Profile = profile;
|
||||
var protoManager = collection.Resolve<IPrototypeManager>();
|
||||
RoleNameEdit.IsValid = text => text.Length <= HumanoidCharacterProfile.MaxLoadoutNameLength;
|
||||
var configManager = collection.Resolve<IConfigurationManager>();
|
||||
|
||||
_maxLoadoutNameLength = configManager.GetCVar(CCVars.MaxLoadoutNameLength);
|
||||
RoleNameEdit.IsValid = text => text.Length <= _maxLoadoutNameLength;
|
||||
|
||||
// Hide if we can't edit the name.
|
||||
if (!proto.CanCustomizeName)
|
||||
@@ -45,7 +53,7 @@ public sealed partial class LoadoutWindow : FancyWindow
|
||||
|
||||
RoleNameEdit.ToolTip = Loc.GetString(
|
||||
"loadout-name-edit-tooltip",
|
||||
("max", HumanoidCharacterProfile.MaxLoadoutNameLength));
|
||||
("max", _maxLoadoutNameLength));
|
||||
RoleNameEdit.Text = name ?? string.Empty;
|
||||
RoleNameEdit.OnTextChanged += args => OnNameChanged?.Invoke(args.Text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user