From e806fcd11cf8db862f0460175d47e270d0d8be1f Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 14 Feb 2017 14:04:13 -0500 Subject: [PATCH] Adds option of unique timers ignoring wait --- code/__DEFINES/MC.dm | 3 +++ code/controllers/subsystem/timer.dm | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/MC.dm b/code/__DEFINES/MC.dm index c211b98d434..86c43d15907 100644 --- a/code/__DEFINES/MC.dm +++ b/code/__DEFINES/MC.dm @@ -64,3 +64,6 @@ #define TIMER_CLIENT_TIME 0x4 //Timer can be stopped using deltimer() #define TIMER_STOPPABLE 0x8 +//To be used with TIMER_UNIQUE +//prevents distinguishing identical timers with the wait variable +#define TIMER_NO_HASH_WAIT 0x10 \ No newline at end of file diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index 91f7dd5b557..af40108a7a4 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -299,7 +299,11 @@ proc/addtimer(datum/callback/callback, wait, flags) var/hash if (flags & TIMER_UNIQUE) - var/list/hashlist = list(callback.object, "(\ref[callback.object])", callback.delegate, wait, flags & TIMER_CLIENT_TIME) + var/list/hashlist + if(flags & TIMER_NO_HASH_WAIT) + hashlist = list(callback.object, "(\ref[callback.object])", callback.delegate, flags & TIMER_CLIENT_TIME) + else + hashlist = list(callback.object, "(\ref[callback.object])", callback.delegate, wait, flags & TIMER_CLIENT_TIME) hashlist += callback.arguments hash = hashlist.Join("|||||||")