Use 'new' expression in places where the type is evident for content (#2590)

* Content.Client

* Content.Benchmarks

* Content.IntegrationTests

* Content.Server

* Content.Server.Database

* Content.Shared

* Content.Tests

* Merge fixes

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2020-11-27 11:00:49 +01:00
committed by GitHub
parent 4a56df749b
commit 5c0cf1b1a0
235 changed files with 431 additions and 433 deletions

View File

@@ -11,7 +11,7 @@ namespace Content.Shared.Preferences.Appearance
public const string DefaultHairStyle = "Bald";
public const string DefaultFacialHairStyle = "Shaved";
public static readonly Dictionary<string, string> HairStylesMap = new Dictionary<string, string>
public static readonly Dictionary<string, string> HairStylesMap = new()
{
{"Afro", "afro"},
{"Afro 2", "afro2"},
@@ -190,7 +190,7 @@ namespace Content.Shared.Preferences.Appearance
{"Wisp", "wisp"},
};
public static readonly Dictionary<string, string> FacialHairStylesMap = new Dictionary<string, string>()
public static readonly Dictionary<string, string> FacialHairStylesMap = new()
{
{"Beard (Abraham Lincoln)", "abe"},
{"Beard (Broken Man)", "brokenman"},

View File

@@ -36,38 +36,37 @@ namespace Content.Shared.Preferences
public HumanoidCharacterAppearance WithHairStyleName(string newName)
{
return new HumanoidCharacterAppearance(newName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
return new(newName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithHairColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, newColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
return new(HairStyleName, newColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithFacialHairStyleName(string newName)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, newName, FacialHairColor, EyeColor, SkinColor);
return new(HairStyleName, HairColor, newName, FacialHairColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithFacialHairColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, newColor, EyeColor, SkinColor);
return new(HairStyleName, HairColor, FacialHairStyleName, newColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithEyeColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, newColor, SkinColor);
return new(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, newColor, SkinColor);
}
public HumanoidCharacterAppearance WithSkinColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, newColor);
return new(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, newColor);
}
public static HumanoidCharacterAppearance Default()
{
return new HumanoidCharacterAppearance
(
return new(
"Bald",
Color.Black,
"Shaved",
@@ -104,7 +103,7 @@ namespace Content.Shared.Preferences
public static Color ClampColor(Color color)
{
return new Color(color.RByte, color.GByte, color.BByte);
return new(color.RByte, color.GByte, color.BByte);
}
public static HumanoidCharacterAppearance EnsureValid(HumanoidCharacterAppearance appearance)

View File

@@ -88,27 +88,27 @@ namespace Content.Shared.Preferences
public HumanoidCharacterProfile WithName(string name)
{
return new HumanoidCharacterProfile(name, Age, Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
return new(name, Age, Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
}
public HumanoidCharacterProfile WithAge(int age)
{
return new HumanoidCharacterProfile(Name, Math.Clamp(age, MinimumAge, MaximumAge), Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
return new(Name, Math.Clamp(age, MinimumAge, MaximumAge), Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
}
public HumanoidCharacterProfile WithSex(Sex sex)
{
return new HumanoidCharacterProfile(Name, Age, sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
return new(Name, Age, sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
}
public HumanoidCharacterProfile WithCharacterAppearance(HumanoidCharacterAppearance appearance)
{
return new HumanoidCharacterProfile(Name, Age, Sex, appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
return new(Name, Age, Sex, appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
}
public HumanoidCharacterProfile WithJobPriorities(IReadOnlyDictionary<string, JobPriority> jobPriorities)
{
return new HumanoidCharacterProfile(
return new(
Name,
Age,
Sex,
@@ -135,12 +135,12 @@ namespace Content.Shared.Preferences
public HumanoidCharacterProfile WithPreferenceUnavailable(PreferenceUnavailableMode mode)
{
return new HumanoidCharacterProfile(Name, Age, Sex, Appearance, _jobPriorities, mode, _antagPreferences);
return new(Name, Age, Sex, Appearance, _jobPriorities, mode, _antagPreferences);
}
public HumanoidCharacterProfile WithAntagPreferences(IReadOnlyList<string> antagPreferences)
{
return new HumanoidCharacterProfile(
return new(
Name,
Age,
Sex,