diff --git a/Content.Shared/Customization/Systems/CharacterRequirements.Logic.cs b/Content.Shared/Customization/Systems/CharacterRequirements.Logic.cs index 1cd3618fda..397e74bc8b 100644 --- a/Content.Shared/Customization/Systems/CharacterRequirements.Logic.cs +++ b/Content.Shared/Customization/Systems/CharacterRequirements.Logic.cs @@ -63,10 +63,12 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, { var succeeded = false; var reasons = new List(); + var characterRequirements = entityManager.EntitySysManager.GetEntitySystem(); + foreach (var requirement in Requirements) { - if (requirement.IsValid(job, profile, playTimes, whitelisted, prototype, entityManager, prototypeManager, - configManager, out var raisin, depth + 1)) + if (characterRequirements.CheckRequirementValid(requirement, job, profile, playTimes, whitelisted, prototype, + entityManager, prototypeManager, configManager, out var raisin, depth + 1)) { succeeded = true; break; @@ -110,11 +112,12 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile, { var reasons = new List(); var succeeded = false; + var characterRequirements = entityManager.EntitySysManager.GetEntitySystem(); foreach (var requirement in Requirements) { - if (requirement.IsValid(job, profile, playTimes, whitelisted, prototype, entityManager, prototypeManager, - configManager, out var raisin, depth + 1)) + if (characterRequirements.CheckRequirementValid(requirement, job, profile, playTimes, whitelisted, prototype, + entityManager, prototypeManager, configManager, out var raisin, depth + 1)) { if (succeeded) { diff --git a/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs b/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs index 74c2c26cf8..9becb640d1 100644 --- a/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs +++ b/Content.Shared/Customization/Systems/CharacterRequirementsSystem.cs @@ -15,6 +15,21 @@ public sealed class CharacterRequirementsSystem : EntitySystem [Dependency] private readonly InventorySystem _inventory = default!; + public bool CheckRequirementValid(CharacterRequirement requirement, JobPrototype job, + HumanoidCharacterProfile profile, Dictionary playTimes, bool whitelisted, IPrototype prototype, + IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager, + out FormattedMessage? reason, int depth = 0) + { + // Return false if the requirement is invalid and not inverted + // If it's inverted return false when it's valid + return + !requirement.IsValid(job, profile, playTimes, whitelisted, prototype, + entityManager, prototypeManager, configManager, + out reason, depth) + ? requirement.Inverted + : !requirement.Inverted; + } + public bool CheckRequirementsValid(List requirements, JobPrototype job, HumanoidCharacterProfile profile, Dictionary playTimes, bool whitelisted, IPrototype prototype, IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager,