Add GetBaseName method to NameModifierSystem (#35633)

* Add GetBaseName method to NameModifierSystem

* Use Name
This commit is contained in:
Tayrtahn
2025-03-02 20:03:16 -05:00
committed by GitHub
parent 36021f1702
commit 7e7d12d437

View File

@@ -32,6 +32,18 @@ public sealed class NameModifierSystem : EntitySystem
Dirty(entity);
}
/// <summary>
/// Returns the base name of the entity, without any modifiers applied.
/// If the entity doesn't have a <see cref="NameModifierComponent"/>,
/// this returns the entity's metadata name.
/// </summary>
public string GetBaseName(Entity<NameModifierComponent?> entity)
{
if (Resolve(entity, ref entity.Comp, logMissing: false))
return entity.Comp.BaseName;
return Name(entity);
}
/// <summary>
/// Raises a <see cref="RefreshNameModifiersEvent"/> to gather modifiers and
/// updates the entity's name to its base name with modifiers applied.