Files
fulpstation/code/__HELPERS/lazy_templates.dm
John Willard 7199947c08 [MDB IGNORE] [IDB IGNORE] WIP TGU (#1427)
Several months worth of updates.

---------

Co-authored-by: A miscellaneous Fern <80640114+FernandoJ8@users.noreply.github.com>
Co-authored-by: Pepsilawn <reisenrui@gmail.com>
Co-authored-by: Ray <64306407+OneAsianTortoise@users.noreply.github.com>
Co-authored-by: Cure221 <106662180+Cure221@users.noreply.github.com>
2025-11-06 08:20:20 -05:00

18 lines
642 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) // some subtypes like basketball and deathmatch have a base datum with no key
continue
if(key in .)
stack_trace("Found multiple lazy templates with the same key! '[key]'")
.[key] = new template
return .