mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-28 18:21:51 +00:00
What it says on the can; now we can better compensate for processing spikes by queueing and accounting for verb times (assuming we actually use this framework to invoke the bulk of them). I have added its use to some of them, more can be ported as time goes on, eventually everything but the most trivial ones should go through this. No player facing changes. Hopefully. Praise be the omnissiah.
25 lines
900 B
Plaintext
25 lines
900 B
Plaintext
#define GLOBAL_PROC "some_magic_bullshit"
|
|
/// A shorthand for the callback datum, [documented here](datum/callback.html)
|
|
#define CALLBACK new /datum/callback
|
|
|
|
///Per the DM reference, spawn(-1) will execute the spawned code immediately until a block is met.
|
|
#define MAKE_SPAWN_ACT_LIKE_WAITFOR -1
|
|
///Create a codeblock that will not block the callstack if a block is met.
|
|
#define ASYNC spawn(MAKE_SPAWN_ACT_LIKE_WAITFOR)
|
|
|
|
#define INVOKE_ASYNC(proc_owner, proc_path, proc_arguments...) \
|
|
if ((proc_owner) == GLOBAL_PROC) { \
|
|
ASYNC { \
|
|
call(proc_path)(##proc_arguments); \
|
|
}; \
|
|
} \
|
|
else { \
|
|
ASYNC { \
|
|
/* Written with `0 ||` to avoid the compiler seeing call("string"), and thinking it's a deprecated DLL */ \
|
|
call(0 || proc_owner, proc_path)(##proc_arguments); \
|
|
}; \
|
|
}
|
|
|
|
/// like CALLBACK but specifically for verb callbacks
|
|
#define VERB_CALLBACK new /datum/callback/verb_callback
|