Files
Bubberstation/code/__HELPERS/lazy_templates.dm
SkyratBot 00e22c3158 [MIRROR] Lazy Template Loading - Nukie/Wiz [MDB IGNORE] (#18254)
* 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>
2022-12-31 10:18:59 -08:00

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 .