diff --git a/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs b/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs index 2cf03517eb..449cea6c5d 100644 --- a/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs +++ b/Content.Shared/CharacterAppearance/Systems/SharedHumanoidAppearanceSystem.cs @@ -1,19 +1,26 @@ using Content.Shared.Body.Part; +using Content.Shared.Examine; using Content.Shared.CharacterAppearance.Components; using Content.Shared.Preferences; +using Content.Shared.IdentityManagement; using Robust.Shared.Enums; using Robust.Shared.GameObjects.Components.Localization; using Robust.Shared.GameStates; using Robust.Shared.Serialization; +using Robust.Shared.Prototypes; +using Content.Shared.Species; namespace Content.Shared.CharacterAppearance.Systems { public abstract class SharedHumanoidAppearanceSystem : EntitySystem { + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + public override void Initialize() { SubscribeLocalEvent(OnAppearanceGetState); SubscribeLocalEvent(OnAppearanceHandleState); + SubscribeLocalEvent(OnExamined); } public void UpdateFromProfile(EntityUid uid, ICharacterProfile profile, HumanoidAppearanceComponent? appearance=null) @@ -69,6 +76,31 @@ namespace Content.Shared.CharacterAppearance.Systems RaiseLocalEvent(uid, new ChangedHumanoidAppearanceEvent(component.Appearance, component.Sex, component.Gender, component.Species), true); } + /// + /// Takes ID of the species prototype, returns UI-friendly name of the species. + /// + public string GetSpeciesRepresentation(string speciesId) + { + if (_prototypeManager.TryIndex(speciesId, out var species)) + { + return Loc.GetString(species.Name); + } + else + { + return Loc.GetString("humanoid-appearance-component-unknown-species"); + } + } + + public string GetAgeRepresentation(int age) + { + return age switch + { + <= 30 => Loc.GetString("identity-age-young"), + > 30 and <= 60 => Loc.GetString("identity-age-middle-aged"), + > 60 => Loc.GetString("identity-age-old") + }; + } + private void OnAppearanceGetState(EntityUid uid, HumanoidAppearanceComponent component, ref ComponentGetState args) { args.State = new HumanoidAppearanceComponentState(component.Appearance, component.Sex, component.Gender, component.Species, component.Age); @@ -144,5 +176,14 @@ namespace Content.Shared.CharacterAppearance.Systems Species = species; } } + + private void OnExamined(EntityUid uid, HumanoidAppearanceComponent component, ExaminedEvent args) + { + var identity = Identity.Entity(component.Owner, EntityManager); + var species = GetSpeciesRepresentation(component.Species).ToLower(); + var age = GetAgeRepresentation(component.Age); + + args.PushText(Loc.GetString("humanoid-appearance-component-examine", ("user", identity), ("age", age), ("species", species))); + } } } diff --git a/Resources/Locale/en-US/character-appearance/components/humanoid-appearance-component.ftl b/Resources/Locale/en-US/character-appearance/components/humanoid-appearance-component.ftl new file mode 100644 index 0000000000..a4a8634c64 --- /dev/null +++ b/Resources/Locale/en-US/character-appearance/components/humanoid-appearance-component.ftl @@ -0,0 +1,2 @@ +humanoid-appearance-component-unknown-species = Person +humanoid-appearance-component-examine = { CAPITALIZE(SUBJECT($user)) } { CONJUGATE-BE($user) } { INDEFINITE($age) } { $age } { $species }. diff --git a/Resources/Prototypes/Entities/Mobs/Player/human.yml b/Resources/Prototypes/Entities/Mobs/Player/human.yml index 3cf73c5df5..a09afbbdc9 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/human.yml @@ -3,7 +3,6 @@ name: Urist McHands parent: BaseMobHuman id: MobHuman - description: A miserable pile of secrets. components: - type: CombatMode canDisarm: true diff --git a/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml b/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml index 99b07edbba..dc4c827a84 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/reptilian.yml @@ -3,7 +3,6 @@ name: Urisst' Mzhand parent: BaseMobReptilian id: MobReptilian - description: A miserable pile of scales. components: - type: CombatMode canDisarm: true diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 862d8dfa98..71ebd0b29e 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -3,7 +3,6 @@ save: false name: Urist McHands id: BaseMobOrganic - description: A miserable pile of secrets. noSpawn: true components: - type: RangedDamageSound diff --git a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml index f1c47c1a3f..497381f912 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml @@ -4,7 +4,6 @@ parent: BaseMobOrganic id: BaseMobDwarf abstract: true - description: A miserable pile of secrets. components: - type: Hunger - type: Thirst diff --git a/Resources/Prototypes/Entities/Mobs/Species/human.yml b/Resources/Prototypes/Entities/Mobs/Species/human.yml index cd8edb4f8f..1b438f63dc 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/human.yml @@ -4,7 +4,6 @@ parent: BaseMobOrganic id: BaseMobHuman abstract: true - description: A miserable pile of secrets. components: - type: Hunger - type: Thirst diff --git a/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml b/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml index 0d55184ad9..bd23c071f4 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/reptilian.yml @@ -4,7 +4,6 @@ parent: BaseMobOrganic id: BaseMobReptilian abstract: true - description: A miserable pile of scales. components: - type: Hunger - type: Thirst diff --git a/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml b/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml index 02c5c0f3b4..b468491362 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml @@ -4,7 +4,6 @@ parent: BaseMobOrganic id: BaseMobSkeletonPerson abstract: true - description: A miserable pile of bones. components: - type: Markings - type: Icon diff --git a/Resources/Prototypes/Entities/Mobs/Species/slime.yml b/Resources/Prototypes/Entities/Mobs/Species/slime.yml index b9c7455710..6ed40cce94 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/slime.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/slime.yml @@ -3,7 +3,6 @@ parent: BaseMobOrganic id: BaseMobSlimePerson abstract: true - description: A miserable pile of slime. components: - type: Hunger - type: Thirst