Replace IClickAlert with events (#30728)
* Replace IAlertClick with events * whoop * eek!
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user