mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-25 01:27:06 +03:00
# Description Fixed species requirements, they can now be used for ORs. Improved trait/loadout requirement code, made the colors per-item instead of on the commas too. Removed group exclusion requirements in favor of the aforementioned.
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using Content.Shared.Preferences;
|
|
using Content.Shared.Roles;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Shared.Customization.Systems;
|
|
|
|
|
|
public sealed class CharacterRequirementsSystem : EntitySystem
|
|
{
|
|
public bool CheckRequirementsValid(IPrototype prototype, List<CharacterRequirement> requirements, JobPrototype job,
|
|
HumanoidCharacterProfile profile, Dictionary<string, TimeSpan> playTimes,
|
|
IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager,
|
|
out List<FormattedMessage> reasons)
|
|
{
|
|
reasons = new List<FormattedMessage>();
|
|
var valid = true;
|
|
|
|
foreach (var requirement in requirements)
|
|
{
|
|
// Set valid to false if the requirement is invalid and not inverted
|
|
// If it's inverted set valid to false when it's valid
|
|
if (!requirement.IsValid(prototype, job, profile, playTimes,
|
|
entityManager, prototypeManager, configManager,
|
|
out var reason))
|
|
{
|
|
if (valid)
|
|
valid = requirement.Inverted;
|
|
}
|
|
else
|
|
{
|
|
if (valid)
|
|
valid = !requirement.Inverted;
|
|
}
|
|
|
|
if (reason != null)
|
|
reasons.Add(reason);
|
|
}
|
|
|
|
return valid;
|
|
}
|
|
}
|