using Robust.Shared.Serialization; using Robust.Shared.Utility; namespace Content.Shared.Examine { /// /// This component groups examine messages together /// [RegisterComponent] public sealed partial class GroupExamineComponent : Component { /// /// A list of ExamineGroups. /// [DataField] public List Group = new() { // TODO Remove hardcoded component names. new ExamineGroup() { Components = new() { "Armor", "ClothingSpeedModifier", }, }, }; } [DataDefinition] public sealed partial class ExamineGroup { /// /// The title of the Examine Group. Localized string that gets added to the examine tooltip. /// [DataField] [ViewVariables(VVAccess.ReadWrite)] public string? Title; /// /// A list of ExamineEntries, containing which component it belongs to, which priority it has, and what FormattedMessage it holds. /// [DataField] public List Entries = new(); // TODO custom type serializer, or just make this work via some other automatic grouping process that doesn't // rely on manually specifying component names in yaml. /// /// A list of all components this ExamineGroup encompasses. /// [DataField] public List Components = new(); /// /// The icon path for the Examine Group. /// [DataField] public SpriteSpecifier Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/examine-star.png")); /// /// The text shown in the context verb menu. /// [DataField] public LocId ContextText = "verb-examine-group-other"; /// /// Details shown when hovering over the button. /// [DataField] public string HoverMessage = string.Empty; } /// /// An entry used when showing examine details /// [Serializable, NetSerializable, DataDefinition] public sealed partial class ExamineEntry { /// /// Which component does this entry relate to? /// [DataField(required: true)] public string Component; /// /// What priority has this entry - entries are sorted high to low. /// [DataField] public float Priority = 0f; /// /// The FormattedMessage of this entry. /// [DataField(required: true)] public FormattedMessage Message; /// Should be set to _componentFactory.GetComponentName(component.GetType()) to properly function. public ExamineEntry(string component, float priority, FormattedMessage message) { Component = component; Priority = priority; Message = message; } private ExamineEntry() { // parameterless ctor is required for data-definition serialization Message = default!; Component = default!; } } }