Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

515 Support #2113

Merged
merged 49 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
41bbe6d
regexing
MarkSuckerberg Jun 30, 2023
fdd672e
bunch more fixes
MarkSuckerberg Jun 30, 2023
d035a13
more stuff
MarkSuckerberg Jul 1, 2023
dadf48e
more (optional) stuff
MarkSuckerberg Jul 1, 2023
8bcd523
Add support for running tests on alternate versions (#71177)
Mothblocks Nov 9, 2022
9bb930f
thog don't caare
MarkSuckerberg Jul 1, 2023
33e242f
let's try this!
MarkSuckerberg Jul 1, 2023
715f539
oh right lol
MarkSuckerberg Jul 1, 2023
6b099e3
here
MarkSuckerberg Jul 1, 2023
7b49483
debug
MarkSuckerberg Jul 1, 2023
558a4c3
i'm such a silly
MarkSuckerberg Jul 1, 2023
0d294f8
Ensures external libraries can't be called by callbacks (#71346)
Y0SH1M4S73R Nov 22, 2022
e25faaa
Ensures external libraries can't be called by callbacks (#71346)
MarkSuckerberg Jul 1, 2023
9e55171
fcopy 515 linux compat (#75835)
MrStonedOne Jun 5, 2023
e0b3f95
please :pleading_face:
MarkSuckerberg Jul 1, 2023
bdd3c5e
haha 123
MarkSuckerberg Jul 1, 2023
1c6b335
:sob:
MarkSuckerberg Jul 1, 2023
701f587
guh
MarkSuckerberg Jul 1, 2023
98917f6
idk
MarkSuckerberg Jul 1, 2023
a73f5df
don't hate me I just want to see if this works
MarkSuckerberg Jul 1, 2023
4aea38f
:pleading_face: two
MarkSuckerberg Jul 1, 2023
1bda424
WHOOPS
MarkSuckerberg Jul 1, 2023
ac081e5
I JUST WANT TO SEE IF IT WORKS OKAY??
MarkSuckerberg Jul 1, 2023
a4a30d5
sob emoji
MarkSuckerberg Jul 1, 2023
22eaffd
1604
MarkSuckerberg Jul 1, 2023
e130ed0
ah well I give up
MarkSuckerberg Jul 1, 2023
dcd96a7
Merge remote-tracking branch 'upstream/master' into five-fifteen
MarkSuckerberg Jul 6, 2023
41f1d7c
LET'S HAVE A GO AT IT
MarkSuckerberg Jul 20, 2023
4ed93c7
HEEEEEEEEEEEEEEEEELP
MarkSuckerberg Jul 20, 2023
6493e94
HEEEEEEEEEELP MEEEEEEEE
MarkSuckerberg Jul 20, 2023
8dd7b0d
Merge remote-tracking branch 'upstream/master' into five-fifteen
MarkSuckerberg Aug 1, 2023
9e937c3
more updates
MarkSuckerberg Aug 1, 2023
9dd0fdc
let's just fucking try this lmao
MarkSuckerberg Aug 1, 2023
77504a6
more things
MarkSuckerberg Aug 2, 2023
6447df8
oopsie
MarkSuckerberg Aug 2, 2023
6b0e079
REEE
MarkSuckerberg Aug 2, 2023
e437822
eee
MarkSuckerberg Aug 2, 2023
4125c9a
I give up
MarkSuckerberg Aug 2, 2023
6f75ff5
bumps rust-g to latest
MarkSuckerberg Aug 2, 2023
4d3c4c0
this too
MarkSuckerberg Aug 2, 2023
a4e4d2d
whoops
MarkSuckerberg Aug 2, 2023
4d973e5
More fixes
MarkSuckerberg Sep 13, 2023
f7c6a0d
Merge remote-tracking branch 'upstream/master' into five-fifteen
MarkSuckerberg Sep 15, 2023
00ac3b8
Fixes to the merge
MarkSuckerberg Sep 15, 2023
90deb55
let's try this
MarkSuckerberg Sep 15, 2023
322f322
Merge remote-tracking branch 'upstream/master' into five-fifteen
MarkSuckerberg Nov 4, 2023
dde25fe
Update more proc calls to use the macro
MarkSuckerberg Nov 4, 2023
c07efef
One more slipped through
MarkSuckerberg Nov 4, 2023
f1d0178
Disables 515 test
MarkSuckerberg Nov 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/autowiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:

jobs:
autowiki:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: "Check for AUTOWIKI_USERNAME"
id: secrets_set
Expand Down
68 changes: 19 additions & 49 deletions .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ on:
- master
jobs:
run_linters:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Run Linters
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -66,8 +67,9 @@ jobs:
cat check_regex_output.txt

compile_all_maps:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Compile Maps
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Python setup
Expand All @@ -90,54 +92,22 @@ jobs:
tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS -DFULL_INIT

run_all_tests:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Integration Tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Setup cache
id: cache-byond
uses: actions/cache@v3
with:
path: ~/BYOND
key: ${{ runner.os }}-byond-cache-${{ hashFiles('Dockerfile') }}
- name: Install BYOND
if: steps.cache-byond.outputs.cache-hit != 'true'
run: bash tools/ci/install_byond.sh
- name: Setup database
run: |
sudo systemctl start mysql
mysql -u root -proot -e 'CREATE DATABASE tg_ci;'
mysql -u root -proot tg_ci < SQL/tgstation_schema.sql
mysql -u root -proot -e 'CREATE DATABASE tg_ci_prefixed;'
mysql -u root -proot tg_ci_prefixed < SQL/tgstation_schema_prefixed.sql
- name: Install rust-g
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install -o APT::Immediate-Configure=false libssl1.1:i386
bash tools/ci/install_rust_g.sh
- name: Install auxmos
run: |
bash tools/ci/install_auxmos.sh
- name: Compile Tests
run: |
bash tools/ci/install_byond.sh
source $HOME/BYOND/byond/bin/byondsetup
tools/build/build --ci dm -DCIBUILDING -DANSICOLORS
- name: Run Tests
run: |
source $HOME/BYOND/byond/bin/byondsetup
bash tools/ci/run_server.sh
uses: ./.github/workflows/run_integration_tests.yml

# run_alternate_tests:
# if: "!contains(github.event.head_commit.message, '[ci skip]')"
# name: Alternate Tests
# strategy:
# fail-fast: false
# matrix:
# major: [515]
# minor: [1614]
# uses: ./.github/workflows/run_integration_tests.yml
# with:
# major: ${{ matrix.major }}
# minor: ${{ matrix.minor }}

test_windows:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compile_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
compile:
name: "Compile changelogs"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: "Check for ACTION_ENABLER secret and pass it to output if it exists to be checked by later steps"
id: value_holder
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
publish:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Restore SpacemanDMM cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
MakeCL:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/round_id_linker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
link_rounds:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: shiptest-ss13/[email protected]
with:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/run_integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This is a reusable workflow to run integration tests.
# This is run for every single map in ci_suite.yml. You might want to edit that instead.
name: Run Integration Tests
on:
workflow_call:
inputs:
major:
required: false
type: string
minor:
required: false
type: string
jobs:
run_integration_tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Setup cache
id: cache-byond
uses: actions/cache@v3
with:
path: ~/BYOND
key: ${{ runner.os }}-byond-cache-${{ hashFiles('Dockerfile') }}
- name: Setup database
run: |
sudo systemctl start mysql
mysql -u root -proot -e 'CREATE DATABASE tg_ci;'
mysql -u root -proot tg_ci < SQL/tgstation_schema.sql
mysql -u root -proot -e 'CREATE DATABASE tg_ci_prefixed;'
mysql -u root -proot tg_ci_prefixed < SQL/tgstation_schema_prefixed.sql
- name: Install rust-g
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install -o APT::Immediate-Configure=false libssl-dev:i386
bash tools/ci/install_rust_g.sh
- name: Install auxmos
run: |
bash tools/ci/install_auxmos.sh
- name: Configure version
if: ${{ inputs.major }}
run: |
echo "BYOND_MAJOR=${{ inputs.major }}" >> $GITHUB_ENV
echo "BYOND_MINOR=${{ inputs.minor }}" >> $GITHUB_ENV
- name: Compile Tests
run: |
bash tools/ci/install_byond.sh
source $HOME/BYOND/byond/bin/byondsetup
tools/build/build --ci dm -DCIBUILDING -DANSICOLORS
- name: Run Tests
run: |
source $HOME/BYOND/byond/bin/byondsetup
bash tools/ci/run_server.sh
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
stale:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_tgs_dmapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
update-dmapi:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Update the TGS DMAPI
steps:
- name: Clone
Expand Down
Binary file modified auxmos.dll
Binary file not shown.
3 changes: 3 additions & 0 deletions check_regex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ standards:
'\(([\t ]+([^)"\n\\]*)|([^("\n]+)[\t ]+)\)',
]

- exactly: [2, "Old-style proc references", '\.proc/(\w+)']
- exactly: [0, "Old-style typed proc references", '([\w/]+?)/?\.proc/(\w+)']

- no_more:
[
34,
Expand Down
11 changes: 0 additions & 11 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,6 @@
T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X; \
T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;

GLOBAL_VAR(atmos_extools_initialized) // this must be an uninitialized (null) one or init_monstermos will be called twice because reasons
#define ATMOS_EXTOOLS_CHECK if(!GLOB.atmos_extools_initialized){ \
GLOB.atmos_extools_initialized=TRUE; \
if(fexists(world.system_type == MS_WINDOWS ? "./byond-extools.dll" : "./libbyond-extools.so")){ \
var/result = call((world.system_type == MS_WINDOWS ? "./byond-extools.dll" : "./libbyond-extools.so"),"init_monstermos")(); \
if(result != "ok") {CRASH(result);} \
} else { \
CRASH("byond-extools.dll does not exist!"); \
} \
}

GLOBAL_LIST_INIT(pipe_paint_colors, sortList(list(
"amethyst" = rgb(130,43,255), //supplymain
"blue" = rgb(0,0,255),
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/callbacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
#define INVOKE_ASYNC world.ImmediateInvokeAsync
/// like CALLBACK but specifically for verb callbacks
#define VERB_CALLBACK new /datum/callback/verb_callback
#define CALLBACK_NEW(typepath, args) CALLBACK(GLOBAL_PROC, /proc/___callbacknew, typepath, args)
#define CALLBACK_NEW(typepath, args) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___callbacknew), typepath, args)
4 changes: 2 additions & 2 deletions code/__DEFINES/cooldowns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define COMSIG_CD_STOP(cd_index) "cooldown_[cd_index]"
#define COMSIG_CD_RESET(cd_index) "cd_reset_[cd_index]"

#define TIMER_COOLDOWN_START(cd_source, cd_index, cd_time) LAZYSET(cd_source.cooldowns, cd_index, addtimer(CALLBACK(GLOBAL_PROC, /proc/end_cooldown, cd_source, cd_index), cd_time))
#define TIMER_COOLDOWN_START(cd_source, cd_index, cd_time) LAZYSET(cd_source.cooldowns, cd_index, addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(end_cooldown), cd_source, cd_index), cd_time))

#define TIMER_COOLDOWN_CHECK(cd_source, cd_index) LAZYACCESS(cd_source.cooldowns, cd_index)

Expand All @@ -48,7 +48,7 @@
* A bit more expensive than the regular timers, but can be reset before they end and the time left can be checked.
*/

#define S_TIMER_COOLDOWN_START(cd_source, cd_index, cd_time) LAZYSET(cd_source.cooldowns, cd_index, addtimer(CALLBACK(GLOBAL_PROC, /proc/end_cooldown, cd_source, cd_index), cd_time, TIMER_STOPPABLE))
#define S_TIMER_COOLDOWN_START(cd_source, cd_index, cd_time) LAZYSET(cd_source.cooldowns, cd_index, addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(end_cooldown), cd_source, cd_index), cd_time, TIMER_STOPPABLE))

#define S_TIMER_COOLDOWN_RESET(cd_source, cd_index) reset_cooldown(cd_source, cd_index)

Expand Down
6 changes: 3 additions & 3 deletions code/__DEFINES/qdel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
#define QDELETED(X) (!X || QDELING(X))
#define QDESTROYING(X) (!X || X.gc_destroyed == GC_CURRENTLY_BEING_QDELETED)

#define QDEL_IN(item, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, (time) > GC_FILTER_QUEUE ? WEAKREF(item) : item), time, TIMER_STOPPABLE)
#define QDEL_IN_CLIENT_TIME(item, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, item), time, TIMER_STOPPABLE | TIMER_CLIENT_TIME)
#define QDEL_IN(item, time) addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), (time) > GC_FILTER_QUEUE ? WEAKREF(item) : item), time, TIMER_STOPPABLE)
#define QDEL_IN_CLIENT_TIME(item, time) addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), item), time, TIMER_STOPPABLE | TIMER_CLIENT_TIME)
#define QDEL_NULL(item) qdel(item); item = null
#define QDEL_LIST(L) if(L) { for(var/I in L) qdel(I); L.Cut(); }
#define QDEL_LIST_IN(L, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/______qdel_list_wrapper, L), time, TIMER_STOPPABLE)
#define QDEL_LIST_IN(L, time) addtimer(CALLBACK(GLOBAL_PROC, PROC_REF(______qdel_list_wrapper), L), time, TIMER_STOPPABLE)
#define QDEL_LIST_ASSOC(L) if(L) { for(var/I in L) { qdel(L[I]); qdel(I); } L.Cut(); }
#define QDEL_LIST_ASSOC_VAL(L) if(L) { for(var/I in L) qdel(L[I]); L.Cut(); }
9 changes: 8 additions & 1 deletion code/__DEFINES/rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
#define rustg_dmi_strip_metadata(fname) RUSTG_CALL(RUST_G, "dmi_strip_metadata")(fname)
#define rustg_dmi_create_png(path, width, height, data) RUSTG_CALL(RUST_G, "dmi_create_png")(path, width, height, data)
#define rustg_dmi_resize_png(path, width, height, resizetype) RUSTG_CALL(RUST_G, "dmi_resize_png")(path, width, height, resizetype)
/**
* input: must be a path, not an /icon; you have to do your own handling if it is one, as icon objects can't be directly passed to rustg.
*
* output: json_encode'd list. json_decode to get a flat list with icon states in the order they're in inside the .dmi
*/
#define rustg_dmi_icon_states(fname) RUSTG_CALL(RUST_G, "dmi_icon_states")(fname)

#define rustg_file_read(fname) RUSTG_CALL(RUST_G, "file_read")(fname)
#define rustg_file_exists(fname) RUSTG_CALL(RUST_G, "file_exists")(fname)
Expand Down Expand Up @@ -158,8 +164,9 @@
#define rustg_time_milliseconds(id) text2num(RUSTG_CALL(RUST_G, "time_milliseconds")(id))
#define rustg_time_reset(id) RUSTG_CALL(RUST_G, "time_reset")(id)

/// Returns the timestamp as a string
/proc/rustg_unix_timestamp()
return text2num(RUSTG_CALL(RUST_G, "unix_timestamp")())
return RUSTG_CALL(RUST_G, "unix_timestamp")()

#define rustg_raw_read_toml_file(path) json_decode(RUSTG_CALL(RUST_G, "toml_file_to_json")(path) || "null")

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/spaceman_dmm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
/world/Del()
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
call(debug_server, "auxtools_shutdown")()
LIBCALL(debug_server, "auxtools_shutdown")()
. = ..()
4 changes: 2 additions & 2 deletions code/__HELPERS/_extools_api.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GLOBAL_LIST_EMPTY(auxtools_initialized)

#define AUXTOOLS_CHECK(LIB)\
if (!GLOB.auxtools_initialized[LIB] && fexists(LIB)) {\
var/string = call(LIB,"auxtools_init")();\
var/string = LIBCALL(LIB,"auxtools_init")();\
if(findtext(string, "SUCCESS")) {\
GLOB.auxtools_initialized[LIB] = TRUE;\
} else {\
Expand All @@ -18,6 +18,6 @@ GLOBAL_LIST_EMPTY(auxtools_initialized)

#define AUXTOOLS_SHUTDOWN(LIB)\
if (GLOB.auxtools_initialized[LIB] && fexists(LIB)){\
call(LIB,"auxtools_shutdown")();\
LIBCALL(LIB,"auxtools_shutdown")();\
GLOB.auxtools_initialized[LIB] = FALSE;\
}\
2 changes: 1 addition & 1 deletion code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ block( \
/proc/flick_overlay(image/I, list/show_to, duration)
for(var/client/C in show_to)
C.images += I
addtimer(CALLBACK(GLOBAL_PROC, /proc/remove_images_from_clients, I, show_to), duration, TIMER_CLIENT_TIME)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(remove_images_from_clients), I, show_to), duration, TIMER_CLIENT_TIME)

/proc/flick_overlay_view(image/I, atom/target, duration) //wrapper for the above, flicks to everyone who can see the target atom
var/list/viewing = list()
Expand Down
15 changes: 15 additions & 0 deletions code/__HELPERS/nameof.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* NAMEOF: Compile time checked variable name to string conversion
* evaluates to a string equal to "X", but compile errors if X isn't a var on datum.
* datum may be null, but it does need to be a typed var.
**/
#define NAMEOF(datum, X) (#X || ##datum.##X)

/**
* NAMEOF that actually works in static definitions because src::type requires src to be defined
*/
#if DM_VERSION >= 515
#define NAMEOF_STATIC(datum, X) (nameof(type::##X))
#else
#define NAMEOF_STATIC(datum, X) (#X || ##datum.##X)
#endif
11 changes: 4 additions & 7 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1412,12 +1412,9 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
. = CB.Invoke()
usr = temp

//datum may be null, but it does need to be a typed var
#define NAMEOF(datum, X) (#X || ##datum.##X)

#define VARSET_LIST_CALLBACK(target, var_name, var_value) CALLBACK(GLOBAL_PROC, /proc/___callbackvarset, ##target, ##var_name, ##var_value)
#define VARSET_LIST_CALLBACK(target, var_name, var_value) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___callbackvarset), ##target, ##var_name, ##var_value)
//dupe code because dm can't handle 3 level deep macros
#define VARSET_CALLBACK(datum, var, var_value) CALLBACK(GLOBAL_PROC, /proc/___callbackvarset, ##datum, NAMEOF(##datum, ##var), ##var_value)
#define VARSET_CALLBACK(datum, var, var_value) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___callbackvarset), ##datum, NAMEOF(##datum, ##var), ##var_value)

/proc/___callbackvarset(list_or_datum, var_name, var_value)
if(length(list_or_datum))
Expand All @@ -1429,8 +1426,8 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
else
D.vars[var_name] = var_value

#define TRAIT_CALLBACK_ADD(target, trait, source) CALLBACK(GLOBAL_PROC, /proc/___TraitAdd, ##target, ##trait, ##source)
#define TRAIT_CALLBACK_REMOVE(target, trait, source) CALLBACK(GLOBAL_PROC, /proc/___TraitRemove, ##target, ##trait, ##source)
#define TRAIT_CALLBACK_ADD(target, trait, source) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___TraitAdd), ##target, ##trait, ##source)
#define TRAIT_CALLBACK_REMOVE(target, trait, source) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___TraitRemove), ##target, ##trait, ##source)

///DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
/proc/___TraitAdd(target,trait,source)
Expand Down
Loading