Replace IClickAlert with events (#30728)

* Replace IAlertClick with events

* whoop

* eek!
This commit is contained in:
Nemanja
2024-08-07 01:15:35 -04:00
committed by GitHub
parent 2dabf33d46
commit ce97225c2d
33 changed files with 177 additions and 270 deletions

View File

@@ -76,11 +76,11 @@ public sealed partial class AlertPrototype : IPrototype
public bool SupportsSeverity => MaxSeverity != -1;
/// <summary>
/// Defines what to do when the alert is clicked.
/// This will always be null on clientside.
/// Event raised on the user when they click on this alert.
/// Can be null.
/// </summary>
[DataField(serverOnly: true)]
public IAlertClick? OnClick { get; private set; }
[DataField]
public BaseAlertEvent? ClickEvent;
/// <param name="severity">severity level, if supported by this alert</param>
/// <returns>the icon path to the texture for the provided severity level</returns>
@@ -114,3 +114,17 @@ public sealed partial class AlertPrototype : IPrototype
return Icons[severity.Value - _minSeverity];
}
}
[ImplicitDataDefinitionForInheritors]
public abstract partial class BaseAlertEvent : HandledEntityEventArgs
{
public EntityUid User;
public ProtoId<AlertPrototype> AlertId;
protected BaseAlertEvent(EntityUid user, ProtoId<AlertPrototype> alertId)
{
User = user;
AlertId = alertId;
}
}