6
2026-01-24 12:49:55 +03:00

30 lines
1.0 KiB
C#

using System.Diagnostics.CodeAnalysis;
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared.Preferences.Loadouts.Effects;
public sealed partial class SpeciesLoadoutEffect : LoadoutEffect
{
[DataField(required: true)]
public List<ProtoId<SpeciesPrototype>> Species = new();
[DataField] // Frontier
public bool Inverted; // Frontier: if true, list is a blacklist, not a whitelist
public override bool Validate(HumanoidCharacterProfile profile, RoleLoadout loadout, ICommonSession? session, IDependencyCollection collection,
[NotNullWhen(false)] out FormattedMessage? reason)
{
if (Species.Contains(profile.Species) != Inverted) // Frontier: add != Inverted (when true, blacklist)
{
reason = null;
return true;
}
reason = FormattedMessage.FromUnformatted(Loc.GetString("loadout-group-species-restriction"));
return false;
}
}