From 0422a46fbb97310b443bcd35129315cc0d278b5e Mon Sep 17 00:00:00 2001 From: Remie Richards Date: Sun, 19 Jun 2016 00:40:04 +0100 Subject: [PATCH 1/2] You can now call global procs with addtimer(), by supplying the object as GLOBAL_PROC, a special define that tells the timing subsystem to use a different call()() syntax (the syntax that supports global procs) --- code/__DEFINES/MC.dm | 3 +++ code/controllers/subsystem/timer.dm | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/MC.dm b/code/__DEFINES/MC.dm index 0ad8559ffb7..2b38b33807c 100644 --- a/code/__DEFINES/MC.dm +++ b/code/__DEFINES/MC.dm @@ -41,3 +41,6 @@ // This flag overrides SS_KEEP_TIMING #define SS_POST_FIRE_TIMING 128 + +//Timing subsystem +#define GLOBAL_PROC "some_magic_bullshit" \ No newline at end of file diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index d82f0fcf180..d7a16a4f094 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -36,7 +36,10 @@ var/datum/subsystem/timer/SStimer /datum/subsystem/timer/proc/runevent(datum/timedevent/event) set waitfor = 0 - call(event.thingToCall, event.procToCall)(arglist(event.argList)) + if(event.thingToCall == GLOBAL_PROC) + call("/proc/[event.procToCall]")(arglist(event.argList)) + else + call(event.thingToCall, event.procToCall)(arglist(event.argList)) /datum/subsystem/timer/Recover() processing |= SStimer.processing @@ -97,4 +100,4 @@ var/datum/subsystem/timer/SStimer if(event.id == id) qdel(event) return 1 - return 0 \ No newline at end of file + return 0 From b0634d3227abf30d823c552c2b2d565551610a33 Mon Sep 17 00:00:00 2001 From: Remie Richards Date: Mon, 20 Jun 2016 23:06:51 +0100 Subject: [PATCH 2/2] istext() check on procToCall --- code/controllers/subsystem/timer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index d7a16a4f094..36f8b41bbe8 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -36,7 +36,7 @@ var/datum/subsystem/timer/SStimer /datum/subsystem/timer/proc/runevent(datum/timedevent/event) set waitfor = 0 - if(event.thingToCall == GLOBAL_PROC) + if(event.thingToCall == GLOBAL_PROC && istext(event.procToCall)) call("/proc/[event.procToCall]")(arglist(event.argList)) else call(event.thingToCall, event.procToCall)(arglist(event.argList))