Gives all nuclear bombs unique codes (#11665)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
21
Content.Server/Nuke/NukeLabelSystem.cs
Normal file
21
Content.Server/Nuke/NukeLabelSystem.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace Content.Server.Nuke;
|
||||
|
||||
/// <summary>
|
||||
/// This handles labelling an entity with a nuclear bomb label.
|
||||
/// </summary>
|
||||
public sealed class NukeLabelSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly NukeSystem _nuke = default!;
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<NukeLabelComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, NukeLabelComponent nuke, MapInitEvent args)
|
||||
{
|
||||
var label = Loc.GetString(nuke.NukeLabel, ("serial", _nuke.GenerateRandomNumberString(nuke.SerialLength)));
|
||||
var meta = MetaData(uid);
|
||||
meta.EntityName = $"{meta.EntityName} ({label})";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user