From 33c14562236ff00bd4ca7af722675064e565e63e Mon Sep 17 00:00:00 2001 From: Flipp Syder <76629141+vulppine@users.noreply.github.com> Date: Sat, 15 Oct 2022 14:48:22 -0700 Subject: [PATCH] Adds station record renaming to the rename command (#11759) --- Content.Server/Mind/Commands/RenameCommand.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Content.Server/Mind/Commands/RenameCommand.cs b/Content.Server/Mind/Commands/RenameCommand.cs index b256e1bda8..2986f578e1 100644 --- a/Content.Server/Mind/Commands/RenameCommand.cs +++ b/Content.Server/Mind/Commands/RenameCommand.cs @@ -4,9 +4,11 @@ using Content.Server.Administration.Systems; using Content.Server.Cloning; using Content.Server.Mind.Components; using Content.Server.PDA; +using Content.Server.StationRecords; using Content.Shared.Access.Components; using Content.Shared.Administration; using Content.Shared.PDA; +using Content.Shared.StationRecords; using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Console; @@ -57,7 +59,25 @@ public sealed class RenameCommand : IConsoleCommand if (entSysMan.TryGetEntitySystem(out var idCardSystem)) { if (idCardSystem.TryFindIdCard(entityUid, out var idCard)) + { idCardSystem.TryChangeFullName(idCard.Owner, name, idCard); + + // Records + // This is done here because ID cards are linked to station records + if (entSysMan.TryGetEntitySystem(out var recordsSystem) + && entMan.TryGetComponent(idCard.Owner, out StationRecordKeyStorageComponent? keyStorage) + && keyStorage.Key != null) + { + if (recordsSystem.TryGetRecord(keyStorage.Key.Value.OriginStation, + keyStorage.Key.Value, + out var generalRecord)) + { + generalRecord.Name = name; + } + + recordsSystem.Synchronize(keyStorage.Key.Value.OriginStation); + } + } } // PDAs