diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index 61760711f75..433699ce331 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -6,11 +6,13 @@ var/datum/subsystem/timer/SStimer priority = 1 var/list/datum/timedevent/processing + var/list/hashes /datum/subsystem/timer/New() NEW_SS_GLOBAL(SStimer) processing = list() + hashes = list() /datum/subsystem/timer/stat_entry(msg) @@ -34,6 +36,7 @@ var/datum/subsystem/timer/SStimer var/timeToRun var/argList var/id + var/hash var/static/nextid = 1 /datum/timedevent/New() @@ -42,9 +45,10 @@ var/datum/subsystem/timer/SStimer /datum/timedevent/Destroy() SStimer.processing -= src + SStimer.hashes -= src.hash return ..() -/proc/addtimer(thingToCall, procToCall, wait, ...) +/proc/addtimer(thingToCall, procToCall, wait, unique = FALSE, ...) if (!SStimer) //can't run timers before the mc has been created return if (!thingToCall || !procToCall || wait <= 0) @@ -57,11 +61,17 @@ var/datum/subsystem/timer/SStimer event.thingToCall = thingToCall event.procToCall = procToCall event.timeToRun = world.time + wait + event.hash = list2text(args) if (args.len > 3) event.argList = args.Copy(4) + // Check for dupes if unique = 1. + if(unique) + if(event.hash in SStimer.hashes) + return + // If we are unique (or we're not checking that), add the timer and return the id. SStimer.processing += event - + SStimer.hashes += event.hash return event.id /proc/deltimer(id) diff --git a/code/game/gamemodes/handofgod/god.dm b/code/game/gamemodes/handofgod/god.dm index 7335151df37..f69c44fdeb9 100644 --- a/code/game/gamemodes/handofgod/god.dm +++ b/code/game/gamemodes/handofgod/god.dm @@ -31,7 +31,7 @@ //Force nexuses after 2 minutes in hand of god mode if(ticker && ticker.mode && ticker.mode.name == "hand of god") - addtimer(src,"forceplacenexus",1200) + addtimer(src, "forceplacenexus", 1200, FALSE) ghostimage = image(src.icon,src,src.icon_state) ghost_darkness_images |= ghostimage diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index a7088aa0606..8b1269d8883 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -255,7 +255,7 @@ var/global/datum/crewmonitor/crewmonitor = new return ..() /datum/crewmonitor/proc/queueUpdate(z) - addtimer(crewmonitor, "update", 5, z) + addtimer(crewmonitor, "update", 5, TRUE, z) /datum/crewmonitor/proc/generateMiniMaps() for(var/z = 1 to world.maxz) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 031f6b802b2..933cce1d3be 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -94,6 +94,7 @@ /obj/attack_ghost(mob/user) ui_interact(user) + ..() /obj/proc/interact(mob/user) return diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 46cbc8a85cf..e7e89f2f8e4 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -87,7 +87,7 @@ //remove our adminhelp verb temporarily to prevent spamming of admins. src.verbs -= /client/verb/adminhelp - adminhelptimerid = addtimer(src,"giveadminhelpverb",1200) //2 minute cooldown of admin helps + adminhelptimerid = addtimer(src, "giveadminhelpverb", 1200, FALSE) //2 minute cooldown of admin helps msg = keywords_lookup(msg)