Restricts character age from being under 18 or over 120 years old (#1836)

This commit is contained in:
Swept
2020-08-21 09:26:31 -07:00
committed by GitHub
parent fd81e05d5b
commit 7887f78f0d

View File

@@ -11,7 +11,7 @@ namespace Content.Shared.Preferences
private readonly Dictionary<string, JobPriority> _jobPriorities;
private readonly List<string> _antagPreferences;
public static int MinimumAge = 18;
public static int MaximumAge = 90;
public static int MaximumAge = 120;
private HumanoidCharacterProfile(
string name,
@@ -69,7 +69,7 @@ namespace Content.Shared.Preferences
public HumanoidCharacterProfile WithAge(int age)
{
return new HumanoidCharacterProfile(Name, age, Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
return new HumanoidCharacterProfile(Name, Math.Clamp(age, MinimumAge, MaximumAge), Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
}
public HumanoidCharacterProfile WithSex(Sex sex)