diff --git a/src/DMAPI/tgs/v4/api.dm b/src/DMAPI/tgs/v4/api.dm index 52970f2110..cde747ba1f 100644 --- a/src/DMAPI/tgs/v4/api.dm +++ b/src/DMAPI/tgs/v4/api.dm @@ -141,7 +141,15 @@ return result if(TGS4_TOPIC_EVENT) intercepted_message_queue = list() - event_handler.HandleEvent(text2num(params[TGS4_PARAMETER_DATA])) + var/list/event_notification = json_decode(params[TGS4_PARAMETER_DATA]) + var/list/event_parameters = event_notification["Parameters"] + + var/list/event_call = list(event_notification["Type"]) + if(event_parameters) + event_call += event_parameters + + event_handler.HandleEvent(arglist(event_call)) + . = json_encode(intercepted_message_queue) intercepted_message_queue = null return diff --git a/src/Tgstation.Server.Host/Components/Interop/EventNotification.cs b/src/Tgstation.Server.Host/Components/Interop/EventNotification.cs new file mode 100644 index 0000000000..9c9811808d --- /dev/null +++ b/src/Tgstation.Server.Host/Components/Interop/EventNotification.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Tgstation.Server.Host.Components.Interop +{ + /// + /// For notifying DD of s + /// + sealed class EventNotification + { + /// + /// The + /// + public EventType Type { get; set; } + + /// + /// The event parameters + /// + public IEnumerable Parameters { get; set; } + } +} diff --git a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs index c9a8813395..5d35904214 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs @@ -801,12 +801,14 @@ namespace Tgstation.Server.Host.Components.Watchdog return true; var builder = new StringBuilder(Constants.DMTopicEvent); - if (parameters != null) - foreach (var I in parameters) - { - builder.Append("&"); - builder.Append(byondTopicSender.SanitizeString(I)); - } + builder.Append("&"); + var notification = new EventNotification + { + Type = eventType, + Parameters = parameters + }; + var json = JsonConvert.SerializeObject(notification); + builder.Append(byondTopicSender.SanitizeString(json)); var activeServer = AlphaIsActive ? alphaServer : bravoServer; results = await activeServer.SendCommand(builder.ToString(), cancellationToken).ConfigureAwait(false);