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

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

41 lines
1.2 KiB
C#

using System.Linq;
using Content.Shared.Implants.Components;
using Content.Shared.Mind;
using Content.Shared.Mindshield.Components;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Customization.Systems;
/// <summary>
/// Requires the player to have a mindshield
/// </summary>
[UsedImplicitly]
[Serializable, NetSerializable]
public sealed partial class CharacterMindshieldRequirement : 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 = Loc.GetString("character-mindshield-requirement", ("inverted", Inverted));
if (mind == null)
return false;
return entityManager.HasComponent<MindShieldComponent>(mind.CurrentEntity) != Inverted;
}
}