mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-18 21:53:22 +00:00
* World Initialization Refactor * Update .github/CODEOWNERS * Update code/__HELPERS/global_lists.dm * Add logging for manually changing your targeted zone (#72814) See title. Surgery hud is exempt from this. Requested by @Mothblocks Signed-off-by: GitHub <noreply@github.com> Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: dragomagol <66640614+dragomagol@users.noreply.github.com> * eee * Update tgstation.dme --------- Signed-off-by: GitHub <noreply@github.com> Co-authored-by: Jordan Dominion <Cyberboss@users.noreply.github.com> Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com> Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: dragomagol <66640614+dragomagol@users.noreply.github.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
// See initialization order in /code/game/world.dm
|
|
GLOBAL_REAL(GLOB, /datum/controller/global_vars)
|
|
|
|
/datum/controller/global_vars
|
|
name = "Global Variables"
|
|
|
|
var/static/list/gvars_datum_protected_varlist
|
|
var/list/gvars_datum_in_built_vars
|
|
var/list/gvars_datum_init_order
|
|
|
|
/datum/controller/global_vars/New()
|
|
if(GLOB)
|
|
CRASH("Multiple instances of global variable controller created")
|
|
GLOB = src
|
|
|
|
var/datum/controller/exclude_these = new
|
|
gvars_datum_in_built_vars = exclude_these.vars + list(NAMEOF(src, gvars_datum_protected_varlist), NAMEOF(src, gvars_datum_in_built_vars), NAMEOF(src, gvars_datum_init_order))
|
|
QDEL_IN(exclude_these, 0) //signal logging isn't ready
|
|
|
|
Initialize()
|
|
|
|
/datum/controller/global_vars/Destroy(force)
|
|
// This is done to prevent an exploit where admins can get around protected vars
|
|
SHOULD_CALL_PARENT(FALSE)
|
|
return QDEL_HINT_IWILLGC
|
|
|
|
/datum/controller/global_vars/stat_entry(msg)
|
|
msg = "Edit"
|
|
return msg
|
|
|
|
/datum/controller/global_vars/vv_edit_var(var_name, var_value)
|
|
if(gvars_datum_protected_varlist[var_name])
|
|
return FALSE
|
|
return ..()
|
|
|
|
/datum/controller/global_vars/Initialize()
|
|
gvars_datum_init_order = list()
|
|
gvars_datum_protected_varlist = list(NAMEOF(src, gvars_datum_protected_varlist) = TRUE)
|
|
var/list/global_procs = typesof(/datum/controller/global_vars/proc)
|
|
var/expected_len = vars.len - gvars_datum_in_built_vars.len
|
|
if(global_procs.len != expected_len)
|
|
warning("Unable to detect all global initialization procs! Expected [expected_len] got [global_procs.len]!")
|
|
if(global_procs.len)
|
|
var/list/expected_global_procs = vars - gvars_datum_in_built_vars
|
|
for(var/I in global_procs)
|
|
expected_global_procs -= replacetext("[I]", "InitGlobal", "")
|
|
log_world("Missing procs: [expected_global_procs.Join(", ")]")
|
|
|
|
for(var/I in global_procs)
|
|
var/start_tick = world.time
|
|
call(src, I)()
|
|
var/end_tick = world.time
|
|
if(end_tick - start_tick)
|
|
warning("Global [replacetext("[I]", "InitGlobal", "")] slept during initialization!")
|
|
|
|
// Someone make it so this call isn't necessary
|
|
make_datum_reference_lists()
|
|
|