Adds species to HumanoidAppearanceComponent (#7445)
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Content.Shared.CharacterAppearance.Systems
|
||||
public void UpdateFromProfile(EntityUid uid, ICharacterProfile profile)
|
||||
{
|
||||
var humanoid = (HumanoidCharacterProfile) profile;
|
||||
UpdateAppearance(uid, humanoid.Appearance, humanoid.Sex, humanoid.Gender);
|
||||
UpdateAppearance(uid, humanoid.Appearance, humanoid.Sex, humanoid.Gender, humanoid.Species);
|
||||
}
|
||||
|
||||
// The magic mirror otherwise wouldn't work. (it directly modifies the component server-side)
|
||||
@@ -31,25 +31,26 @@ namespace Content.Shared.CharacterAppearance.Systems
|
||||
component.Dirty();
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, HumanoidCharacterAppearance appearance, Sex sex, Gender gender, HumanoidAppearanceComponent? component = null)
|
||||
private void UpdateAppearance(EntityUid uid, HumanoidCharacterAppearance appearance, Sex sex, Gender gender, string species, HumanoidAppearanceComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component)) return;
|
||||
|
||||
component.Appearance = appearance;
|
||||
component.Sex = sex;
|
||||
component.Gender = gender;
|
||||
component.Species = species;
|
||||
|
||||
if (EntityManager.TryGetComponent(uid, out GrammarComponent? g))
|
||||
g.Gender = gender;
|
||||
|
||||
component.Dirty();
|
||||
|
||||
RaiseLocalEvent(uid, new ChangedHumanoidAppearanceEvent(appearance, sex, gender));
|
||||
RaiseLocalEvent(uid, new ChangedHumanoidAppearanceEvent(appearance, sex, gender, species));
|
||||
}
|
||||
|
||||
private void OnAppearanceGetState(EntityUid uid, HumanoidAppearanceComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new HumanoidAppearanceComponentState(component.Appearance, component.Sex, component.Gender);
|
||||
args.State = new HumanoidAppearanceComponentState(component.Appearance, component.Sex, component.Gender, component.Species);
|
||||
}
|
||||
|
||||
private void OnAppearanceHandleState(EntityUid uid, HumanoidAppearanceComponent component, ref ComponentHandleState args)
|
||||
@@ -57,7 +58,7 @@ namespace Content.Shared.CharacterAppearance.Systems
|
||||
if (args.Current is not HumanoidAppearanceComponentState state)
|
||||
return;
|
||||
|
||||
UpdateAppearance(uid, state.Appearance, state.Sex, state.Gender);
|
||||
UpdateAppearance(uid, state.Appearance, state.Sex, state.Gender, state.Species);
|
||||
}
|
||||
|
||||
// Scaffolding until Body is moved to ECS.
|
||||
@@ -105,19 +106,22 @@ namespace Content.Shared.CharacterAppearance.Systems
|
||||
public HumanoidCharacterAppearance Appearance { get; }
|
||||
public Sex Sex { get; }
|
||||
public Gender Gender { get; }
|
||||
public string Species { get; }
|
||||
|
||||
public ChangedHumanoidAppearanceEvent(HumanoidCharacterProfile profile)
|
||||
{
|
||||
Appearance = profile.Appearance;
|
||||
Sex = profile.Sex;
|
||||
Gender = profile.Gender;
|
||||
Species = profile.Species;
|
||||
}
|
||||
|
||||
public ChangedHumanoidAppearanceEvent(HumanoidCharacterAppearance appearance, Sex sex, Gender gender)
|
||||
public ChangedHumanoidAppearanceEvent(HumanoidCharacterAppearance appearance, Sex sex, Gender gender, string species)
|
||||
{
|
||||
Appearance = appearance;
|
||||
Sex = sex;
|
||||
Gender = gender;
|
||||
Species = species;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user