From a4602450ee35dbb73f12bb5cd4bb9d439f15ad68 Mon Sep 17 00:00:00 2001 From: igorsaux Date: Wed, 27 Dec 2023 03:39:06 +0300 Subject: [PATCH] tweak(think): _think_ctxs lazy initialization --- code/datums/datum.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 77dbec31a49..ccf9b3ab4a9 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -11,7 +11,7 @@ var/list/signal_procs = list() // Thinking - var/list/_think_ctxs = list() + var/list/_think_ctxs var/datum/think_context/_main_think_ctx #ifdef TESTING @@ -137,6 +137,8 @@ /// * `clbk` - a proc which should be called. /// * `time` - when to call the context. /datum/proc/add_think_ctx(name, datum/callback/clbk, time) + LAZYINITLIST(_think_ctxs) + if(!QDELETED(_think_ctxs[name])) CRASH("Thinking context [name] is exists")