dynamic alert sprites (#25452)

* dynamic alert sprite

* fix fat cooldowns
This commit is contained in:
Nemanja
2024-03-28 02:32:56 -04:00
committed by GitHub
parent 6863a7cc26
commit d576f5cbbb
38 changed files with 154 additions and 84 deletions

View File

@@ -25,6 +25,12 @@ namespace Content.Shared.Alert
[DataField("icons", required: true)]
public List<SpriteSpecifier> Icons = new();
/// <summary>
/// An entity used for displaying the <see cref="Icons"/> in the UI control.
/// </summary>
[DataField]
public EntProtoId AlertViewEntity = "AlertSpriteView";
/// <summary>
/// Name to show in tooltip window. Accepts formatting.
/// </summary>
@@ -83,13 +89,9 @@ namespace Content.Shared.Alert
/// <returns>the icon path to the texture for the provided severity level</returns>
public SpriteSpecifier GetIcon(short? severity = null)
{
if (!SupportsSeverity && severity != null)
{
throw new InvalidOperationException($"This alert ({AlertKey}) does not support severity");
}
var minIcons = SupportsSeverity
? MaxSeverity - MinSeverity : 1;
? MaxSeverity - MinSeverity
: 1;
if (Icons.Count < minIcons)
throw new InvalidOperationException($"Insufficient number of icons given for alert {AlertType}");