CatStation/Content.Shared/NameIdentifier/NameIdentifierComponent.cs
Connor Huffine 8b48748048
Give mobs amusing name prefixes (#44977)
* Functional product

* Bugfix

* Handle empty case gracefully

* Fix inserting bad values

* First set of tests

* Don't need this

* Dont add empty modifers to names

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Typo and [SubscribeLocalEvent]

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Refactor GenerateUniqueName to GenerateUniqueNameModifier

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Fix returning name when empty

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Docs

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Tests

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Fix comment

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Fix FTL test

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Add adjectives

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Amateur hour

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Simplify spawning

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Even more streamlined

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Improve comment

Signed-off-by: Connor Huffine <chuffine@gmail.com>

* Apply suggestions from code review

Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>

---------

Signed-off-by: Connor Huffine <chuffine@gmail.com>
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>
2026-08-09 00:22:15 +00:00

29 lines
919 B
C#

using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.NameIdentifier;
/// <summary>
/// Generates a unique numeric identifier for entities, with specifics controlled by a <see cref="NameIdentifierGroupPrototype"/>.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class NameIdentifierComponent : Component
{
/// <summary>
/// The group prototype that defines the behavior of the identifier.
/// </summary>
[DataField]
public ProtoId<NameIdentifierGroupPrototype>? Group;
/// <summary>
/// The randomly generated ID for this entity.
/// </summary>
[DataField, AutoNetworkedField]
public int Identifier = -1;
/// <summary>
/// The full name identifier for this entity.
/// </summary>
[DataField, AutoNetworkedField]
public string FullIdentifier = string.Empty;
}