Files
Yogstation/code/controllers/globals.dm
alexkar598 dab25cb5a6 Dreamchecker (#8977)
* Changes obj_break on machines to use parent calls (#46485)

The way stat |= BROKEN was done was a mess, this makes everywhere use obj_break with proper parent calls and adds a signal for when a machine enters the broken state.
Why It's Good For The Game

Better code quality, more signals.

* e

* Can pass refactor (#48659)

* Makes all CanPass procs call parent

* Makes CanPass more extendable and gives the mover a say in the matter

* Replace CanPass with CanAllowThrough to use the new system

Regex replace `(?<!proc)/CanPass\(` => `/CanAllowThrough(`

* Simple optimization pass

* Adds linting for equipped() pickup() dropped() (#46614)

* lint some inventory procs

* lineends

* f

*  line end

* lineend

* fuck

* changes per review

* does more

* Changes power_change() to respect parent calls for toggling NOPOWER (#46486)

About The Pull Request

Similar to #46485
Now all relevant uses of power_change() call parent, theres a signal sent when a machine changes the NOPOWER flag, all remaining machines that were using power_change() instead of update_icon() have been fixed.
Why It's Good For The Game

code quality, eventually signal stuff. and signal stuff

* Fix Crossed/Entered/Exited/Bump/ui_act parameter casting (#49016)

About The Pull Request

Detected as part of my work on SpaceManiac/SpacemanDMM#167

* Makes Crossed and Moved should call parent (#49671)

* makes setDir shouldcallparent (#49692)

* owo

* hehe

* Update atoms.dm

* Update atoms.dm

* Update atoms_movable.dm

Co-authored-by: spookydonut <github@spooksoftware.com>
Co-authored-by: alexkar598 <>
Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
2020-06-23 16:15:23 -04:00

57 lines
2.1 KiB
Plaintext

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
log_world("[vars.len - gvars_datum_in_built_vars.len] global variables")
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()
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)
stat("Globals:", statclick.update("Edit"))
/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!")