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:
@@ -4,6 +4,7 @@ using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Body.Part
|
||||
{
|
||||
//TODO: This should be a prototype. --DrSmugleaf
|
||||
/// <summary>
|
||||
/// Determines whether two <see cref="SharedBodyPartComponent"/>s can connect.
|
||||
/// </summary>
|
||||
@@ -12,6 +13,7 @@ namespace Content.Shared.Body.Part
|
||||
{
|
||||
Universal = 0,
|
||||
Biological,
|
||||
Mechanical
|
||||
Mechanical,
|
||||
Slime
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ namespace Content.Shared.CharacterAppearance.Components
|
||||
[ViewVariables]
|
||||
[DataField("canColorFacialHair")]
|
||||
public bool CanColorFacialHair { get; set; } = true;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("hairMatchesSkin")]
|
||||
public bool HairMatchesSkin { get; set; } = false;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("hairAlpha")]
|
||||
public float HairAlpha { get; set; } = 1.0f;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -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,
|
||||
|
||||
6
Content.Shared/Species/SpeciesManager.cs
Normal file
6
Content.Shared/Species/SpeciesManager.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Content.Shared.Species;
|
||||
|
||||
public class SpeciesManager
|
||||
{
|
||||
public const string DefaultSpecies = "Human";
|
||||
}
|
||||
53
Content.Shared/Species/SpeciesPrototype.cs
Normal file
53
Content.Shared/Species/SpeciesPrototype.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Species;
|
||||
|
||||
[Prototype("species")]
|
||||
public class SpeciesPrototype : IPrototype
|
||||
{
|
||||
/// <summary>
|
||||
/// Prototype ID of the species.
|
||||
/// </summary>
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// User visible name of the species.
|
||||
/// </summary>
|
||||
[DataField("name", required: true)]
|
||||
public string Name { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the species is available "at round start" (In the character editor)
|
||||
/// </summary>
|
||||
[DataField("roundStart", required: true)]
|
||||
public bool RoundStart { get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Prototype used by the species as a body.
|
||||
/// </summary>
|
||||
[DataField("prototype", required: true)]
|
||||
public string Prototype { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Prototype used by the species for the dress-up doll in various menus.
|
||||
/// </summary>
|
||||
[DataField("dollPrototype", required: true)]
|
||||
public string DollPrototype { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Method of skin coloration used by the species.
|
||||
/// </summary>
|
||||
[DataField("skinColoration", required: true)]
|
||||
public SpeciesSkinColor SkinColoration { get; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public enum SpeciesSkinColor
|
||||
{
|
||||
HumanToned,
|
||||
Hues,
|
||||
}
|
||||
Reference in New Issue
Block a user