From 672b5940ec933defc769c414e4f043537a8208e4 Mon Sep 17 00:00:00 2001 From: dffdff2423 Date: Wed, 31 Jul 2024 17:36:50 -0500 Subject: [PATCH] Make character name reset upon resetting records. (#338) --- Content.Server/Mind/Commands/RenameCommand.cs | 10 ++++++++++ Content.Server/_CD/Records/CharacterRecordsSystem.cs | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Content.Server/Mind/Commands/RenameCommand.cs b/Content.Server/Mind/Commands/RenameCommand.cs index 834453fb19..6653fc1474 100644 --- a/Content.Server/Mind/Commands/RenameCommand.cs +++ b/Content.Server/Mind/Commands/RenameCommand.cs @@ -13,6 +13,9 @@ using Robust.Shared.Console; using Robust.Shared.Player; +// CD: imports +using Content.Server._CD.Records; + namespace Content.Server.Mind.Commands; [AdminCommand(AdminFlags.VarEdit)] @@ -99,6 +102,13 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) { adminSystem.UpdatePlayerList(actorComp.PlayerSession); } + + // CD: records + if (_entManager.TrySystem(out var cdRecordsSys) + && _entManager.TryGetComponent(entityUid, out var cdCRecords)) + { + cdRecordsSys.QueryRecords(cdCRecords.Key.Station)[cdCRecords.Key.Index].Name = name; + } } private bool TryParseUid(string str, IConsoleShell shell, diff --git a/Content.Server/_CD/Records/CharacterRecordsSystem.cs b/Content.Server/_CD/Records/CharacterRecordsSystem.cs index 2325bfa7d6..366ca174fd 100644 --- a/Content.Server/_CD/Records/CharacterRecordsSystem.cs +++ b/Content.Server/_CD/Records/CharacterRecordsSystem.cs @@ -169,6 +169,8 @@ public void ResetRecord( return; var records = PlayerProvidedCharacterRecords.DefaultRecords(); + if (TryComp(player, out MetaDataComponent? meta)) + recordsDb.Records[key.Key.Index].Name = meta.EntityName; recordsDb.Records[key.Key.Index].PRecords = records; RaiseLocalEvent(station, new CharacterRecordsModifiedEvent()); }