From c95f77dfdba0977d5c24f08382ac0a99df7efa14 Mon Sep 17 00:00:00 2001 From: Pok245 <113675512+Pok27@users.noreply.github.com> Date: Fri, 11 Jul 2025 19:43:37 +0300 Subject: [PATCH] wiki-label --- Content.Server/Corvax/GuideGenerator/EntityEntry.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Content.Server/Corvax/GuideGenerator/EntityEntry.cs b/Content.Server/Corvax/GuideGenerator/EntityEntry.cs index a9809d048b..6bd8d49e84 100644 --- a/Content.Server/Corvax/GuideGenerator/EntityEntry.cs +++ b/Content.Server/Corvax/GuideGenerator/EntityEntry.cs @@ -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() + .Select(lc => lc.CurrentLabel) + .Where(label => !string.IsNullOrEmpty(label)) + .Select(label => Loc.GetString(label!)) + .FirstOrDefault() ?? ""; } }