Remove AlertType and AlertCategory (#27933)

This commit is contained in:
Nemanja
2024-05-23 22:43:04 -04:00
committed by GitHub
parent 594a898260
commit 8a95cb186c
69 changed files with 483 additions and 386 deletions

View File

@@ -1,5 +1,5 @@
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Alert;
@@ -11,13 +11,13 @@ namespace Content.Shared.Alert;
[Serializable, NetSerializable]
public struct AlertKey
{
public AlertType? AlertType { get; private set; } = Alert.AlertType.Error;
public readonly AlertCategory? AlertCategory;
public ProtoId<AlertPrototype>? AlertType { get; private set; } = default!;
public readonly ProtoId<AlertCategoryPrototype>? AlertCategory;
/// NOTE: if the alert has a category you must pass the category for this to work
/// properly as a key. I.e. if the alert has a category and you pass only the alert type, and you
/// compare this to another AlertKey that has both the category and the same alert type, it will not consider them equal.
public AlertKey(AlertType? alertType, AlertCategory? alertCategory)
public AlertKey(ProtoId<AlertPrototype>? alertType, ProtoId<AlertCategoryPrototype>? alertCategory)
{
AlertCategory = alertCategory;
AlertType = alertType;
@@ -49,7 +49,7 @@ public struct AlertKey
/// <param name="category">alert category, must not be null</param>
/// <returns>An alert key for the provided alert category. This must only be used for
/// queries and never storage, as it is lacking an alert type.</returns>
public static AlertKey ForCategory(AlertCategory category)
public static AlertKey ForCategory(ProtoId<AlertCategoryPrototype> category)
{
return new(null, category);
}