Restricts character age from being under 18 or over 120 years old (#1836)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user