Skip to content

Commit

Permalink
Nukes 514 support (ParadiseSS13#26224)
Browse files Browse the repository at this point in the history
* Nukes 514 support

* 1633

* replace CI exclude for proc refs

* 1619
  • Loading branch information
Furrior authored Jul 29, 2024
1 parent dfca6b8 commit adbda79
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 23 deletions.
6 changes: 6 additions & 0 deletions code/__DEFINES/proc_refs.dm
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions code/__DEFINES/regex.dm
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 0 additions & 19 deletions code/__byond_version_compat.dm
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions paradise.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/check_grep2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit adbda79

Please sign in to comment.