Rename fix (#31654)

* Localize RenameCommand and delegate most of the process to MetaDataSystem.SetEntityName()

* Make renaming rely on the EntityRenamedEvent. Fix issue where renaming would keep old Examine text

Requires engine change

* Fix localisation strings

* Make PDA search be based on a renamed entity's Uid instead of its old name

To do this the pda component now has an PdaOwner field which gets
assigned when it is given as a loadout to a player

* Fix bad merge???

huh

* Use AllEntityQuery
This commit is contained in:
nikthechampiongr
2024-09-15 01:55:03 +00:00
committed by GitHub
parent f81d18914d
commit ee434e397d
11 changed files with 95 additions and 79 deletions

View File

@@ -5,7 +5,7 @@ using Content.Shared.NameModifier.Components;
namespace Content.Shared.NameModifier.EntitySystems;
/// <inheritdoc cref="NameModifierComponent"/>
public sealed partial class NameModifierSystem : EntitySystem
public sealed class NameModifierSystem : EntitySystem
{
[Dependency] private readonly MetaDataSystem _metaData = default!;
@@ -16,10 +16,10 @@ public sealed partial class NameModifierSystem : EntitySystem
SubscribeLocalEvent<NameModifierComponent, EntityRenamedEvent>(OnEntityRenamed);
}
private void OnEntityRenamed(Entity<NameModifierComponent> entity, ref EntityRenamedEvent args)
private void OnEntityRenamed(Entity<NameModifierComponent> ent, ref EntityRenamedEvent args)
{
SetBaseName((entity, entity.Comp), args.NewName);
RefreshNameModifiers((entity, entity.Comp));
SetBaseName(ent, args.NewName);
RefreshNameModifiers((ent.Owner, ent.Comp));
}
private void SetBaseName(Entity<NameModifierComponent> entity, string name)