From d6464b3ba08507e75164cf093798b7f6485008b2 Mon Sep 17 00:00:00 2001 From: Paul Ritter Date: Fri, 5 Mar 2021 12:46:04 +0100 Subject: [PATCH] fixes alert onclick (#3521) Co-authored-by: Paul --- .../GameObjects/Components/Mobs/ClientAlertsComponent.cs | 1 - .../GameObjects/Components/Mobs/ServerAlertsComponent.cs | 8 +++----- Content.Shared/Alert/AlertPrototype.cs | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs index ca35988130..975945dc43 100644 --- a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs @@ -219,7 +219,6 @@ namespace Content.Client.GameObjects.Components.Mobs return; } - if (!alert.Alert.HasOnClick) return; SendNetworkMessage(new ClickAlertMessage(alert.Alert.AlertType)); } diff --git a/Content.Server/GameObjects/Components/Mobs/ServerAlertsComponent.cs b/Content.Server/GameObjects/Components/Mobs/ServerAlertsComponent.cs index c182fa2bb8..ece106c60f 100644 --- a/Content.Server/GameObjects/Components/Mobs/ServerAlertsComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/ServerAlertsComponent.cs @@ -70,15 +70,13 @@ namespace Content.Server.GameObjects.Components.Mobs break; } - if (AlertManager.TryGet(msg.AlertType, out var alert) && alert.OnClick != null) - { - alert.OnClick.AlertClicked(new ClickAlertEventArgs(player, alert)); - } - else + if (!AlertManager.TryGet(msg.AlertType, out var alert)) { Logger.WarningS("alert", "unrecognized encoded alert {0}", msg.AlertType); + break; } + alert.OnClick?.AlertClicked(new ClickAlertEventArgs(player, alert)); break; } } diff --git a/Content.Shared/Alert/AlertPrototype.cs b/Content.Shared/Alert/AlertPrototype.cs index 8ae4d2d414..06901594fd 100644 --- a/Content.Shared/Alert/AlertPrototype.cs +++ b/Content.Shared/Alert/AlertPrototype.cs @@ -83,11 +83,6 @@ namespace Content.Shared.Alert /// public bool SupportsSeverity => MaxSeverity != -1; - /// - /// Whether this alert is clickable. This is valid clientside. - /// - public bool HasOnClick => OnClick != null; - /// /// Defines what to do when the alert is clicked. /// This will always be null on clientside.