- fix: Show true name in station records. (#34)

This commit is contained in:
Aviu00
2024-02-08 18:44:19 +09:00
committed by GitHub
parent 74941f06bb
commit 9c91a9c3c3
5 changed files with 21 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ using Content.Server.Humanoid;
using Content.Server.IdentityManagement;
using Content.Server.PDA;
using Content.Server.Roles;
using Content.Server.StationRecords.Systems;
using Content.Shared.Access.Components;
using Content.Shared.Humanoid;
using Content.Shared.Inventory;
@@ -10,6 +11,7 @@ using Content.Shared.Mind.Components;
using Content.Shared.NukeOps;
using Content.Shared.PDA;
using Content.Shared.Preferences;
using Content.Shared.StationRecords;
namespace Content.Server._White.Other.RandomHumanSystem;
@@ -21,7 +23,7 @@ public sealed class RandomHumanSystem : EntitySystem
[Dependency] private readonly IdCardSystem _card = default!;
[Dependency] private readonly PdaSystem _pda = default!;
[Dependency] private readonly IdentitySystem _identity = default!;
[Dependency] private readonly RoleSystem _roles = default!;
[Dependency] private readonly StationRecordsSystem _records = default!;
public override void Initialize()
{
@@ -58,6 +60,21 @@ public sealed class RandomHumanSystem : EntitySystem
_card.TryChangeFullName(cardId, newProfile.Name, card);
_pda.SetOwner(idUid.Value, pdaComponent, newProfile.Name);
if (EntityManager.TryGetComponent(cardId, out StationRecordKeyStorageComponent? keyStorage)
&& keyStorage.Key is { } key)
{
if (_records.TryGetRecord<GeneralStationRecord>(key, out var generalRecord))
{
generalRecord.Name = newProfile.Name;
generalRecord.Age = newProfile.Age;
generalRecord.Gender = newProfile.Gender;
generalRecord.Species = newProfile.Species;
generalRecord.Profile = newProfile;
}
_records.Synchronize(key);
}
_identity.QueueIdentityUpdate(uid);
}
}