Upstream species (#6066)
* Step 1 of porting; grabbed most of the files via patches. * Add species field to the DB * Appearance patches for slimes. * Fix the db test. * Add slime's biocompat. * slimby * Fixes, allow specifying if a species is playable or not. * Update Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com> * Update Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com> * Update Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com> * Address reviews. * Address reviews. * make an if-case. * Fix a goof where species wouldn't get shown in the editor correctly (it'd always default to human) Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ using Content.Shared.Dataset;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Species;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -33,6 +34,7 @@ namespace Content.Shared.Preferences
|
||||
|
||||
private HumanoidCharacterProfile(
|
||||
string name,
|
||||
string species,
|
||||
int age,
|
||||
Sex sex,
|
||||
Gender gender,
|
||||
@@ -44,6 +46,7 @@ namespace Content.Shared.Preferences
|
||||
List<string> antagPreferences)
|
||||
{
|
||||
Name = name;
|
||||
Species = species;
|
||||
Age = age;
|
||||
Sex = sex;
|
||||
Gender = gender;
|
||||
@@ -60,7 +63,7 @@ namespace Content.Shared.Preferences
|
||||
HumanoidCharacterProfile other,
|
||||
Dictionary<string, JobPriority> jobPriorities,
|
||||
List<string> antagPreferences)
|
||||
: this(other.Name, other.Age, other.Sex, other.Gender, other.Appearance, other.Clothing, other.Backpack,
|
||||
: this(other.Name, other.Species, other.Age, other.Sex, other.Gender, other.Appearance, other.Clothing, other.Backpack,
|
||||
jobPriorities, other.PreferenceUnavailable, antagPreferences)
|
||||
{
|
||||
}
|
||||
@@ -73,6 +76,7 @@ namespace Content.Shared.Preferences
|
||||
|
||||
public HumanoidCharacterProfile(
|
||||
string name,
|
||||
string species,
|
||||
int age,
|
||||
Sex sex,
|
||||
Gender gender,
|
||||
@@ -82,7 +86,7 @@ namespace Content.Shared.Preferences
|
||||
IReadOnlyDictionary<string, JobPriority> jobPriorities,
|
||||
PreferenceUnavailableMode preferenceUnavailable,
|
||||
IReadOnlyList<string> antagPreferences)
|
||||
: this(name, age, sex, gender, appearance, clothing, backpack, new Dictionary<string, JobPriority>(jobPriorities),
|
||||
: this(name, species, age, sex, gender, appearance, clothing, backpack, new Dictionary<string, JobPriority>(jobPriorities),
|
||||
preferenceUnavailable, new List<string>(antagPreferences))
|
||||
{
|
||||
}
|
||||
@@ -91,6 +95,7 @@ namespace Content.Shared.Preferences
|
||||
{
|
||||
return new(
|
||||
"John Doe",
|
||||
SpeciesManager.DefaultSpecies,
|
||||
MinimumAge,
|
||||
Sex.Male,
|
||||
Gender.Male,
|
||||
@@ -108,6 +113,9 @@ namespace Content.Shared.Preferences
|
||||
public static HumanoidCharacterProfile Random()
|
||||
{
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
|
||||
var species = random.Pick(IoCManager.Resolve<IPrototypeManager>()
|
||||
.EnumeratePrototypes<SpeciesPrototype>().Where(x => x.RoundStart).ToArray()).ID;
|
||||
var sex = random.Prob(0.5f) ? Sex.Male : Sex.Female;
|
||||
var gender = sex == Sex.Male ? Gender.Male : Gender.Female;
|
||||
|
||||
@@ -117,7 +125,7 @@ namespace Content.Shared.Preferences
|
||||
var name = $"{firstName} {lastName}";
|
||||
var age = random.Next(MinimumAge, MaximumAge);
|
||||
|
||||
return new HumanoidCharacterProfile(name, age, sex, gender, HumanoidCharacterAppearance.Random(sex), ClothingPreference.Jumpsuit, BackpackPreference.Backpack,
|
||||
return new HumanoidCharacterProfile(name, species, age, sex, gender, HumanoidCharacterAppearance.Random(sex), ClothingPreference.Jumpsuit, BackpackPreference.Backpack,
|
||||
new Dictionary<string, JobPriority>
|
||||
{
|
||||
{SharedGameTicker.FallbackOverflowJob, JobPriority.High}
|
||||
@@ -125,6 +133,7 @@ namespace Content.Shared.Preferences
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public string Species { get; private set; }
|
||||
public int Age { get; private set; }
|
||||
public Sex Sex { get; private set; }
|
||||
public Gender Gender { get; private set; }
|
||||
@@ -156,6 +165,12 @@ namespace Content.Shared.Preferences
|
||||
return new(this) { Gender = gender };
|
||||
}
|
||||
|
||||
public HumanoidCharacterProfile WithSpecies(string species)
|
||||
{
|
||||
return new(this) { Species = species };
|
||||
}
|
||||
|
||||
|
||||
public HumanoidCharacterProfile WithCharacterAppearance(HumanoidCharacterAppearance appearance)
|
||||
{
|
||||
return new(this) { Appearance = appearance };
|
||||
@@ -367,6 +382,7 @@ namespace Content.Shared.Preferences
|
||||
return HashCode.Combine(
|
||||
HashCode.Combine(
|
||||
Name,
|
||||
Species,
|
||||
Age,
|
||||
Sex,
|
||||
Gender,
|
||||
|
||||
Reference in New Issue
Block a user