Files
tbd-station-14/Content.Shared/Preferences/Loadouts/Effects/SpeciesLoadoutEffect.cs
metalgearsloth 8f12e90b90 Don't use invalid defaults for loadouts (#28740)
* Don't use invalid defaults for loadouts

At the time it made more sense but now with species specific stuff it's better to have nothing.

* Loadout SetDefault only applies valid loadouts
2024-06-15 16:53:42 +10:00

27 lines
853 B
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();
public override bool Validate(HumanoidCharacterProfile profile, RoleLoadout loadout, ICommonSession? session, IDependencyCollection collection,
[NotNullWhen(false)] out FormattedMessage? reason)
{
if (Species.Contains(profile.Species))
{
reason = null;
return true;
}
reason = FormattedMessage.FromUnformatted(Loc.GetString("loadout-group-species-restriction"));
return false;
}
}