From 162d0cc75006300dce874a48941fbc423dd56cbf Mon Sep 17 00:00:00 2001 From: DMAPI Update Date: Wed, 28 Oct 2020 00:39:56 +0000 Subject: [PATCH] Update TGS DMAPI --- .gitattributes | 3 ++ code/__DEFINES/tgs.dm | 54 +++++++++++++++++++++++++++--- code/modules/tgs/v3210/api.dm | 2 +- code/modules/tgs/v3210/commands.dm | 4 +-- code/modules/tgs/v5/api.dm | 2 +- 5 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..d07d898c9b6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.dm text eol=lf +*.md text eol=lf +*LICENSE text eol=lf diff --git a/code/__DEFINES/tgs.dm b/code/__DEFINES/tgs.dm index 548c8115f76..a0a5df42907 100644 --- a/code/__DEFINES/tgs.dm +++ b/code/__DEFINES/tgs.dm @@ -1,13 +1,55 @@ -// AA Note -// yes I know this file has procs in it, but TGS is very picky with how the fuck its files are laid out -// dont @ me - // tgstation-server DMAPI -#define TGS_DMAPI_VERSION "5.2.5" +#define TGS_DMAPI_VERSION "5.2.7" // All functions and datums outside this document are subject to change with any version and should not be relied on. +// CONFIGURATION + +/// Create this define if you want to do TGS configuration outside of this file. +#ifndef TGS_EXTERNAL_CONFIGURATION + +// Comment this out once you've filled in the below. +#error TGS API unconfigured + +// Uncomment this if you wish to allow the game to interact with TGS 3. +// This will raise the minimum required security level of your game to TGS_SECURITY_TRUSTED due to it utilizing call()() +//#define TGS_V3_API + +// Required interfaces (fill in with your codebase equivalent): + +/// Create a global variable named `Name` and set it to `Value`. +#define TGS_DEFINE_AND_SET_GLOBAL(Name, Value) + +/// Read the value in the global variable `Name`. +#define TGS_READ_GLOBAL(Name) + +/// Set the value in the global variable `Name` to `Value`. +#define TGS_WRITE_GLOBAL(Name, Value) + +/// Disallow ANYONE from reflecting a given `path`, security measure to prevent in-game use of DD -> TGS capabilities. +#define TGS_PROTECT_DATUM(Path) + +/// Display an announcement `message` from the server to all players. +#define TGS_WORLD_ANNOUNCE(message) + +/// Notify current in-game administrators of a string `event`. +#define TGS_NOTIFY_ADMINS(event) + +/// Write an info `message` to a server log. +#define TGS_INFO_LOG(message) + +/// Write an warning `message` to a server log. +#define TGS_WARNING_LOG(message) + +/// Write an error `message` to a server log. +#define TGS_ERROR_LOG(message) + +/// Get the number of connected /clients. +#define TGS_CLIENT_COUNT + +#endif + // EVENT CODES /// Before a reboot mode change, extras parameters are the current and new reboot mode enums @@ -53,6 +95,8 @@ #define TGS_EVENT_WATCHDOG_SHUTDOWN 15 /// Before the watchdog detaches for a TGS update/restart. No parameters. #define TGS_EVENT_WATCHDOG_DETACH 16 +// We don't actually implement this value as the DMAPI can never receive it +// #define TGS_EVENT_WATCHDOG_LAUNCH 17 // OTHER ENUMS diff --git a/code/modules/tgs/v3210/api.dm b/code/modules/tgs/v3210/api.dm index 9ed512f8f9d..5b41e6a89d8 100644 --- a/code/modules/tgs/v3210/api.dm +++ b/code/modules/tgs/v3210/api.dm @@ -39,7 +39,7 @@ var/warned_custom_commands = FALSE /datum/tgs_api/v3210/ApiVersion() - return new /datum/tgs_version("3.2.1.1") + return new /datum/tgs_version("3.2.1.3") /datum/tgs_api/v3210/proc/trim_left(text) for (var/i = 1 to length(text)) diff --git a/code/modules/tgs/v3210/commands.dm b/code/modules/tgs/v3210/commands.dm index a8c3d318e53..4ccfc1a8a60 100644 --- a/code/modules/tgs/v3210/commands.dm +++ b/code/modules/tgs/v3210/commands.dm @@ -44,8 +44,8 @@ user.friendly_name = sender // Discord hack, fix the mention if it's only numbers (fuck you IRC trolls) - var/regex/discord_id_regex = regex(@"[0-9]+") - if(discord_id_regex.Find(sender)) + var/regex/discord_id_regex = regex(@"^[0-9]+$") + if(findtext(sender, discord_id_regex)) sender = "<@[sender]>" user.mention = sender diff --git a/code/modules/tgs/v5/api.dm b/code/modules/tgs/v5/api.dm index d4326fc4a28..466a986237d 100644 --- a/code/modules/tgs/v5/api.dm +++ b/code/modules/tgs/v5/api.dm @@ -18,7 +18,7 @@ var/initialized = FALSE /datum/tgs_api/v5/ApiVersion() - return new /datum/tgs_version("5.2.5") + return new /datum/tgs_version(TGS_DMAPI_VERSION) /datum/tgs_api/v5/OnWorldNew(minimum_required_security_level) server_port = world.params[DMAPI5_PARAM_SERVER_PORT]