* added Character Setup * whoops * reverted unrelated changes * Made everything work post-rebase * Removed unused PreferencesChanged event * nope, don't need this * HumanoidProfileEditorPanel -> HumanoidProfileEditor * Set initial data for hair pickers * Fixed nullable warning * Renamed LooksComponent -> HumanoidAppearanceComponent * Renamed LooksComponentState -> HumanoidAppearanceComponentState * Final renaming maybe * Use a human-like dummy instead of a real human * Change preferences structs back to classes
63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
using System;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Preferences
|
|
{
|
|
[Serializable, NetSerializable]
|
|
public class HumanoidCharacterProfile : ICharacterProfile
|
|
{
|
|
public HumanoidCharacterProfile(string name,
|
|
int age,
|
|
Sex sex,
|
|
HumanoidCharacterAppearance appearance)
|
|
{
|
|
Name = name;
|
|
Age = age;
|
|
Sex = sex;
|
|
Appearance = appearance;
|
|
}
|
|
|
|
public static HumanoidCharacterProfile Default()
|
|
{
|
|
return new HumanoidCharacterProfile("John Doe", 18, Sex.Male, HumanoidCharacterAppearance.Default());
|
|
}
|
|
|
|
public string Name { get; }
|
|
public int Age { get; }
|
|
public Sex Sex { get; }
|
|
public ICharacterAppearance CharacterAppearance => Appearance;
|
|
public HumanoidCharacterAppearance Appearance { get; }
|
|
|
|
public HumanoidCharacterProfile WithName(string name)
|
|
{
|
|
return new HumanoidCharacterProfile(name, Age, Sex, Appearance);
|
|
}
|
|
|
|
public HumanoidCharacterProfile WithAge(int age)
|
|
{
|
|
return new HumanoidCharacterProfile(Name, age, Sex, Appearance);
|
|
}
|
|
|
|
public HumanoidCharacterProfile WithSex(Sex sex)
|
|
{
|
|
return new HumanoidCharacterProfile(Name, Age, sex, Appearance);
|
|
}
|
|
|
|
public HumanoidCharacterProfile WithCharacterAppearance(HumanoidCharacterAppearance appearance)
|
|
{
|
|
return new HumanoidCharacterProfile(Name, Age, Sex, appearance);
|
|
}
|
|
|
|
public string Summary => $"{Name}, {Age} years old {Sex.ToString().ToLower()} human.\nOccupation: to be implemented.";
|
|
|
|
public bool MemberwiseEquals(ICharacterProfile maybeOther)
|
|
{
|
|
if (!(maybeOther is HumanoidCharacterProfile other)) return false;
|
|
if (Name != other.Name) return false;
|
|
if (Age != other.Age) return false;
|
|
if (Sex != other.Sex) return false;
|
|
return Appearance.MemberwiseEquals(other.Appearance);
|
|
}
|
|
}
|
|
}
|