Skip to content

Commit

Permalink
Make character name reset upon resetting records. (cosmatic-drift-14#338
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dffdff2423 committed Jul 31, 2024
1 parent 43910aa commit 672b594
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Content.Server/Mind/Commands/RenameCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -99,6 +102,13 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
adminSystem.UpdatePlayerList(actorComp.PlayerSession);
}

// CD: records
if (_entManager.TrySystem<CharacterRecordsSystem>(out var cdRecordsSys)
&& _entManager.TryGetComponent<CharacterRecordKeyStorageComponent>(entityUid, out var cdCRecords))
{
cdRecordsSys.QueryRecords(cdCRecords.Key.Station)[cdCRecords.Key.Index].Name = name;
}
}

private bool TryParseUid(string str, IConsoleShell shell,
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/_CD/Records/CharacterRecordsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 672b594

Please sign in to comment.