using Content.Shared.Stealth.Components; using Content.Shared.Whitelist; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array; using Robust.Shared.Utility; namespace Content.Shared.StatusIcon; /// /// A data structure that holds relevant /// information for status icons. /// [Virtual, DataDefinition] public partial class StatusIconData : IComparable { /// /// The icon that's displayed on the entity. /// [DataField(required: true)] public SpriteSpecifier Icon = default!; /// /// A priority for the order in which the icons will be displayed. /// [DataField] public int Priority = 10; /// /// Whether or not to hide the icon to ghosts /// [DataField] public bool VisibleToGhosts = true; /// /// Whether or not to hide the icon when we are inside a container like a locker or a crate. /// [DataField] public bool HideInContainer = true; /// /// Whether or not to hide the icon when the entity has an active /// [DataField] public bool HideOnStealth = true; /// /// Specifies what entities and components/tags this icon can be shown to. /// [DataField] public EntityWhitelist? ShowTo; /// /// A preference for where the icon will be displayed. None | Left | Right /// [DataField] public StatusIconLocationPreference LocationPreference = StatusIconLocationPreference.None; /// /// The layer the icon is displayed on. Mod is drawn above Base. Base | Mod /// [DataField] public StatusIconLayer Layer = StatusIconLayer.Base; /// /// Offset of the status icon, up and down only. /// [DataField] public int Offset = 0; /// /// Offset of the status icon, left and right only. /// [DataField] public int OffsetHorizontal = 0; /// /// Sets if the icon should be rendered with or without the effect of lighting. /// [DataField] public bool IsShaded = false; /// public int CompareTo(StatusIconData? other) { return Priority.CompareTo(other?.Priority ?? int.MaxValue); } } /// /// but in new convenient prototype form! /// [Prototype] public sealed partial class StatusIconPrototype : StatusIconData, IPrototype, IInheritingPrototype { /// [IdDataField] public string ID { get; private set; } = default!; /// [ParentDataField(typeof(AbstractPrototypeIdArraySerializer))] public string[]? Parents { get; private set; } /// [NeverPushInheritance] [AbstractDataField] public bool Abstract { get; private set; } } /// /// StatusIcons for showing jobs icons. /// [Prototype] public sealed partial class JobIconPrototype : StatusIconData, IPrototype, IInheritingPrototype { /// [IdDataField] public string ID { get; private set; } = default!; /// [ParentDataField(typeof(AbstractPrototypeIdArraySerializer))] public string[]? Parents { get; private set; } /// [NeverPushInheritance] [AbstractDataField] public bool Abstract { get; private set; } /// /// Name of the icon used for menu tooltips. /// [DataField] public string JobName { get; private set; } = string.Empty; /// /// Localized job name to use for showing to players. /// [ViewVariables(VVAccess.ReadOnly)] public string LocalizedJobName => Loc.GetString(JobName); /// /// Should this job icon be considered a crew job for silicons? /// [DataField] public bool IsCrewJob = true; } /// /// The location of the status icon. /// [Serializable, NetSerializable] public enum StatusIconLocationPreference : byte { None, // Aligns on left side, if there's room on either side Left, // Aligns on left side, provided left side has room Right, // Aligns on right side, provided right side has room Fixed, // Gets set independently without considering existing status icons } /// /// Which layer the status icon should be displayed on. /// public enum StatusIconLayer : byte { Base, Mod, }