From adbda79df900d6d074f326fd31929dd0e35dc368 Mon Sep 17 00:00:00 2001 From: "Mikhail G." Date: Tue, 30 Jul 2024 03:38:57 +0700 Subject: [PATCH] Nukes 514 support (#26224) * Nukes 514 support * 1633 * replace CI exclude for proc refs * 1619 --- code/__DEFINES/proc_refs.dm | 6 ++++++ code/__DEFINES/regex.dm | 2 ++ code/__byond_version_compat.dm | 19 ------------------- code/_compile_options.dm | 6 +++--- paradise.dme | 2 ++ tools/ci/check_grep2.py | 2 +- 6 files changed, 14 insertions(+), 23 deletions(-) create mode 100644 code/__DEFINES/proc_refs.dm create mode 100644 code/__DEFINES/regex.dm diff --git a/code/__DEFINES/proc_refs.dm b/code/__DEFINES/proc_refs.dm new file mode 100644 index 00000000000..74d404c7980 --- /dev/null +++ b/code/__DEFINES/proc_refs.dm @@ -0,0 +1,6 @@ +/// Validates the proc exists on this type (or global unfortunately) +#define PROC_REF(X) (nameof(.proc/##X)) +#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X)) +#define GLOBAL_PROC_REF(X) (/proc/##X) +#define NAMEOF_STATIC(datum, X) (#X || type::##X) +#define CALL_EXT call_ext diff --git a/code/__DEFINES/regex.dm b/code/__DEFINES/regex.dm new file mode 100644 index 00000000000..ea1aece0627 --- /dev/null +++ b/code/__DEFINES/regex.dm @@ -0,0 +1,2 @@ +/// Use this for every proc passed in as second argument in regex.Replace. regex.Replace does not allow calling procs by name but as of 515 using proc refs will always call the top level proc instead of overrides +#define REGEX_REPLACE_HANDLER SHOULD_NOT_OVERRIDE(TRUE) diff --git a/code/__byond_version_compat.dm b/code/__byond_version_compat.dm index c95b0e51e38..a45e657e2ee 100644 --- a/code/__byond_version_compat.dm +++ b/code/__byond_version_compat.dm @@ -1,20 +1 @@ // This file contains defines allowing targeting byond versions newer than the supported -//TODO: REMOVE THE 514 STUFF WHEN DREAMCHECKER AND DM LANG SERVER GET THEIR ACT TOGETHER -// So we want to have compile time guarantees these procs exist on local type, unfortunately 515 killed the .proc/procname syntax so we have to use nameof() -#if DM_VERSION < 515 -#define PROC_REF(X) (.proc/##X) -#define TYPE_PROC_REF(TYPE, X) (##TYPE.proc/##X) -#define GLOBAL_PROC_REF(X) (.proc/##X) -#define NAMEOF_STATIC(datum, X) (#X || ##datum.##X) -#define CALL_EXT call -#else -/// Validates the proc exists on this type (or global unfortunately) -#define PROC_REF(X) (nameof(.proc/##X)) -#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X)) -#define GLOBAL_PROC_REF(X) (/proc/##X) -#define NAMEOF_STATIC(datum, X) (#X || type::##X) -#define CALL_EXT call_ext -#endif - -/// Use this for every proc passed in as second argument in regex.Replace. regex.Replace does not allow calling procs by name but as of 515 using proc refs will always call the top level proc instead of overrides -#define REGEX_REPLACE_HANDLER SHOULD_NOT_OVERRIDE(TRUE) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index a7d8bcbd35c..8c6d4580c43 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -39,10 +39,10 @@ #define IS_MODE_COMPILED(MODE) (ispath(text2path("/datum/game_mode/"+(MODE)))) //Update this whenever you need to take advantage of more recent byond features -#define MIN_COMPILER_VERSION 514 -#define MIN_COMPILER_BUILD 1554 +#define MIN_COMPILER_VERSION 515 +#define MIN_COMPILER_BUILD 1619 #if DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD //Don't forget to update this part #error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update. -#error You need version 514.1554 or higher +#error You need version 515.1619 or higher #endif diff --git a/paradise.dme b/paradise.dme index 8f7a4620610..051a8515bad 100644 --- a/paradise.dme +++ b/paradise.dme @@ -101,10 +101,12 @@ #include "code\__DEFINES\power_defines.dm" #include "code\__DEFINES\preferences_defines.dm" #include "code\__DEFINES\procpath.dm" +#include "code\__DEFINES\proc_refs.dm" #include "code\__DEFINES\qdel_defines.dm" #include "code\__DEFINES\radiation_defines.dm" #include "code\__DEFINES\radio_defines.dm" #include "code\__DEFINES\reagents_defines.dm" +#include "code\__DEFINES\regex.dm" #include "code\__DEFINES\revolution_defines.dm" #include "code\__DEFINES\role_preferences.dm" #include "code\__DEFINES\rolebans.dm" diff --git a/tools/ci/check_grep2.py b/tools/ci/check_grep2.py index 8bf21aedd17..e89cefdc168 100644 --- a/tools/ci/check_grep2.py +++ b/tools/ci/check_grep2.py @@ -18,7 +18,7 @@ def print_error(message: str, filename: str, line_number: int): else: print(f"{filename}:{line_number}: {RED}{message}{NC}") -IGNORE_515_PROC_MARKER_FILENAME = "__byond_version_compat.dm" +IGNORE_515_PROC_MARKER_FILENAME = "proc_refs.dm" CHECK_515_PROC_MARKER_RE = re.compile(r"\.proc/") def check_515_proc_syntax(idx, line): if CHECK_515_PROC_MARKER_RE.search(line):