Files
wwdpublic/Content.Shared/Customization/Systems/CharacterRequirements.Whitelist.cs
SlamBamActionman 163ac8bc69 Lower in-round votekick requirements (#32953)
Initial commit

(cherry picked from commit b3190b89359ffe6e4e1d58e1c1ef69b8d7f70476)
2025-09-20 20:33:34 +03:00

42 lines
1.3 KiB
C#

using Content.Shared.CCVar;
using Content.Shared.Mind;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.Network;
namespace Content.Shared.Customization.Systems;
/// <summary>
/// Requires the player to be whitelisted if whitelists are enabled
/// </summary>
[UsedImplicitly]
[Serializable, NetSerializable]
public sealed partial class CharacterWhitelistRequirement : CharacterRequirement
{
public override bool IsValid(JobPrototype job,
HumanoidCharacterProfile profile,
IReadOnlyDictionary<string, TimeSpan> playTimes,
bool whitelisted,
IPrototype prototype,
IEntityManager entityManager,
IPrototypeManager prototypeManager,
IConfigurationManager configManager,
out string? reason,
int depth = 0,
MindComponent? mind = null)
{
reason = null;
if (!configManager.IsCVarRegistered("whitelist.enabled"))
return whitelisted;
reason = Loc.GetString("character-whitelist-requirement", ("inverted", Inverted));
return !configManager.GetCVar(CCVars.WhitelistEnabled) || whitelisted;
}
}