From 7e7d12d437f0ae32459ffc36bd0376fff6334945 Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Sun, 2 Mar 2025 20:03:16 -0500 Subject: [PATCH] Add GetBaseName method to NameModifierSystem (#35633) * Add GetBaseName method to NameModifierSystem * Use Name --- .../NameModifier/EntitySystems/NameModifierSystem.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Content.Shared/NameModifier/EntitySystems/NameModifierSystem.cs b/Content.Shared/NameModifier/EntitySystems/NameModifierSystem.cs index 2e7c8054b3..33f6efbed5 100644 --- a/Content.Shared/NameModifier/EntitySystems/NameModifierSystem.cs +++ b/Content.Shared/NameModifier/EntitySystems/NameModifierSystem.cs @@ -32,6 +32,18 @@ public sealed class NameModifierSystem : EntitySystem Dirty(entity); } + /// + /// Returns the base name of the entity, without any modifiers applied. + /// If the entity doesn't have a , + /// this returns the entity's metadata name. + /// + public string GetBaseName(Entity entity) + { + if (Resolve(entity, ref entity.Comp, logMissing: false)) + return entity.Comp.BaseName; + return Name(entity); + } + /// /// Raises a to gather modifiers and /// updates the entity's name to its base name with modifiers applied. -- 2.51.2