Cleans up StatusIconSystem and fixing some bugs (#28270)

This commit is contained in:
AJCM-git
2024-06-03 12:12:21 -04:00
committed by GitHub
parent 87ffbab461
commit 8c10581010
49 changed files with 224 additions and 259 deletions

View File

@@ -1,3 +1,5 @@
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;
@@ -15,26 +17,45 @@ public partial class StatusIconData : IComparable<StatusIconData>
/// <summary>
/// The icon that's displayed on the entity.
/// </summary>
[DataField("icon", required: true)]
[DataField(required: true)]
public SpriteSpecifier Icon = default!;
/// <summary>
/// A priority for the order in which the icons will be displayed.
/// </summary>
[DataField("priority")]
[DataField]
public int Priority = 10;
/// <summary>
/// Whether or not to hide the icon to ghosts
/// </summary>
[DataField]
public bool VisibleToGhosts = true;
/// <summary>
/// Whether or not to hide the icon when we are inside a container like a locker or a crate.
/// </summary>
[DataField]
public bool HideInContainer = true;
/// <summary>
/// Whether or not to hide the icon when the entity has an active <see cref="StealthComponent"/>
/// </summary>
[DataField]
public bool HideOnStealth = true;
/// <summary>
/// Specifies what entities and components/tags this icon can be shown to.
/// </summary>
[DataField]
public EntityWhitelist? ShowTo;
/// <summary>
/// A preference for where the icon will be displayed. None | Left | Right
/// </summary>
[DataField("locationPreference")]
[DataField]
public StatusIconLocationPreference LocationPreference = StatusIconLocationPreference.None;
public int CompareTo(StatusIconData? other)
{
return Priority.CompareTo(other?.Priority ?? int.MaxValue);
}
/// <summary>
/// The layer the icon is displayed on. Mod is drawn above Base. Base | Mod
/// </summary>
@@ -52,6 +73,11 @@ public partial class StatusIconData : IComparable<StatusIconData>
/// </summary>
[DataField]
public bool IsShaded = false;
public int CompareTo(StatusIconData? other)
{
return Priority.CompareTo(other?.Priority ?? int.MaxValue);
}
}
/// <summary>