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,8 +1,10 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Shared.CCVar;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Random;
using Robust.Shared.Collections;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
@@ -59,6 +61,7 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
{
var groupRemove = new ValueList<string>();
var protoManager = collection.Resolve<IPrototypeManager>();
var configManager = collection.Resolve<IConfigurationManager>();
if (!protoManager.TryIndex(Role, out var roleProto))
{
@@ -78,10 +81,11 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
if (EntityName != null)
{
var name = EntityName.Trim();
var maxNameLength = configManager.GetCVar(CCVars.MaxNameLength);
if (name.Length > HumanoidCharacterProfile.MaxNameLength)
if (name.Length > maxNameLength)
{
EntityName = name[..HumanoidCharacterProfile.MaxNameLength];
EntityName = name[..maxNameLength];
}
if (name.Length == 0)