From 8849b1f5addc698ee8868bbcd41dc8cf8a7d2cf4 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 27 Apr 2020 20:39:43 -0400 Subject: [PATCH] Add TGS_EVENT_INSTANCE_RENAMED to DMAPI --- src/DMAPI/tgs.dm | 7 ++++--- src/DMAPI/tgs/v5/api.dm | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/DMAPI/tgs.dm b/src/DMAPI/tgs.dm index 2be28883d7..ce5ce4885a 100644 --- a/src/DMAPI/tgs.dm +++ b/src/DMAPI/tgs.dm @@ -1,6 +1,6 @@ //tgstation-server DMAPI -#define TGS_DMAPI_VERSION "5.0.0" +#define TGS_DMAPI_VERSION "5.1.0" //All functions and datums outside this document are subject to change with any version and should not be relied on @@ -52,8 +52,9 @@ //EVENT CODES -#define TGS_EVENT_PORT_SWAP -2 //before a port change is about to happen, extra parameter is new port -#define TGS_EVENT_REBOOT_MODE_CHANGE -1 //before a reboot mode change, extras parameters are the current and new reboot mode enums +#define TGS_EVENT_REBOOT_MODE_CHANGE -1 //Before a reboot mode change, extras parameters are the current and new reboot mode enums +#define TGS_EVENT_PORT_SWAP -2 //Before a port change is about to happen, extra parameters is new port +#define TGS_EVENT_INSTANCE_RENAMED -3 //Before the instance is renamed, extra prameter is the new name //See the descriptions for the parameters of these codes here: https://github.com/tgstation/tgstation-server/blob/master/src/Tgstation.Server.Host/Components/EventType.cs #define TGS_EVENT_REPO_RESET_ORIGIN 0 diff --git a/src/DMAPI/tgs/v5/api.dm b/src/DMAPI/tgs/v5/api.dm index f1a5c2dea6..d850b6fab8 100644 --- a/src/DMAPI/tgs/v5/api.dm +++ b/src/DMAPI/tgs/v5/api.dm @@ -178,6 +178,9 @@ if(!istext(new_instance_name)) return TopicResponse("Invalid or missing [DMAPI5_TOPIC_PARAMETER_NEW_INSTANCE_NAME]!") + if(event_handler != null) + event_handler.HandleEvent(TGS_EVENT_INSTANCE_RENAMED, new_instance_name) + instance_name = new_instance_name return TopicResponse() if(DMAPI5_TOPIC_COMMAND_CHAT_CHANNELS_UPDATE)