diff --git a/Content.Shared/CharacterAppearance/Components/HumanoidAppearanceComponent.cs b/Content.Shared/CharacterAppearance/Components/HumanoidAppearanceComponent.cs index 4d86f9ec2a..6dff0b2de5 100644 --- a/Content.Shared/CharacterAppearance/Components/HumanoidAppearanceComponent.cs +++ b/Content.Shared/CharacterAppearance/Components/HumanoidAppearanceComponent.cs @@ -1,6 +1,7 @@ using System; using Content.Shared.CharacterAppearance; using Content.Shared.CharacterAppearance.Systems; +using Content.Shared.Species; using Robust.Shared.Analyzers; using Robust.Shared.Enums; using Robust.Shared.GameObjects; @@ -25,6 +26,9 @@ namespace Content.Shared.CharacterAppearance.Components [ViewVariables(VVAccess.ReadWrite)] public Gender Gender { get; set; } = default!; + [ViewVariables] + public string Species { get; set; } = SpeciesManager.DefaultSpecies; + [DataField("categoriesHair")] [ViewVariables] public SpriteAccessoryCategories CategoriesHair { get; set; } = SpriteAccessoryCategories.HumanHair; @@ -56,14 +60,17 @@ namespace Content.Shared.CharacterAppearance.Components public HumanoidCharacterAppearance Appearance { get; } public Sex Sex { get; } public Gender Gender { get; } + public string Species { get; } public HumanoidAppearanceComponentState(HumanoidCharacterAppearance appearance, Sex sex, - Gender gender) + Gender gender, + string species) { Appearance = appearance; Sex = sex; Gender = gender; + Species = species; } } } diff --git a/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs b/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs index ee4229ffc5..45b98ffde5 100644 --- a/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs +++ b/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs @@ -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; } } }