diff --git a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs index ae92f09ee3..7e847038be 100644 --- a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs @@ -222,6 +222,7 @@ 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 2ec4c6f398..e80232120c 100644 --- a/Content.Server/GameObjects/Components/Mobs/ServerAlertsComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/ServerAlertsComponent.cs @@ -71,7 +71,7 @@ namespace Content.Server.GameObjects.Components.Mobs break; } - if (AlertManager.TryGet(msg.AlertType, out var alert)) + if (AlertManager.TryGet(msg.AlertType, out var alert) && alert.OnClick != null) { alert.OnClick.AlertClicked(new ClickAlertEventArgs(player, alert)); } diff --git a/Content.Shared/Alert/AlertPrototype.cs b/Content.Shared/Alert/AlertPrototype.cs index 9a6e0bd674..d7cf72bb88 100644 --- a/Content.Shared/Alert/AlertPrototype.cs +++ b/Content.Shared/Alert/AlertPrototype.cs @@ -72,8 +72,14 @@ namespace Content.Shared.Alert /// public bool SupportsSeverity => MaxSeverity != -1; + /// + /// Whether this alert is clickable. This is valid clientside. + /// + public bool HasOnClick { get; private set; } + /// /// Defines what to do when the alert is clicked. + /// This will always be null on clientside. /// public IAlertClick OnClick { get; private set; } @@ -102,6 +108,8 @@ namespace Content.Shared.Alert } AlertKey = new AlertKey(AlertType, Category); + HasOnClick = serializer.TryReadDataField("onClick", out string _); + if (IoCManager.Resolve().IsClientModule) return; serializer.DataField(this, x => x.OnClick, "onClick", null); }