using Content.Shared.Access;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
+using Content.Shared.CCVar;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.CrewManifest;
+using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using static Content.Shared.Access.Components.IdCardConsoleComponent;
public sealed class IdCardConsoleBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
private readonly SharedIdCardConsoleSystem _idCardConsoleSystem = default!;
private IdCardConsoleWindow? _window;
+ // CCVar.
+ private int _maxNameLength;
+ private int _maxIdJobLength;
+
public IdCardConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
_idCardConsoleSystem = EntMan.System<SharedIdCardConsoleSystem>();
+
+ _maxNameLength =_cfgManager.GetCVar(CCVars.MaxNameLength);
+ _maxIdJobLength = _cfgManager.GetCVar(CCVars.MaxIdJobLength);
}
protected override void Open()
public void SubmitData(string newFullName, string newJobTitle, List<ProtoId<AccessLevelPrototype>> newAccessList, string newJobPrototype)
{
- if (newFullName.Length > MaxFullNameLength)
- newFullName = newFullName[..MaxFullNameLength];
+ if (newFullName.Length > _maxNameLength)
+ newFullName = newFullName[.._maxNameLength];
- if (newJobTitle.Length > MaxJobTitleLength)
- newJobTitle = newJobTitle[..MaxJobTitleLength];
+ if (newJobTitle.Length > _maxIdJobLength)
+ newJobTitle = newJobTitle[.._maxIdJobLength];
SendMessage(new WriteToTargetIdMessage(
newFullName,
using System.Linq;
using Content.Shared.Access;
using Content.Shared.Access.Systems;
+using Content.Shared.CCVar;
using Content.Shared.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using static Content.Shared.Access.Components.IdCardConsoleComponent;
[GenerateTypedNameReferences]
public sealed partial class IdCardConsoleWindow : DefaultWindow
{
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ILogManager _logManager = default!;
private readonly ISawmill _logMill = default!;
private readonly IdCardConsoleBoundUserInterface _owner;
+ // CCVar.
+ private int _maxNameLength;
+ private int _maxIdJobLength;
+
private AccessLevelControl _accessButtons = new();
private readonly List<string> _jobPrototypeIds = new();
_owner = owner;
+ _maxNameLength = _cfgManager.GetCVar(CCVars.MaxNameLength);
+ _maxIdJobLength = _cfgManager.GetCVar(CCVars.MaxIdJobLength);
+
FullNameLineEdit.OnTextEntered += _ => SubmitData();
+ FullNameLineEdit.IsValid = s => s.Length <= _maxNameLength;
FullNameLineEdit.OnTextChanged += _ =>
{
FullNameSaveButton.Disabled = FullNameSaveButton.Text == _lastFullName;
FullNameSaveButton.OnPressed += _ => SubmitData();
JobTitleLineEdit.OnTextEntered += _ => SubmitData();
+ JobTitleLineEdit.IsValid = s => s.Length <= _maxIdJobLength;
JobTitleLineEdit.OnTextChanged += _ =>
{
JobTitleSaveButton.Disabled = JobTitleLineEdit.Text == _lastJobTitle;
private readonly SpriteSystem _sprite;
+ // CCvar.
+ private int _maxNameLength;
+ private bool _allowFlavorText;
+
private FlavorText.FlavorText? _flavorText;
private TextEdit? _flavorTextEdit;
_requirements = requirements;
_controller = UserInterfaceManager.GetUIController<LobbyUIController>();
_sprite = _entManager.System<SpriteSystem>();
+
+ _maxNameLength = _cfgManager.GetCVar(CCVars.MaxNameLength);
+ _allowFlavorText = _cfgManager.GetCVar(CCVars.FlavorText);
+
ImportButton.OnPressed += args =>
{
ImportProfile();
#region Name
NameEdit.OnTextChanged += args => { SetName(args.Text); };
+ NameEdit.IsValid = args => args.Length <= _maxNameLength;
NameRandomize.OnPressed += args => RandomizeName();
RandomizeEverythingButton.OnPressed += args => { RandomizeEverything(); };
WarningLabel.SetMarkup($"[color=red]{Loc.GetString("humanoid-profile-editor-naming-rules-warning")}[/color]");
/// </summary>
public void RefreshFlavorText()
{
- if (_cfgManager.GetCVar(CCVars.FlavorText))
+ if (_allowFlavorText)
{
if (_flavorText != null)
return;
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;
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)
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);
}
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()
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
+ _maxNameLength = _cfgManager.GetCVar(CCVars.MaxNameLength);
VisibleButton.OnPressed += args => UpdateVisibleButton(args.Button.Pressed);
LabelLineEdit.OnTextChanged += OnTextChanged;
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();
}
using Content.Client.Message;
using Content.Client.UserInterface.Controls;
using Content.Shared.Access.Components;
+using Content.Shared.CCVar;
using Content.Shared.Security.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Configuration;
namespace Content.Client.Security.Ui;
[GenerateTypedNameReferences]
public sealed partial class GenpopLockerMenu : FancyWindow
{
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
+
public event Action<string, float, string>? OnConfigurationComplete;
+ // CCVar.
+ private int _maxIdJobLength;
+
public GenpopLockerMenu(EntityUid owner, IEntityManager entMan)
{
RobustXamlLoader.Load(this);
+ _maxIdJobLength = _cfgManager.GetCVar(CCVars.MaxIdJobLength);
+
Title = entMan.GetComponent<MetaDataComponent>(owner).EntityName;
NameLabel.SetMarkup(Loc.GetString("genpop-locker-ui-label-name"));
SentenceEdit.Text = "5";
CrimeEdit.Text = Loc.GetString("genpop-prisoner-id-crime-default");
- NameEdit.IsValid = val => !string.IsNullOrWhiteSpace(val) && val.Length <= IdCardConsoleComponent.MaxFullNameLength;
+ NameEdit.IsValid = val => !string.IsNullOrWhiteSpace(val) && val.Length <= _maxIdJobLength;
SentenceEdit.IsValid = val => float.TryParse(val, out var f) && f >= 0;
CrimeEdit.IsValid = val => !string.IsNullOrWhiteSpace(val) && val.Length <= GenpopLockerComponent.MaxCrimeLength;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
+using Content.Shared.CCVar;
using Content.Shared.NameIdentifier;
using Content.Shared.NameModifier.EntitySystems;
using Content.Shared.Preferences;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Configuration;
using Robust.Shared.Timing;
namespace Content.Client.Silicons.Borgs;
[GenerateTypedNameReferences]
public sealed partial class BorgMenu : FancyWindow
{
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly IEntityManager _entity = default!;
private readonly NameModifierSystem _nameModifier;
private string _lastValidName;
private List<EntityUid> _modules = new();
+ // CCVar.
+ private int _maxNameLength;
+
public EntityUid Entity;
public BorgMenu()
_nameModifier = _entity.System<NameModifierSystem>();
+ _maxNameLength = _cfgManager.GetCVar(CCVars.MaxNameLength);
+
_lastValidName = NameLineEdit.Text;
EjectBatteryButton.OnPressed += _ => EjectBatteryButtonPressed?.Invoke();
return;
}
- if (obj.Text.Length > HumanoidCharacterProfile.MaxNameLength)
+ if (obj.Text.Length > _maxNameLength)
{
- obj.Control.Text = obj.Text.Substring(0, HumanoidCharacterProfile.MaxNameLength);
+ obj.Control.Text = obj.Text.Substring(0, _maxNameLength);
}
_lastValidName = obj.Control.Text;
private void OnNameFocusExit(LineEdit.LineEditEventArgs obj)
{
- if (obj.Text.Length > HumanoidCharacterProfile.MaxNameLength ||
+ if (obj.Text.Length > _maxNameLength ||
obj.Text.Length == 0 ||
string.IsNullOrWhiteSpace(obj.Text) ||
string.IsNullOrEmpty(obj.Text))
using Content.Server.Administration;
using Content.Shared.Access.Components;
using Content.Shared.Administration;
+using Content.Shared.CCVar;
using Robust.Server.Player;
+using Robust.Shared.Configuration;
using Robust.Shared.Console;
namespace Content.Server.Mind.Commands;
[AdminCommand(AdminFlags.VarEdit)]
public sealed class RenameCommand : LocalizedEntityCommands
{
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
}
var name = args[1];
- if (name.Length > IdCardConsoleComponent.MaxFullNameLength)
+ if (name.Length > _cfgManager.GetCVar(CCVars.MaxNameLength))
{
shell.WriteLine(Loc.GetString("cmd-rename-too-long"));
return;
using System.Linq;
using Content.Shared.UserInterface;
+using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.NameIdentifier;
using Content.Shared.PowerCell.Components;
using Content.Shared.Preferences;
using Content.Shared.Silicons.Borgs;
using Content.Shared.Silicons.Borgs.Components;
+using Robust.Shared.Configuration;
namespace Content.Server.Silicons.Borgs;
/// <inheritdoc/>
public sealed partial class BorgSystem
{
+ // CCvar.
+ private int _maxNameLength;
+
public void InitializeUI()
{
SubscribeLocalEvent<BorgChassisComponent, BeforeActivatableUIOpenEvent>(OnBeforeBorgUiOpen);
SubscribeLocalEvent<BorgChassisComponent, BorgEjectBatteryBuiMessage>(OnEjectBatteryBuiMessage);
SubscribeLocalEvent<BorgChassisComponent, BorgSetNameBuiMessage>(OnSetNameBuiMessage);
SubscribeLocalEvent<BorgChassisComponent, BorgRemoveModuleBuiMessage>(OnRemoveModuleBuiMessage);
+
+ Subs.CVar(_cfgManager, CCVars.MaxNameLength, value => _maxNameLength = value, true);
}
private void OnBeforeBorgUiOpen(EntityUid uid, BorgChassisComponent component, BeforeActivatableUIOpenEvent args)
private void OnSetNameBuiMessage(EntityUid uid, BorgChassisComponent component, BorgSetNameBuiMessage args)
{
- if (args.Name.Length > HumanoidCharacterProfile.MaxNameLength ||
+ if (args.Name.Length > _maxNameLength ||
args.Name.Length == 0 ||
string.IsNullOrWhiteSpace(args.Name) ||
string.IsNullOrEmpty(args.Name))
using Content.Shared.Whitelist;
using Content.Shared.Wires;
using Robust.Server.GameObjects;
+using Robust.Shared.Configuration;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Random;
{
[Dependency] private readonly IAdminLogManager _adminLog = default!;
[Dependency] private readonly IBanManager _banManager = default!;
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionsSystem _actions = default!;
using Content.Shared.Actions;
using Content.Shared.Administration.Logs;
+using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Clothing;
using Content.Shared.Database;
using Content.Shared.Preferences;
using Content.Shared.Speech;
using Content.Shared.VoiceMask;
+using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
namespace Content.Server.VoiceMask;
{
[Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
+ // CCVar.
+ private int _maxNameLength;
+
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<VoiceMaskComponent, VoiceMaskChangeVerbMessage>(OnChangeVerb);
SubscribeLocalEvent<VoiceMaskComponent, ClothingGotEquippedEvent>(OnEquip);
SubscribeLocalEvent<VoiceMaskSetNameEvent>(OpenUI);
+
+ Subs.CVar(_cfgManager, CCVars.MaxNameLength, value => _maxNameLength = value, true);
}
private void OnTransformSpeakerName(Entity<VoiceMaskComponent> entity, ref InventoryRelayedEvent<TransformSpeakerNameEvent> args)
private void OnChangeName(Entity<VoiceMaskComponent> entity, ref VoiceMaskChangeNameMessage message)
{
- if (message.Name.Length > HumanoidCharacterProfile.MaxNameLength || message.Name.Length <= 0)
+ if (message.Name.Length > _maxNameLength || message.Name.Length <= 0)
{
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-failure"), entity, message.Actor, PopupType.SmallCaution);
return;
[Access(typeof(SharedIdCardConsoleSystem))]
public sealed partial class IdCardConsoleComponent : Component
{
- public const int MaxFullNameLength = 30;
- public const int MaxJobTitleLength = 30;
-
public static string PrivilegedIdCardSlotId = "IdCardConsole-privilegedId";
public static string TargetIdCardSlotId = "IdCardConsole-targetId";
using System.Globalization;
using Content.Shared.Access.Components;
using Content.Shared.Administration.Logs;
+using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.Hands.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.PDA;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
+using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
public abstract class SharedIdCardSystem : EntitySystem
{
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedAccessSystem _access = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+ // CCVar.
+ private int _maxNameLength;
+ private int _maxIdJobLength;
+
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<IdCardComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<TryGetIdentityShortInfoEvent>(OnTryGetIdentityShortInfo);
SubscribeLocalEvent<EntityRenamedEvent>(OnRename);
+
+ Subs.CVar(_cfgManager, CCVars.MaxNameLength, value => _maxNameLength = value, true);
+ Subs.CVar(_cfgManager, CCVars.MaxIdJobLength, value => _maxIdJobLength = value, true);
}
private void OnRename(ref EntityRenamedEvent ev)
{
jobTitle = jobTitle.Trim();
- if (jobTitle.Length > IdCardConsoleComponent.MaxJobTitleLength)
- jobTitle = jobTitle[..IdCardConsoleComponent.MaxJobTitleLength];
+ if (jobTitle.Length > _maxIdJobLength)
+ jobTitle = jobTitle[.._maxIdJobLength];
}
else
{
if (!string.IsNullOrWhiteSpace(fullName))
{
fullName = fullName.Trim();
- if (fullName.Length > IdCardConsoleComponent.MaxFullNameLength)
- fullName = fullName[..IdCardConsoleComponent.MaxFullNameLength];
+ if (fullName.Length > _maxNameLength)
+ fullName = fullName[.._maxNameLength];
}
else
{
CVarDef.Create("ic.restricted_names", true, CVar.SERVER | CVar.REPLICATED);
/// <summary>
- /// Allows flavor text (character descriptions)
+ /// Sets the maximum IC name length.
+ /// </summary>
+ public static readonly CVarDef<int> MaxNameLength =
+ CVarDef.Create("ic.name_length", 32, CVar.SERVER | CVar.REPLICATED);
+
+ /// <summary>
+ /// Sets the maximum name length for a loadout name (e.g. cyborg name).
+ /// </summary>
+ public static readonly CVarDef<int> MaxLoadoutNameLength =
+ CVarDef.Create("ic.loadout_name_length", 32, CVar.SERVER | CVar.REPLICATED);
+
+ /// <summary>
+ /// Allows flavor text (character descriptions).
/// </summary>
public static readonly CVarDef<bool> FlavorText =
CVarDef.Create("ic.flavor_text", false, CVar.SERVER | CVar.REPLICATED);
+ /// <summary>
+ /// Sets the maximum length for flavor text (character descriptions).
+ /// </summary>
+ public static readonly CVarDef<int> MaxFlavorTextLength =
+ CVarDef.Create("ic.flavor_text_length", 512, CVar.SERVER | CVar.REPLICATED);
+
+ /// <summary>
+ /// Sets the maximum character length of a job on an ID.
+ /// </summary>
+ public static readonly CVarDef<int> MaxIdJobLength =
+ CVarDef.Create("ic.id_job_length", 30, CVar.SERVER | CVar.REPLICATED);
+
/// <summary>
/// Adds a period at the end of a sentence if the sentence ends in a letter.
/// </summary>
private static readonly Regex RestrictedNameRegex = new(@"[^A-Za-z0-9 '\-]");
private static readonly Regex ICNameCaseRegex = new(@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)");
- public const int MaxNameLength = 32;
- public const int MaxLoadoutNameLength = 32;
- public const int MaxDescLength = 512;
-
/// <summary>
/// Job preferences for initial spawn.
/// </summary>
};
string name;
+ var maxNameLength = configManager.GetCVar(CCVars.MaxNameLength);
if (string.IsNullOrEmpty(Name))
{
name = GetName(Species, gender);
}
- else if (Name.Length > MaxNameLength)
+ else if (Name.Length > maxNameLength)
{
- name = Name[..MaxNameLength];
+ name = Name[..maxNameLength];
}
else
{
}
string flavortext;
- if (FlavorText.Length > MaxDescLength)
+ var maxFlavorTextLength = configManager.GetCVar(CCVars.MaxFlavorTextLength);
+ if (FlavorText.Length > maxFlavorTextLength)
{
- flavortext = FormattedMessage.RemoveMarkupOrThrow(FlavorText)[..MaxDescLength];
+ flavortext = FormattedMessage.RemoveMarkupOrThrow(FlavorText)[..maxFlavorTextLength];
}
else
{
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;
{
var groupRemove = new ValueList<string>();
var protoManager = collection.Resolve<IPrototypeManager>();
+ var configManager = collection.Resolve<IConfigurationManager>();
if (!protoManager.TryIndex(Role, out var roleProto))
{
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)
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
+using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.Lock;
using Content.Shared.Storage.Components;
using Content.Shared.Storage.EntitySystems;
using Content.Shared.Verbs;
+using Robust.Shared.Configuration;
using Robust.Shared.Timing;
namespace Content.Shared.Security.Systems;
public abstract class SharedGenpopSystem : EntitySystem
{
+ [Dependency] private readonly IConfigurationManager _cfgManager = default!;
[Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
[Dependency] private readonly SharedEntityStorageSystem _entityStorage = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedUserInterfaceSystem _userInterface = default!;
+ // CCvar.
+ private int _maxIdJobLength;
/// <inheritdoc/>
public override void Initialize()
SubscribeLocalEvent<GenpopLockerComponent, LockToggledEvent>(OnLockToggled);
SubscribeLocalEvent<GenpopLockerComponent, GetVerbsEvent<Verb>>(OnGetVerbs);
SubscribeLocalEvent<GenpopIdCardComponent, ExaminedEvent>(OnExamine);
+
+ Subs.CVar(_cfgManager, CCVars.MaxIdJobLength, value => _maxIdJobLength = value, true);
}
private void OnIdConfigured(Entity<GenpopLockerComponent> ent, ref GenpopLockerIdConfiguredMessage args)
{
// validation.
- if (string.IsNullOrWhiteSpace(args.Name) || args.Name.Length > IdCardConsoleComponent.MaxFullNameLength ||
+ if (string.IsNullOrWhiteSpace(args.Name) || args.Name.Length > _maxIdJobLength ||
args.Sentence < 0 ||
string.IsNullOrWhiteSpace(args.Crime) || args.Crime.Length > GenpopLockerComponent.MaxCrimeLength)
{