mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-19 07:01:09 +03:00
wiki-label
This commit is contained in:
parent
56c3de86e6
commit
c95f77dfdb
1 changed files with 13 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Labels.Components;
|
||||
|
||||
namespace Content.Server.GuideGenerator;
|
||||
|
||||
|
|
@ -17,11 +19,22 @@ public sealed class EntityEntry
|
|||
[JsonPropertyName("suffix")]
|
||||
public string Suffix { get; }
|
||||
|
||||
[JsonPropertyName("label")]
|
||||
public string Label { get; }
|
||||
|
||||
public EntityEntry(EntityPrototype proto)
|
||||
{
|
||||
Id = proto.ID;
|
||||
Name = TextTools.TextTools.CapitalizeString(proto.Name); // Corvax-Wiki
|
||||
Description = proto.Description;
|
||||
Suffix = proto.EditorSuffix != null ? proto.EditorSuffix : "";
|
||||
|
||||
Label = proto.Components.Values
|
||||
.Select(x => x.Component)
|
||||
.OfType<LabelComponent>()
|
||||
.Select(lc => lc.CurrentLabel)
|
||||
.Where(label => !string.IsNullOrEmpty(label))
|
||||
.Select(label => Loc.GetString(label!))
|
||||
.FirstOrDefault() ?? "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue