diff --git a/Content.Server/Alert/ServerAlertsComponent.cs b/Content.Server/Alert/ServerAlertsComponent.cs index f35dfc1865..8df61ffff4 100644 --- a/Content.Server/Alert/ServerAlertsComponent.cs +++ b/Content.Server/Alert/ServerAlertsComponent.cs @@ -61,17 +61,17 @@ namespace Content.Server.Alert break; } - if (!IsShowingAlert(msg.AlertType)) + if (!IsShowingAlert(msg.Type)) { Logger.DebugS("alert", "user {0} attempted to" + " click alert {1} which is not currently showing for them", - player.Name, msg.AlertType); + player.Name, msg.Type); break; } - if (!AlertManager.TryGet(msg.AlertType, out var alert)) + if (!AlertManager.TryGet(msg.Type, out var alert)) { - Logger.WarningS("alert", "unrecognized encoded alert {0}", msg.AlertType); + Logger.WarningS("alert", "unrecognized encoded alert {0}", msg.Type); break; } diff --git a/Content.Shared/Alert/SharedAlertsComponent.cs b/Content.Shared/Alert/SharedAlertsComponent.cs index 3a8b6eec68..b4eec8caed 100644 --- a/Content.Shared/Alert/SharedAlertsComponent.cs +++ b/Content.Shared/Alert/SharedAlertsComponent.cs @@ -87,9 +87,12 @@ namespace Content.Shared.Alert { if (AlertManager.TryGet(alertType, out var alert)) { + // Check whether the alert category we want to show is already being displayed, with the same type, + // severity, and cooldown. if (_alerts.TryGetValue(alert.AlertKey, out var alertStateCallback) && - alert.AlertType == alertType && - alertStateCallback.Severity == severity && alertStateCallback.Cooldown == cooldown) + alertStateCallback.Type == alertType && + alertStateCallback.Severity == severity && + alertStateCallback.Cooldown == cooldown) { return; } @@ -98,7 +101,7 @@ namespace Content.Shared.Alert _alerts.Remove(alert.AlertKey); _alerts[alert.AlertKey] = new AlertState - {Cooldown = cooldown, Severity = severity}; + {Cooldown = cooldown, Severity = severity, Type=alertType}; AfterShowAlert(); @@ -180,12 +183,12 @@ namespace Content.Shared.Alert [Serializable, NetSerializable] public class ClickAlertMessage : ComponentMessage { - public readonly AlertType AlertType; + public readonly AlertType Type; public ClickAlertMessage(AlertType alertType) { Directed = true; - AlertType = alertType; + Type = alertType; } } @@ -194,5 +197,6 @@ namespace Content.Shared.Alert { public short? Severity; public ValueTuple? Cooldown; + public AlertType Type; } }