mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 18:51:53 +00:00
* Lazy Template Loading - Nukie/Wiz * fixes + mirror 66540 Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Co-authored-by: Paxilmaniac <paxilmaniac@gmail.com> Co-authored-by: John Doe <gamingskeleton3@gmail.com>
16 lines
541 B
Plaintext
16 lines
541 B
Plaintext
GLOBAL_LIST_INIT(lazy_templates, generate_lazy_template_map())
|
|
|
|
/**
|
|
* Iterates through all lazy template datums that exist and returns a list of them as an associative list of key -> instance.
|
|
*
|
|
* Screams if more than one key exists, loudly.
|
|
*/
|
|
/proc/generate_lazy_template_map()
|
|
. = list()
|
|
for(var/datum/lazy_template/template as anything in subtypesof(/datum/lazy_template))
|
|
var/key = initial(template.key)
|
|
if(key in .)
|
|
stack_trace("Found multiple lazy templates with the same key! '[key]'")
|
|
.[key] = new template
|
|
return .
|