Use race specific identity age to build text (#19789)

* Use race specific identity age text

* Use variables

* Simplify
This commit is contained in:
Morb
2023-09-03 21:01:21 +03:00
committed by GitHub
parent fa0c5ff030
commit a268c890ed
2 changed files with 18 additions and 15 deletions

View File

@@ -1,14 +1,17 @@
using Content.Server.Access.Systems;
using Content.Server.Administration.Logs;
using Content.Server.Humanoid;
using Content.Shared.Database;
using Content.Shared.Hands;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.IdentityManagement;
using Content.Shared.IdentityManagement.Components;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects.Components.Localization;
using Robust.Shared.Prototypes;
namespace Content.Server.IdentityManagement;
@@ -20,6 +23,7 @@ public class IdentitySystem : SharedIdentitySystem
[Dependency] private readonly IdCardSystem _idCard = default!;
[Dependency] private readonly IAdminLogManager _adminLog = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!;
private HashSet<EntityUid> _queuedIdentityUpdates = new();
@@ -123,17 +127,20 @@ public class IdentitySystem : SharedIdentitySystem
{
int age = 18;
Gender gender = Gender.Epicene;
string species = SharedHumanoidAppearanceSystem.DefaultSpecies;
// Always use their actual age and gender, since that can't really be changed by an ID.
if (Resolve(target, ref appearance, false))
{
gender = appearance.Gender;
age = appearance.Age;
species = appearance.Species;
}
var ageString = _humanoid.GetAgeRepresentation(species, age);
var trueName = Name(target);
if (!Resolve(target, ref inventory, false))
return new(trueName, age, gender, string.Empty);
return new(trueName, gender, ageString, string.Empty);
string? presumedJob = null;
string? presumedName = null;
@@ -146,7 +153,7 @@ public class IdentitySystem : SharedIdentitySystem
}
// If it didn't find a job, that's fine.
return new(trueName, age, gender, presumedName, presumedJob);
return new(trueName, gender, ageString, presumedName, presumedJob);
}
#endregion