diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm
index 74cef7a172..28391c4352 100644
--- a/code/ATMOSPHERICS/datum_pipeline.dm
+++ b/code/ATMOSPHERICS/datum_pipeline.dm
@@ -10,7 +10,7 @@ datum/pipeline
var/alert_pressure = 0
Destroy()
- qdel_null(network)
+ QDEL_NULL(network)
if(air && air.volume)
temporarily_store_air()
@@ -204,16 +204,16 @@ datum/pipeline
proc/radiate_heat_to_space(surface, thermal_conductivity)
var/gas_density = air.total_moles/air.volume
thermal_conductivity *= min(gas_density / ( RADIATOR_OPTIMUM_PRESSURE/(R_IDEAL_GAS_EQUATION*GAS_CRITICAL_TEMPERATURE) ), 1) //mult by density ratio
-
+
// We only get heat from the star on the exposed surface area.
// If the HE pipes gain more energy from AVERAGE_SOLAR_RADIATION than they can radiate, then they have a net heat increase.
var/heat_gain = AVERAGE_SOLAR_RADIATION * (RADIATOR_EXPOSED_SURFACE_AREA_RATIO * surface) * thermal_conductivity
-
+
// Previously, the temperature would enter equilibrium at 26C or 294K.
// Only would happen if both sides (all 2 square meters of surface area) were exposed to sunlight. We now assume it aligned edge on.
// It currently should stabilise at 129.6K or -143.6C
heat_gain -= surface * STEFAN_BOLTZMANN_CONSTANT * thermal_conductivity * (air.temperature - COSMIC_RADIATION_TEMPERATURE) ** 4
-
+
air.add_thermal_energy(heat_gain)
if(network)
network.update = 1
diff --git a/code/ATMOSPHERICS/pipes/pipe_base.dm b/code/ATMOSPHERICS/pipes/pipe_base.dm
index 9d0667f79e..a035857e54 100644
--- a/code/ATMOSPHERICS/pipes/pipe_base.dm
+++ b/code/ATMOSPHERICS/pipes/pipe_base.dm
@@ -72,7 +72,7 @@
return parent.return_network(reference)
/obj/machinery/atmospherics/pipe/Destroy()
- qdel_null(parent)
+ QDEL_NULL(parent)
if(air_temporary)
loc.assume_air(air_temporary)
for(var/obj/machinery/meter/meter in loc)
diff --git a/code/__datastructures/globals.dm b/code/__datastructures/globals.dm
new file mode 100644
index 0000000000..637af7f0fc
--- /dev/null
+++ b/code/__datastructures/globals.dm
@@ -0,0 +1,38 @@
+//See controllers/globals.dm
+#define GLOBAL_MANAGED(X, InitValue)\
+/datum/controller/global_vars/proc/InitGlobal##X(){\
+ ##X = ##InitValue;\
+ gvars_datum_init_order += #X;\
+}
+#define GLOBAL_UNMANAGED(X, InitValue) /datum/controller/global_vars/proc/InitGlobal##X()
+
+#ifndef TESTING
+#define GLOBAL_PROTECT(X)\
+/datum/controller/global_vars/InitGlobal##X(){\
+ ..();\
+ gvars_datum_protected_varlist += #X;\
+}
+#else
+#define GLOBAL_PROTECT(X)
+#endif
+
+#define GLOBAL_REAL_VAR(X) var/global/##X
+#define GLOBAL_REAL(X, Typepath) var/global##Typepath/##X
+
+#define GLOBAL_RAW(X) /datum/controller/global_vars/var/global##X
+
+#define GLOBAL_VAR_INIT(X, InitValue) GLOBAL_RAW(/##X); GLOBAL_MANAGED(X, InitValue)
+
+#define GLOBAL_VAR_CONST(X, InitValue) GLOBAL_RAW(/const/##X) = InitValue; GLOBAL_UNMANAGED(X, InitValue)
+
+#define GLOBAL_LIST_INIT(X, InitValue) GLOBAL_RAW(/list/##X); GLOBAL_MANAGED(X, InitValue)
+
+#define GLOBAL_LIST_EMPTY(X) GLOBAL_LIST_INIT(X, list())
+
+#define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue)
+
+#define GLOBAL_VAR(X) GLOBAL_RAW(/##X); GLOBAL_MANAGED(X, null)
+
+#define GLOBAL_LIST(X) GLOBAL_RAW(/list/##X); GLOBAL_MANAGED(X, null)
+
+#define GLOBAL_DATUM(X, Typepath) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, null)
diff --git a/code/__defines/MC.dm b/code/__defines/MC.dm
index 1d41a31209..ad03630666 100644
--- a/code/__defines/MC.dm
+++ b/code/__defines/MC.dm
@@ -1,14 +1,15 @@
-#define MC_TICK_CHECK ( ( TICK_USAGE > Master.current_ticklimit || src.state != SS_RUNNING ) ? pause() : 0 )
+#define MC_TICK_CHECK ( ( TICK_USAGE > GLOB.CURRENT_TICKLIMIT || src.state != SS_RUNNING ) ? pause() : 0 )
// Used for splitting up your remaining time into phases, if you want to evenly divide it.
-#define MC_SPLIT_TICK_INIT(phase_count) var/original_tick_limit = Master.current_ticklimit; var/split_tick_phases = ##phase_count
+#define MC_SPLIT_TICK_INIT(phase_count) var/original_tick_limit = GLOB.CURRENT_TICKLIMIT; var/split_tick_phases = ##phase_count
+
#define MC_SPLIT_TICK \
- if(split_tick_phases > 1){\
- Master.current_ticklimit = ((original_tick_limit - TICK_USAGE) / split_tick_phases) + TICK_USAGE;\
- --split_tick_phases;\
- } else {\
- Master.current_ticklimit = original_tick_limit;\
- }
+ if(split_tick_phases > 1){\
+ GLOB.CURRENT_TICKLIMIT = ((original_tick_limit - world.tick_usage) / split_tick_phases) + world.tick_usage;\
+ --split_tick_phases;\
+ } else {\
+ GLOB.CURRENT_TICKLIMIT = original_tick_limit;\
+ }
// Boilerplate code for multi-step processors. See machines.dm for example use.
#define INTERNAL_PROCESS_STEP(this_step, initial_step, proc_to_call, cost_var, next_step)\
@@ -78,9 +79,15 @@ if(current_step == this_step || (initial_step && !resumed)) /* So we start at st
#define SS_PAUSING 5 //in the middle of pausing
// Standard way to define a global subsystem, keep boilerplate organized here!
-#define SUBSYSTEM_DEF(X) var/datum/controller/subsystem/##X/SS##X;\
+#define SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/##X);\
/datum/controller/subsystem/##X/New(){\
NEW_SS_GLOBAL(SS##X);\
PreInit();\
}\
/datum/controller/subsystem/##X
+ #define PROCESSING_SUBSYSTEM_DEF(X) GLOBAL_REAL(SS##X, /datum/controller/subsystem/processing/##X);\
+/datum/controller/subsystem/processing/##X/New(){\
+ NEW_SS_GLOBAL(SS##X);\
+ PreInit();\
+}\
+/datum/controller/subsystem/processing/##X
\ No newline at end of file
diff --git a/code/__defines/_tick.dm b/code/__defines/_tick.dm
index 2c761b86f9..7ca3fb23a2 100644
--- a/code/__defines/_tick.dm
+++ b/code/__defines/_tick.dm
@@ -3,7 +3,7 @@
#define TICK_LIMIT_MC 70
#define TICK_LIMIT_MC_INIT_DEFAULT 98
-#define TICK_CHECK ( TICK_USAGE > Master.current_ticklimit )
+#define TICK_CHECK ( TICK_USAGE > GLOB.CURRENT_TICKLIMIT )
#define CHECK_TICK if TICK_CHECK stoplag()
#define TICK_USAGE world.tick_usage
diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm
index c76bb80440..17c3ab8923 100644
--- a/code/__defines/subsystems.dm
+++ b/code/__defines/subsystems.dm
@@ -1,3 +1,18 @@
+//Timing subsystem
+//Don't run if there is an identical unique timer active
+#define TIMER_UNIQUE 0x1
+//For unique timers: Replace the old timer rather then not start this one
+#define TIMER_OVERRIDE 0x2
+//Timing should be based on how timing progresses on clients, not the sever.
+// tracking this is more expensive,
+// should only be used in conjuction with things that have to progress client side, such as animate() or sound()
+#define TIMER_CLIENT_TIME 0x4
+//Timer can be stopped using deltimer()
+#define TIMER_STOPPABLE 0x8
+//To be used with TIMER_UNIQUE
+//prevents distinguishing identical timers with the wait variable
+#define TIMER_NO_HASH_WAIT 0x10
+#define TIMER_NO_INVOKE_WARNING 600 //number of byond ticks that are allowed to pass before the timer subsystem thinks it hung on something
#define INITIALIZATION_INSSATOMS 0 //New should not call Initialize
#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
@@ -7,6 +22,15 @@
#define INITIALIZE_HINT_LATELOAD 1 //Call LateInitialize
#define INITIALIZE_HINT_QDEL 2 //Call qdel on the atom
+//type and all subtypes should always call Initialize in New()
+#define INITIALIZE_IMMEDIATE(X) ##X/New(loc, ...){\
+ ..();\
+ if(!initialized) {\
+ args[1] = TRUE;\
+ SSatoms.InitAtom(src, args);\
+ }\
+}
+
// SS runlevels
#define RUNLEVEL_INIT 0 // "Initialize Only" - Used for subsystems that should never be fired (Should also have SS_NO_FIRE set)
diff --git a/code/_global_vars/lists/mapping.dm b/code/_global_vars/lists/mapping.dm
new file mode 100644
index 0000000000..42e6f1baf3
--- /dev/null
+++ b/code/_global_vars/lists/mapping.dm
@@ -0,0 +1,32 @@
+GLOBAL_LIST_INIT(cardinal, list(NORTH, SOUTH, EAST, WEST))
+GLOBAL_LIST_INIT(cardinalz, list(NORTH, SOUTH, EAST, WEST, UP, DOWN))
+GLOBAL_LIST_INIT(cornerdirs, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST))
+GLOBAL_LIST_INIT(cornerdirsz, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST, NORTH|UP, EAST|UP, WEST|UP, SOUTH|UP, NORTH|DOWN, EAST|DOWN, WEST|DOWN, SOUTH|DOWN))
+GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST))
+GLOBAL_LIST_INIT(reverse_dir, list( // reverse_dir[dir] = reverse of dir
+ 2, 1, 3, 8, 10, 9, 11, 4, 6, 5, 7, 12, 14, 13, 15,
+ 32, 34, 33, 35, 40, 42, 41, 43, 36, 38, 37, 39, 44, 46, 45, 47,
+ 16, 18, 17, 19, 24, 26, 25, 27, 20, 22, 21, 23, 28, 30, 29, 31,
+ 48, 50, 49, 51, 56, 58, 57, 59, 52, 54, 53, 55, 60, 62, 61, 63
+))
+
+GLOBAL_LIST_INIT(flip_dir, list( // flip_dir[dir] = 180 degree rotation of dir. Unlike reverse_dir, UP remains UP & DOWN remains DOWN.
+ 2, 1, 3, 8, 10, 9, 11, 4, 6, 5, 7, 12, 14, 13, 15,
+ 16, 18, 17, 19, 24, 26, 25, 27, 20, 22, 21, 23, 28, 30, 29, 31, // UP - Same as first line but +16
+ 32, 34, 33, 35, 40, 42, 41, 43, 36, 38, 37, 39, 44, 46, 45, 47, // DOWN - Same as first line but +32
+ 48, 50, 49, 51, 56, 58, 57, 59, 52, 54, 53, 55, 60, 62, 61, 63 // UP+DOWN - Same as first line but +48
+))
+
+GLOBAL_LIST_INIT(cw_dir, list( // cw_dir[dir] = clockwise rotation of dir. Unlike reverse_dir, UP remains UP & DOWN remains DOWN.
+ 4, 8, 12, 2, 6, 10, 14, 1, 5, 9, 13, 3, 7, 11, 15,
+ 16, 20, 24, 28, 18, 22, 26, 30, 17, 21, 25, 19, 29, 23, 27, 31, // UP - Same as first line but +16
+ 32, 36, 40, 44, 34, 38, 42, 46, 33, 37, 41, 45, 35, 39, 43, 47, // DOWN - Same as first line but +32
+ 48, 52, 56, 40, 50, 54, 58, 62, 49, 53, 57, 61, 51, 55, 59, 63 // UP+DOWN - Same as first line but +48
+))
+
+GLOBAL_LIST_INIT(cww_dir, list( // cww_dir[dir] = counter-clockwise rotation of dir. Unlike reverse_dir, UP remains UP & DOWN remains DOWN.
+ 8, 4, 12, 1, 9, 5, 13, 2, 10, 6, 14, 3, 11, 7, 15,
+ 16, 24, 20, 28, 17, 25, 21, 29, 18, 26, 22, 30, 19, 27, 23, 31, // UP - Same as first line but +16
+ 32, 40, 36, 44, 33, 41, 37, 45, 34, 42, 38, 46, 35, 43, 39, 47, // DOWN - Same as first line but +32
+ 48, 56, 52, 60, 49, 57, 53, 61, 50, 58, 54, 62, 51, 59, 55, 63 // UP+DOWN - Same as first line but +48
+))
diff --git a/code/_global_vars/misc.dm b/code/_global_vars/misc.dm
new file mode 100644
index 0000000000..de2779c45b
--- /dev/null
+++ b/code/_global_vars/misc.dm
@@ -0,0 +1 @@
+GLOBAL_LIST_EMPTY(all_observable_events)
\ No newline at end of file
diff --git a/code/_global_vars/mobs.dm b/code/_global_vars/mobs.dm
new file mode 100644
index 0000000000..7fa2b5d162
--- /dev/null
+++ b/code/_global_vars/mobs.dm
@@ -0,0 +1,2 @@
+GLOBAL_LIST_EMPTY(admins) //all clients whom are admins
+GLOBAL_PROTECT(admins)
\ No newline at end of file
diff --git a/code/_global_vars/sensitive.dm b/code/_global_vars/sensitive.dm
new file mode 100644
index 0000000000..d4eda095ad
--- /dev/null
+++ b/code/_global_vars/sensitive.dm
@@ -0,0 +1,11 @@
+// MySQL configuration
+GLOBAL_REAL_VAR(sqladdress) = "localhost"
+GLOBAL_REAL_VAR(sqlport) = "3306"
+GLOBAL_REAL_VAR(sqldb) = "tgstation"
+GLOBAL_REAL_VAR(sqllogin) = "root"
+GLOBAL_REAL_VAR(sqlpass) = ""
+// Feedback gathering sql connection
+GLOBAL_REAL_VAR(sqlfdbkdb) = "test"
+GLOBAL_REAL_VAR(sqlfdbklogin) = "root"
+GLOBAL_REAL_VAR(sqlfdbkpass) = ""
+GLOBAL_REAL_VAR(sqllogging) = 0 // Should we log deaths, population stats, etc.?
\ No newline at end of file
diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm
index 03f334b252..a9ac87e4aa 100644
--- a/code/_helpers/game.dm
+++ b/code/_helpers/game.dm
@@ -543,7 +543,7 @@ datum/projectile_data
/proc/getOPressureDifferential(var/turf/loc)
var/minp=16777216;
var/maxp=0;
- for(var/dir in cardinal)
+ for(var/dir in GLOB.cardinal)
var/turf/simulated/T=get_turf(get_step(loc,dir))
var/cp=0
if(T && istype(T) && T.zone)
@@ -564,7 +564,7 @@ datum/projectile_data
/proc/getCardinalAirInfo(var/turf/loc, var/list/stats=list("temperature"))
var/list/temps = new/list(4)
- for(var/dir in cardinal)
+ for(var/dir in GLOB.cardinal)
var/direction
switch(dir)
if(NORTH)
diff --git a/code/_helpers/time.dm b/code/_helpers/time.dm
index 58348761f8..f75802eb45 100644
--- a/code/_helpers/time.dm
+++ b/code/_helpers/time.dm
@@ -135,6 +135,6 @@ var/round_start_time = 0
. += CEILING(i*DELTA_CALC, 1)
sleep(i*world.tick_lag*DELTA_CALC)
i *= 2
- while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit))
+ while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, GLOB.CURRENT_TICKLIMIT))
#undef DELTA_CALC
\ No newline at end of file
diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm
index 5b2cd11bd7..91720600dd 100644
--- a/code/_helpers/unsorted.dm
+++ b/code/_helpers/unsorted.dm
@@ -1427,3 +1427,6 @@ var/mob/dview/dview_mob = new
return "Northwest"
if(337.5)
return "North-Northwest"
+
+/proc/pass()
+ return
\ No newline at end of file
diff --git a/code/_macros.dm b/code/_macros.dm
index efd1e72edd..d8737d8d26 100644
--- a/code/_macros.dm
+++ b/code/_macros.dm
@@ -65,9 +65,9 @@
#define CanInteract(user, state) (CanUseTopic(user, state) == STATUS_INTERACTIVE)
-#define qdel_null_list(x) if(x) { for(var/y in x) { qdel(y) } ; x = null }
+#define QDEL_NULL_LIST(x) if(x) { for(var/y in x) { qdel(y) } ; x = null }
-#define qdel_null(x) if(x) { qdel(x) ; x = null }
+#define QDEL_NULL(x) if(x) { qdel(x) ; x = null }
#define ARGS_DEBUG log_debug("[__FILE__] - [__LINE__]") ; for(var/arg in args) { log_debug("\t[log_info_line(arg)]") }
diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action.dm
index 7e03151fd6..2b29fa6492 100644
--- a/code/_onclick/hud/action.dm
+++ b/code/_onclick/hud/action.dm
@@ -31,7 +31,7 @@
if(owner)
Remove(owner)
target = null
- qdel_null(button)
+ QDEL_NULL(button)
return ..()
/datum/action/proc/Grant(mob/living/T)
@@ -48,7 +48,7 @@
if(button)
if(T.client)
T.client.screen -= button
- qdel_null(button)
+ QDEL_NULL(button)
T.actions.Remove(src)
T.update_action_buttons()
owner = null
diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm
index 26c1680421..229e717e45 100644
--- a/code/_onclick/telekinesis.dm
+++ b/code/_onclick/telekinesis.dm
@@ -154,7 +154,7 @@ var/const/tk_maxrange = 15
O.anchored = 1
O.density = 0
O.layer = FLY_LAYER
- O.set_dir(pick(cardinal))
+ O.set_dir(pick(GLOB.cardinal))
O.icon = 'icons/effects/effects.dmi'
O.icon_state = "nothing"
flick("empdisable",O)
diff --git a/code/controllers/Processes/nanoui.dm b/code/controllers/Processes/nanoui.dm
index 21d2f8e5f0..0f720600bc 100644
--- a/code/controllers/Processes/nanoui.dm
+++ b/code/controllers/Processes/nanoui.dm
@@ -4,10 +4,10 @@
/datum/controller/process/nanoui/statProcess()
..()
- stat(null, "[nanomanager.processing_uis.len] UIs")
+ stat(null, "[GLOB.nanomanager.processing_uis.len] UIs")
/datum/controller/process/nanoui/doWork()
- for(last_object in nanomanager.processing_uis)
+ for(last_object in GLOB.nanomanager.processing_uis)
var/datum/nanoui/NUI = last_object
if(istype(NUI) && !QDELETED(NUI))
try
@@ -16,4 +16,4 @@
catchException(e, NUI)
else
catchBadType(NUI)
- nanomanager.processing_uis -= NUI
\ No newline at end of file
+ GLOB.nanomanager.processing_uis -= NUI
\ No newline at end of file
diff --git a/code/controllers/globals.dm b/code/controllers/globals.dm
new file mode 100644
index 0000000000..fa7b917194
--- /dev/null
+++ b/code/controllers/globals.dm
@@ -0,0 +1,59 @@
+GLOBAL_REAL(GLOB, /datum/controller/global_vars)
+
+/datum/controller/global_vars
+ name = "Global Variables"
+
+ var/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("gvars_datum_protected_varlist", "gvars_datum_in_built_vars", "gvars_datum_init_order")
+
+ log_world("[vars.len - gvars_datum_in_built_vars.len] global variables")
+
+ Initialize(exclude_these)
+
+/datum/controller/global_vars/Destroy(force)
+ crash_with("There was an attempt to qdel the global vars holder!")
+ if(!force)
+ return QDEL_HINT_LETMELIVE
+
+ QDEL_NULL(statclick)
+ gvars_datum_protected_varlist.Cut()
+ gvars_datum_in_built_vars.Cut()
+
+ GLOB = null
+
+ return ..()
+
+/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_hidden()
+ return ..() + gvars_datum_protected_varlist
+
+/datum/controller/global_vars/Initialize(var/exclude_these)
+ gvars_datum_init_order = list()
+ gvars_datum_protected_varlist = list("gvars_datum_protected_varlist")
+
+ //See https://github.com/tgstation/tgstation/issues/26954
+ for(var/I in typesof(/datum/controller/global_vars/proc))
+ var/CLEANBOT_RETURNS = "[I]"
+ pass(CLEANBOT_RETURNS)
+
+ for(var/I in (vars - gvars_datum_in_built_vars))
+ var/start_tick = world.time
+ call(src, "InitGlobal[I]")()
+ var/end_tick = world.time
+ if(end_tick - start_tick)
+ warning("Global [I] slept during initialization!")
+ QDEL_NULL(exclude_these)
\ No newline at end of file
diff --git a/code/controllers/master.dm b/code/controllers/master.dm
index 997e0fd3e0..050251fb0d 100644
--- a/code/controllers/master.dm
+++ b/code/controllers/master.dm
@@ -6,7 +6,21 @@
* Odds are, there is a reason
*
**/
-var/datum/controller/master/Master = new()
+
+//This is the ABSOLUTE ONLY THING that should init globally like this
+GLOBAL_REAL(Master, /datum/controller/master) = new
+
+//THIS IS THE INIT ORDER
+//Master -> SSPreInit -> GLOB -> world -> config -> SSInit -> Failsafe
+//GOT IT MEMORIZED?
+GLOBAL_VAR_INIT(MC_restart_clear, 0)
+GLOBAL_VAR_INIT(MC_restart_timeout, 0)
+GLOBAL_VAR_INIT(MC_restart_count, 0)
+
+//current tick limit, assigned by the queue controller before running a subsystem.
+//used by check_tick as well so that the procs subsystems call can obey that SS's tick limits
+GLOBAL_VAR_INIT(CURRENT_TICKLIMIT, TICK_LIMIT_RUNNING)
+
/datum/controller/master
name = "Master"
@@ -48,10 +62,6 @@ var/datum/controller/master/Master = new()
var/static/restart_timeout = 0
var/static/restart_count = 0
- //current tick limit, assigned before running a subsystem.
- //used by CHECK_TICK as well so that the procs subsystems call can obey that SS's tick limits
- var/static/current_ticklimit = TICK_LIMIT_RUNNING
-
/datum/controller/master/New()
// Highlander-style: there can only be one! Kill off the old and replace it with the new.
var/list/_subsystems = list()
@@ -67,6 +77,9 @@ var/datum/controller/master/Master = new()
_subsystems += new I
Master = src
+ if(!GLOB)
+ new /datum/controller/global_vars
+
/datum/controller/master/Destroy()
..()
// Tell qdel() to Del() this object.
@@ -85,14 +98,14 @@ var/datum/controller/master/Master = new()
// -1 if we encountered a runtime trying to recreate it
/proc/Recreate_MC()
. = -1 //so if we runtime, things know we failed
- if (world.time < Master.restart_timeout)
+ if (world.time < GLOB.MC_restart_timeout)
return 0
- if (world.time < Master.restart_clear)
- Master.restart_count *= 0.5
+ if (world.time < GLOB.MC_restart_clear)
+ GLOB.MC_restart_count *= 0.5
- var/delay = 50 * ++Master.restart_count
- Master.restart_timeout = world.time + delay
- Master.restart_clear = world.time + (delay * 2)
+ var/delay = 50 * ++GLOB.MC_restart_count
+ GLOB.MC_restart_timeout = world.time + delay
+ GLOB.MC_restart_clear = world.time + (delay * 2)
Master.processing = FALSE //stop ticking this one
try
new/datum/controller/master()
@@ -136,6 +149,7 @@ var/datum/controller/master/Master = new()
if (istype(Master.subsystems))
if(FireHim)
Master.subsystems += new BadBoy.type //NEW_SS_GLOBAL will remove the old one
+
subsystems = Master.subsystems
current_runlevel = Master.current_runlevel
StartProcessing(10)
@@ -162,13 +176,13 @@ var/datum/controller/master/Master = new()
var/start_timeofday = REALTIMEOFDAY
// Initialize subsystems.
- current_ticklimit = config.tick_limit_mc_init
+ GLOB.CURRENT_TICKLIMIT = config.tick_limit_mc_init
for (var/datum/controller/subsystem/SS in subsystems)
if (SS.flags & SS_NO_INIT)
continue
SS.Initialize(REALTIMEOFDAY)
CHECK_TICK
- current_ticklimit = TICK_LIMIT_RUNNING
+ GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
var/time = (REALTIMEOFDAY - start_timeofday) / 10
var/msg = "Initializations complete within [time] second[time == 1 ? "" : "s"]!"
@@ -277,7 +291,7 @@ var/datum/controller/master/Master = new()
tickdrift = max(0, MC_AVERAGE_FAST(tickdrift, (((REALTIMEOFDAY - init_timeofday) - (world.time - init_time)) / world.tick_lag)))
var/starting_tick_usage = TICK_USAGE
if (processing <= 0)
- current_ticklimit = TICK_LIMIT_RUNNING
+ GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
sleep(10)
continue
@@ -286,7 +300,7 @@ var/datum/controller/master/Master = new()
// (because sleeps are processed in the order received, longer sleeps are more likely to run first)
if (starting_tick_usage > TICK_LIMIT_MC) //if there isn't enough time to bother doing anything this tick, sleep a bit.
sleep_delta *= 2
- current_ticklimit = TICK_LIMIT_RUNNING * 0.5
+ GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING * 0.5
sleep(world.tick_lag * (processing * sleep_delta))
continue
@@ -332,7 +346,7 @@ var/datum/controller/master/Master = new()
if (!error_level)
iteration++
error_level++
- current_ticklimit = TICK_LIMIT_RUNNING
+ GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
sleep(10)
continue
@@ -344,7 +358,7 @@ var/datum/controller/master/Master = new()
if (!error_level)
iteration++
error_level++
- current_ticklimit = TICK_LIMIT_RUNNING
+ GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
sleep(10)
continue
error_level--
@@ -355,9 +369,9 @@ var/datum/controller/master/Master = new()
iteration++
last_run = world.time
src.sleep_delta = MC_AVERAGE_FAST(src.sleep_delta, sleep_delta)
- current_ticklimit = TICK_LIMIT_RUNNING
+ GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
if (processing * sleep_delta <= world.tick_lag)
- current_ticklimit -= (TICK_LIMIT_RUNNING * 0.25) //reserve the tail 1/4 of the next tick for the mc if we plan on running next tick
+ GLOB.CURRENT_TICKLIMIT -= (TICK_LIMIT_RUNNING * 0.25) //reserve the tail 1/4 of the next tick for the mc if we plan on running next tick
sleep(world.tick_lag * (processing * sleep_delta))
@@ -449,7 +463,7 @@ var/datum/controller/master/Master = new()
// Reduce tick allocation for subsystems that overran on their last tick.
tick_precentage = max(tick_precentage*0.5, tick_precentage-queue_node.tick_overrun)
- current_ticklimit = round(TICK_USAGE + tick_precentage)
+ GLOB.CURRENT_TICKLIMIT = round(TICK_USAGE + tick_precentage)
if (!(queue_node_flags & SS_TICKER))
ran_non_ticker = TRUE
diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm
index e203650066..2695a39373 100644
--- a/code/controllers/master_controller.dm
+++ b/code/controllers/master_controller.dm
@@ -53,4 +53,4 @@ datum/controller/game_controller/proc/setup_objects()
populate_antag_type_list()
//Set up spawn points.
- populate_spawn_points()
+ populate_spawn_points()
\ No newline at end of file
diff --git a/code/controllers/verbs.dm b/code/controllers/verbs.dm
index f1249cfe0c..113072af4f 100644
--- a/code/controllers/verbs.dm
+++ b/code/controllers/verbs.dm
@@ -125,7 +125,7 @@
debug_variables(alarm_manager)
feedback_add_details("admin_verb", "DAlarm")
if("Nano")
- debug_variables(nanomanager)
+ debug_variables(GLOB.nanomanager)
feedback_add_details("admin_verb", "DNano")
if("Chemistry")
debug_variables(chemistryProcess)
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index 1f7685def5..56c3710989 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -85,7 +85,7 @@
current.verbs -= /datum/changeling/proc/EvolutionMenu
current.mind = null
- nanomanager.user_transferred(current, new_character) // transfer active NanoUI instances to new user
+ GLOB.nanomanager.user_transferred(current, new_character) // transfer active NanoUI instances to new user
if(new_character.mind) //remove any mind currently in our new body's mind variable
new_character.mind.current = null
diff --git a/code/datums/observation/dir_set.dm b/code/datums/observation/dir_set.dm
index 1f4c8e251e..a626a07c4b 100644
--- a/code/datums/observation/dir_set.dm
+++ b/code/datums/observation/dir_set.dm
@@ -8,7 +8,7 @@
// /old_dir: The dir before the change.
// /new_dir: The dir after the change.
-var/decl/observ/dir_set/dir_set_event = new()
+GLOBAL_DATUM_INIT(dir_set_event, /decl/observ/dir_set, new)
/decl/observ/dir_set
name = "Direction Set"
@@ -27,9 +27,9 @@ var/decl/observ/dir_set/dir_set_event = new()
/atom/movable/Entered(var/atom/movable/am, atom/old_loc)
. = ..()
- if(. != CANCEL_MOVE_EVENT && dir_set_event.has_listeners(am))
- dir_set_event.register(src, am, /atom/proc/recursive_dir_set)
+ if(. != CANCEL_MOVE_EVENT && GLOB.dir_set_event.has_listeners(am))
+ GLOB.dir_set_event.register(src, am, /atom/proc/recursive_dir_set)
/atom/movable/Exited(var/atom/movable/am, atom/old_loc)
. = ..()
- dir_set_event.unregister(src, am, /atom/proc/recursive_dir_set)
+ GLOB.dir_set_event.unregister(src, am, /atom/proc/recursive_dir_set)
diff --git a/code/datums/observation/equipped.dm b/code/datums/observation/equipped.dm
index de07a74355..4142050a35 100644
--- a/code/datums/observation/equipped.dm
+++ b/code/datums/observation/equipped.dm
@@ -7,7 +7,7 @@
// /mob/equipper: The mob that equipped the item.
// /obj/item/item: The equipped item.
// slot: The slot equipped to.
-var/decl/observ/mob_equipped/mob_equipped_event = new()
+GLOBAL_DATUM_INIT(mob_equipped_event, /decl/observ/mob_equipped, new)
/decl/observ/mob_equipped
name = "Mob Equipped"
@@ -22,7 +22,7 @@ var/decl/observ/mob_equipped/mob_equipped_event = new()
// /obj/item/item: The equipped item.
// /mob/equipper: The mob that equipped the item.
// slot: The slot equipped to.
-var/decl/observ/item_equipped/item_equipped_event = new()
+GLOBAL_DATUM_INIT(item_equipped_event, /decl/observ/item_equipped, new)
/decl/observ/item_equipped
name = "Item Equipped"
@@ -34,5 +34,5 @@ var/decl/observ/item_equipped/item_equipped_event = new()
/obj/item/equipped(var/mob/user, var/slot)
. = ..()
- mob_equipped_event.raise_event(user, src, slot)
- item_equipped_event.raise_event(src, user, slot)
+ GLOB.mob_equipped_event.raise_event(user, src, slot)
+ GLOB.item_equipped_event.raise_event(src, user, slot)
diff --git a/code/datums/observation/helpers.dm b/code/datums/observation/helpers.dm
index 79ee8eb08d..7857434170 100644
--- a/code/datums/observation/helpers.dm
+++ b/code/datums/observation/helpers.dm
@@ -11,8 +11,8 @@
/proc/register_all_movement(var/event_source, var/listener)
moved_event.register(event_source, listener, /atom/movable/proc/recursive_move)
- dir_set_event.register(event_source, listener, /atom/proc/recursive_dir_set)
+ GLOB.dir_set_event.register(event_source, listener, /atom/proc/recursive_dir_set)
/proc/unregister_all_movement(var/event_source, var/listener)
moved_event.unregister(event_source, listener, /atom/movable/proc/recursive_move)
- dir_set_event.unregister(event_source, listener, /atom/proc/recursive_dir_set)
+ GLOB.dir_set_event.unregister(event_source, listener, /atom/proc/recursive_dir_set)
diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm
index afcb65a8c1..8d2edbeeb9 100644
--- a/code/datums/progressbar.dm
+++ b/code/datums/progressbar.dm
@@ -22,7 +22,7 @@
/datum/progressbar/Destroy()
if (client)
client.images -= bar
- qdel_null(bar)
+ QDEL_NULL(bar)
user = null
client = null
return ..()
diff --git a/code/game/gamemodes/technomancer/spells/flame_tongue.dm b/code/game/gamemodes/technomancer/spells/flame_tongue.dm
index ffc12344e8..9e2c7b88b3 100644
--- a/code/game/gamemodes/technomancer/spells/flame_tongue.dm
+++ b/code/game/gamemodes/technomancer/spells/flame_tongue.dm
@@ -22,7 +22,7 @@
welder.setWelding(1)
/obj/item/weapon/spell/flame_tongue/Destroy()
- qdel_null(welder)
+ QDEL_NULL(welder)
return ..()
/obj/item/weapon/weldingtool/spell
diff --git a/code/game/gamemodes/technomancer/spells/illusion.dm b/code/game/gamemodes/technomancer/spells/illusion.dm
index 3e6d2dd8ab..418df75539 100644
--- a/code/game/gamemodes/technomancer/spells/illusion.dm
+++ b/code/game/gamemodes/technomancer/spells/illusion.dm
@@ -62,7 +62,7 @@
illusion.emote(what_to_emote)
/obj/item/weapon/spell/illusion/Destroy()
- qdel_null(illusion)
+ QDEL_NULL(illusion)
copied = null
return ..()
diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm
index 477353e739..73f5abce4b 100644
--- a/code/game/machinery/atmoalter/portable_atmospherics.dm
+++ b/code/game/machinery/atmoalter/portable_atmospherics.dm
@@ -22,8 +22,8 @@
return 1
/obj/machinery/portable_atmospherics/Destroy()
- qdel_null(air_contents)
- qdel_null(holding)
+ QDEL_NULL(air_contents)
+ QDEL_NULL(holding)
. = ..()
/obj/machinery/portable_atmospherics/initialize()
diff --git a/code/game/machinery/doors/multi_tile.dm b/code/game/machinery/doors/multi_tile.dm
index 434f7e64cb..5ead377f0c 100644
--- a/code/game/machinery/doors/multi_tile.dm
+++ b/code/game/machinery/doors/multi_tile.dm
@@ -12,8 +12,8 @@
create_fillers()
/obj/machinery/door/airlock/multi_tile/Destroy()
- qdel_null(filler1)
- qdel_null(filler2)
+ QDEL_NULL(filler1)
+ QDEL_NULL(filler2)
return ..()
/obj/machinery/door/airlock/multi_tile/Move()
diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm
index 0980dc60ed..c428c6989c 100644
--- a/code/game/machinery/oxygen_pump.dm
+++ b/code/game/machinery/oxygen_pump.dm
@@ -36,8 +36,8 @@
visible_message("The mask rapidly retracts just before /the [src] is destroyed!")
breather = null
- qdel_null(tank)
- qdel_null(contained)
+ QDEL_NULL(tank)
+ QDEL_NULL(contained)
return ..()
/obj/machinery/oxygen_pump/MouseDrop(var/mob/living/carbon/human/target, src_location, over_location)
diff --git a/code/game/machinery/pipe/pipelayer.dm b/code/game/machinery/pipe/pipelayer.dm
index b51fbd4cc0..366a351d6b 100644
--- a/code/game/machinery/pipe/pipelayer.dm
+++ b/code/game/machinery/pipe/pipelayer.dm
@@ -28,7 +28,7 @@
update_icon()
/obj/machinery/pipelayer/Destroy()
- qdel_null(W)
+ QDEL_NULL(W)
. = ..()
/obj/machinery/pipelayer/RefreshParts()
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 0812602eeb..a243722ba6 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -174,11 +174,11 @@
cell = null
internal_tank = null
- qdel_null(pr_int_temp_processor)
- qdel_null(pr_inertial_movement)
- qdel_null(pr_give_air)
- qdel_null(pr_internal_damage)
- qdel_null(spark_system)
+ QDEL_NULL(pr_int_temp_processor)
+ QDEL_NULL(pr_inertial_movement)
+ QDEL_NULL(pr_give_air)
+ QDEL_NULL(pr_internal_damage)
+ QDEL_NULL(spark_system)
mechas_list -= src //global mech list
. = ..()
diff --git a/code/game/objects/items/antag_spawners.dm b/code/game/objects/items/antag_spawners.dm
index 100c113994..0d8e18373a 100644
--- a/code/game/objects/items/antag_spawners.dm
+++ b/code/game/objects/items/antag_spawners.dm
@@ -12,7 +12,7 @@
sparks.attach(loc)
/obj/item/weapon/antag_spawner/Destroy()
- qdel_null(sparks)
+ QDEL_NULL(sparks)
return ..()
/obj/item/weapon/antag_spawner/proc/spawn_antag(client/C, turf/T)
diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm
index 324c5560a3..f79ac478b2 100644
--- a/code/game/objects/items/bodybag.dm
+++ b/code/game/objects/items/bodybag.dm
@@ -149,8 +149,8 @@
..()
/obj/structure/closet/body_bag/cryobag/Destroy()
- qdel_null(syringe)
- qdel_null(tank)
+ QDEL_NULL(syringe)
+ QDEL_NULL(tank)
return ..()
/obj/structure/closet/body_bag/cryobag/open()
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index 5df1daff3d..139e24ed4f 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -1473,9 +1473,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (src.id && prob(90)) //IDs are kept in 90% of the cases
src.id.forceMove(get_turf(src.loc))
else
- qdel_null(src.id)
- qdel_null(src.cartridge)
- qdel_null(src.pai)
+ QDEL_NULL(src.id)
+ QDEL_NULL(src.cartridge)
+ QDEL_NULL(src.pai)
return ..()
/obj/item/device/pda/clown/Crossed(AM as mob|obj) //Clown PDA is slippery.
diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm
index 4832bdcc53..cf91bbef3b 100644
--- a/code/game/objects/items/devices/PDA/cart.dm
+++ b/code/game/objects/items/devices/PDA/cart.dm
@@ -79,7 +79,7 @@ var/list/civilian_cartridges = list(
var/list/stored_data = list()
/obj/item/weapon/cartridge/Destroy()
- qdel_null(radio)
+ QDEL_NULL(radio)
return ..()
/obj/item/weapon/cartridge/engineering
diff --git a/code/game/objects/items/devices/communicator/communicator.dm b/code/game/objects/items/devices/communicator/communicator.dm
index 7342988916..d7e62a53c7 100644
--- a/code/game/objects/items/devices/communicator/communicator.dm
+++ b/code/game/objects/items/devices/communicator/communicator.dm
@@ -298,8 +298,8 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
all_communicators -= src
processing_objects -= src
listening_objects.Remove(src)
- qdel_null(camera)
- qdel_null(exonet)
+ QDEL_NULL(camera)
+ QDEL_NULL(exonet)
return ..()
diff --git a/code/game/objects/items/devices/defib.dm b/code/game/objects/items/devices/defib.dm
index 9b127da04a..1ddfa04bf0 100644
--- a/code/game/objects/items/devices/defib.dm
+++ b/code/game/objects/items/devices/defib.dm
@@ -32,8 +32,8 @@
/obj/item/device/defib_kit/Destroy()
. = ..()
- qdel_null(paddles)
- qdel_null(bcell)
+ QDEL_NULL(paddles)
+ QDEL_NULL(bcell)
/obj/item/device/defib_kit/loaded //starts with a cell
bcell = /obj/item/weapon/cell/apc
diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm
index 8f2827c7ab..2ffebcb81a 100644
--- a/code/game/objects/items/devices/paicard.dm
+++ b/code/game/objects/items/devices/paicard.dm
@@ -30,7 +30,7 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/device/paicard)
//Will stop people throwing friend pAIs into the singularity so they can respawn
if(!isnull(pai))
pai.death(0)
- qdel_null(radio)
+ QDEL_NULL(radio)
return ..()
/obj/item/device/paicard/attack_self(mob/user)
diff --git a/code/game/objects/items/devices/radio/jammer.dm b/code/game/objects/items/devices/radio/jammer.dm
index 868f90251c..9ae7b9fd4e 100644
--- a/code/game/objects/items/devices/radio/jammer.dm
+++ b/code/game/objects/items/devices/radio/jammer.dm
@@ -35,7 +35,7 @@ var/global/list/active_radio_jammers = list()
/obj/item/device/radio_jammer/Destroy()
if(on)
turn_off()
- qdel_null(power_source)
+ QDEL_NULL(power_source)
return ..()
/obj/item/device/radio_jammer/get_cell()
diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm
index 3f62ac2725..919f8cb016 100644
--- a/code/game/objects/items/weapons/flamethrower.dm
+++ b/code/game/objects/items/weapons/flamethrower.dm
@@ -27,9 +27,9 @@
/obj/item/weapon/flamethrower/Destroy()
- qdel_null(weldtool)
- qdel_null(igniter)
- qdel_null(ptank)
+ QDEL_NULL(weldtool)
+ QDEL_NULL(igniter)
+ QDEL_NULL(ptank)
. = ..()
/obj/item/weapon/flamethrower/process()
diff --git a/code/game/objects/items/weapons/grenades/chem_grenade.dm b/code/game/objects/items/weapons/grenades/chem_grenade.dm
index a525e13abc..442e6c3f1d 100644
--- a/code/game/objects/items/weapons/grenades/chem_grenade.dm
+++ b/code/game/objects/items/weapons/grenades/chem_grenade.dm
@@ -20,8 +20,8 @@
create_reagents(1000)
Destroy()
- qdel_null(detonator)
- qdel_null_list(beakers)
+ QDEL_NULL(detonator)
+ QDEL_NULL_LIST(beakers)
return ..()
attack_self(mob/user as mob)
diff --git a/code/game/objects/items/weapons/implants/implantlanguage.dm b/code/game/objects/items/weapons/implants/implantlanguage.dm
index 7c6e33508b..6a0f2baea8 100644
--- a/code/game/objects/items/weapons/implants/implantlanguage.dm
+++ b/code/game/objects/items/weapons/implants/implantlanguage.dm
@@ -23,7 +23,7 @@
V.mechassist()
for(var/L in need_amend)
V.add_assistable_langs(L)
- qdel_null(src)
+ QDEL_NULL(src)
/obj/item/weapon/implant/language/get_data()
var/dat = {"
diff --git a/code/game/objects/items/weapons/material/gravemarker.dm b/code/game/objects/items/weapons/material/gravemarker.dm
index aff9a9e5ce..cad9df3c8f 100644
--- a/code/game/objects/items/weapons/material/gravemarker.dm
+++ b/code/game/objects/items/weapons/material/gravemarker.dm
@@ -76,5 +76,5 @@
G.epitaph = epitaph
G.add_fingerprint(usr)
G.dir = user.dir
- qdel_null(src)
+ QDEL_NULL(src)
return
\ No newline at end of file
diff --git a/code/game/objects/items/weapons/storage/laundry_basket.dm b/code/game/objects/items/weapons/storage/laundry_basket.dm
index d5b19a24ed..722d68e634 100644
--- a/code/game/objects/items/weapons/storage/laundry_basket.dm
+++ b/code/game/objects/items/weapons/storage/laundry_basket.dm
@@ -65,7 +65,7 @@
return ..()
/obj/item/weapon/storage/laundry_basket/dropped(mob/user as mob)
- qdel_null(linked)
+ QDEL_NULL(linked)
return ..()
/obj/item/weapon/storage/laundry_basket/show_to(mob/user as mob)
diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm
index 03ad104810..8d17a1a5c7 100644
--- a/code/game/objects/items/weapons/storage/storage.dm
+++ b/code/game/objects/items/weapons/storage/storage.dm
@@ -40,14 +40,14 @@
/obj/item/weapon/storage/Destroy()
close_all()
- qdel_null(boxes)
- qdel_null(src.storage_start)
- qdel_null(src.storage_continue)
- qdel_null(src.storage_end)
- qdel_null(src.stored_start)
- qdel_null(src.stored_continue)
- qdel_null(src.stored_end)
- qdel_null(closer)
+ QDEL_NULL(boxes)
+ QDEL_NULL(src.storage_start)
+ QDEL_NULL(src.storage_continue)
+ QDEL_NULL(src.storage_end)
+ QDEL_NULL(src.stored_start)
+ QDEL_NULL(src.stored_continue)
+ QDEL_NULL(src.stored_end)
+ QDEL_NULL(closer)
. = ..()
/obj/item/weapon/storage/MouseDrop(obj/over_object as obj)
@@ -354,7 +354,7 @@
//such as when picking up all the items on a tile with one click.
/obj/item/weapon/storage/proc/handle_item_insertion(obj/item/W as obj, prevent_warning = 0)
if(!istype(W)) return 0
-
+
if(usr)
usr.remove_from_mob(W,target = src) //If given a target, handles forceMove()
W.on_enter_storage(src)
diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm
index b021424043..736d2919ff 100644
--- a/code/game/objects/items/weapons/tanks/jetpack.dm
+++ b/code/game/objects/items/weapons/tanks/jetpack.dm
@@ -24,7 +24,7 @@
ion_trail.set_up(src)
/obj/item/weapon/tank/jetpack/Destroy()
- qdel_null(ion_trail)
+ QDEL_NULL(ion_trail)
return ..()
/obj/item/weapon/tank/jetpack/examine(mob/user)
diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm
index 07979777e7..9c3ac7008a 100644
--- a/code/game/objects/items/weapons/tanks/tanks.dm
+++ b/code/game/objects/items/weapons/tanks/tanks.dm
@@ -70,10 +70,10 @@ var/list/global/tank_gauge_cache = list()
return
/obj/item/weapon/tank/Destroy()
- qdel_null(air_contents)
+ QDEL_NULL(air_contents)
processing_objects.Remove(src)
- qdel_null(src.proxyassembly)
+ QDEL_NULL(src.proxyassembly)
if(istype(loc, /obj/item/device/transfer_valve))
var/obj/item/device/transfer_valve/TTV = loc
diff --git a/code/game/objects/items/weapons/tools/crowbar.dm b/code/game/objects/items/weapons/tools/crowbar.dm
index 5eb2668b2f..721f5e30c9 100644
--- a/code/game/objects/items/weapons/tools/crowbar.dm
+++ b/code/game/objects/items/weapons/tools/crowbar.dm
@@ -65,7 +65,7 @@
/obj/item/weapon/tool/crowbar/power/Destroy()
if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly.
- qdel_null(counterpart)
+ QDEL_NULL(counterpart)
return ..()
/obj/item/weapon/tool/crowbar/power/attack_self(mob/user)
diff --git a/code/game/objects/items/weapons/tools/screwdriver.dm b/code/game/objects/items/weapons/tools/screwdriver.dm
index 6c0a1561a3..86ac8f1267 100644
--- a/code/game/objects/items/weapons/tools/screwdriver.dm
+++ b/code/game/objects/items/weapons/tools/screwdriver.dm
@@ -113,7 +113,7 @@
/obj/item/weapon/tool/screwdriver/power/Destroy()
if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly.
- qdel_null(counterpart)
+ QDEL_NULL(counterpart)
return ..()
/obj/item/weapon/tool/screwdriver/power/attack_self(mob/user)
diff --git a/code/game/objects/items/weapons/tools/wirecutters.dm b/code/game/objects/items/weapons/tools/wirecutters.dm
index edd002cc4b..eb8b940c92 100644
--- a/code/game/objects/items/weapons/tools/wirecutters.dm
+++ b/code/game/objects/items/weapons/tools/wirecutters.dm
@@ -81,7 +81,7 @@
/obj/item/weapon/tool/wirecutters/power/Destroy()
if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly.
- qdel_null(counterpart)
+ QDEL_NULL(counterpart)
return ..()
/obj/item/weapon/tool/wirecutters/power/attack_self(mob/user)
diff --git a/code/game/objects/items/weapons/tools/wrench.dm b/code/game/objects/items/weapons/tools/wrench.dm
index 22eb371157..e0a6957c3c 100644
--- a/code/game/objects/items/weapons/tools/wrench.dm
+++ b/code/game/objects/items/weapons/tools/wrench.dm
@@ -59,7 +59,7 @@
/obj/item/weapon/tool/wrench/power/Destroy()
if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly.
- qdel_null(counterpart)
+ QDEL_NULL(counterpart)
return ..()
/obj/item/weapon/tool/wrench/power/attack_self(mob/user)
diff --git a/code/game/objects/structures/holoplant.dm b/code/game/objects/structures/holoplant.dm
index 1f6473ebdc..1f762c027a 100644
--- a/code/game/objects/structures/holoplant.dm
+++ b/code/game/objects/structures/holoplant.dm
@@ -52,7 +52,7 @@
/obj/machinery/holoplant/proc/deactivate()
overlays -= plant
- qdel_null(plant)
+ QDEL_NULL(plant)
set_light(0)
use_power = 0
diff --git a/code/global.dm b/code/global.dm
index 88df87a100..33844822b0 100644
--- a/code/global.dm
+++ b/code/global.dm
@@ -116,19 +116,6 @@ var/datum/metric/metric = new() // Metric datum, used to keep track of the round
var/list/awaydestinations = list() // Away missions. A list of landmarks that the warpgate can take you to.
-// MySQL configuration
-var/sqladdress = "localhost"
-var/sqlport = "3306"
-var/sqldb = "tgstation"
-var/sqllogin = "root"
-var/sqlpass = ""
-
-// Feedback gathering sql connection
-var/sqlfdbkdb = "test"
-var/sqlfdbklogin = "root"
-var/sqlfdbkpass = ""
-var/sqllogging = 0 // Should we log deaths, population stats, etc.?
-
// Forum MySQL configuration. (for use with forum account/key authentication)
// These are all default values that will load should the forumdbconfig.txt file fail to read for whatever reason.
var/forumsqladdress = "localhost"
diff --git a/code/modules/admin/view_variables/helpers.dm b/code/modules/admin/view_variables/helpers.dm
index 1e160d253c..2776458e06 100644
--- a/code/modules/admin/view_variables/helpers.dm
+++ b/code/modules/admin/view_variables/helpers.dm
@@ -84,3 +84,111 @@
"}
+
+/datum/proc/get_variables()
+ . = vars - VV_hidden()
+ if(!usr || !check_rights(R_ADMIN|R_DEBUG, FALSE))
+ . -= VV_secluded()
+
+/datum/proc/get_variable_value(varname)
+ return vars[varname]
+
+/datum/proc/set_variable_value(varname, value)
+ vars[varname] = value
+
+/datum/proc/get_initial_variable_value(varname)
+ return initial(vars[varname])
+
+/datum/proc/make_view_variables_variable_entry(var/varname, var/value, var/hide_watch = 0)
+ return {"
+ (E)
+ (C)
+ (M)
+ [hide_watch ? "" : "(W)"]
+ "}
+
+// No mass editing of clients
+/client/make_view_variables_variable_entry(var/varname, var/value, var/hide_watch = 0)
+ return {"
+ (E)
+ (C)
+ [hide_watch ? "" : "(W)"]
+ "}
+
+// These methods are all procs and don't use stored lists to avoid VV exploits
+
+// The following vars cannot be viewed by anyone
+/datum/proc/VV_hidden()
+ return list()
+
+// The following vars can only be viewed by R_ADMIN|R_DEBUG
+/datum/proc/VV_secluded()
+ return list()
+
+/datum/configuration/VV_secluded()
+ return vars
+
+// The following vars cannot be edited by anyone
+/datum/proc/VV_static()
+ return list("parent_type")
+
+/atom/VV_static()
+ return ..() + list("bound_x", "bound_y", "bound_height", "bound_width", "bounds", "step_x", "step_y", "step_size")
+
+/client/VV_static()
+ return ..() + list("holder", "prefs")
+
+/datum/admins/VV_static()
+ return vars
+
+// The following vars require R_DEBUG to edit
+/datum/proc/VV_locked()
+ return list("vars", "virus", "viruses", "cuffed")
+
+/client/VV_locked()
+ return list("vars", "mob")
+
+/mob/VV_locked()
+ return ..() + list("client")
+
+// The following vars require R_FUN|R_DEBUG to edit
+/datum/proc/VV_icon_edit_lock()
+ return list()
+
+/atom/VV_icon_edit_lock()
+ return ..() + list("icon", "icon_state", "overlays", "underlays")
+
+// The following vars require R_SPAWN|R_DEBUG to edit
+/datum/proc/VV_ckey_edit()
+ return list()
+
+/mob/VV_ckey_edit()
+ return list("key", "ckey")
+
+/client/VV_ckey_edit()
+ return list("key", "ckey")
+
+/datum/proc/may_edit_var(var/user, var/var_to_edit)
+ if(!user)
+ return FALSE
+ if(!(var_to_edit in vars))
+ to_chat(user, "\The [src] does not have a var '[var_to_edit]'")
+ return FALSE
+ if(var_to_edit in VV_static())
+ return FALSE
+ if((var_to_edit in VV_secluded()) && !check_rights(R_ADMIN|R_DEBUG, FALSE, C = user))
+ return FALSE
+ if((var_to_edit in VV_locked()) && !check_rights(R_DEBUG, C = user))
+ return FALSE
+ if((var_to_edit in VV_ckey_edit()) && !check_rights(R_SPAWN|R_DEBUG, C = user))
+ return FALSE
+ if((var_to_edit in VV_icon_edit_lock()) && !check_rights(R_FUN|R_DEBUG, C = user))
+ return FALSE
+ return TRUE
+
+/proc/forbidden_varedit_object_types()
+ return list(
+ /datum/admins, //Admins editing their own admin-power object? Yup, sounds like a good idea.,
+ /obj/machinery/blackbox_recorder, //Prevents people messing with feedback gathering,
+ /datum/feedback_variable //Prevents people messing with feedback gathering
+ )
\ No newline at end of file
diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm
index 9e9eaeb868..849729f332 100644
--- a/code/modules/assembly/infrared.dm
+++ b/code/modules/assembly/infrared.dm
@@ -254,4 +254,4 @@
if(master.first == src)
master.first = null
if(next && !next.gc_destroyed)
- qdel_null(next)
+ QDEL_NULL(next)
diff --git a/code/modules/clothing/suits/storage.dm b/code/modules/clothing/suits/storage.dm
index ca630dae77..2f97ce79eb 100644
--- a/code/modules/clothing/suits/storage.dm
+++ b/code/modules/clothing/suits/storage.dm
@@ -8,7 +8,7 @@
pockets.max_storage_space = ITEMSIZE_COST_SMALL * 2
/obj/item/clothing/suit/storage/Destroy()
- qdel_null(pockets)
+ QDEL_NULL(pockets)
return ..()
/obj/item/clothing/suit/storage/attack_hand(mob/user as mob)
diff --git a/code/modules/holomap/station_holomap.dm b/code/modules/holomap/station_holomap.dm
index 9de56229da..c30beb2413 100644
--- a/code/modules/holomap/station_holomap.dm
+++ b/code/modules/holomap/station_holomap.dm
@@ -124,7 +124,7 @@
watching_mob = user
moved_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition)
- dir_set_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition)
+ GLOB.dir_set_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition)
destroyed_event.register(watching_mob, src, /obj/machinery/station_map/proc/stopWatching)
update_use_power(2)
@@ -153,7 +153,7 @@
spawn(5) //we give it time to fade out
M.client.images -= holomap_datum.station_map
moved_event.unregister(watching_mob, src)
- dir_set_event.unregister(watching_mob, src)
+ GLOB.dir_set_event.unregister(watching_mob, src)
destroyed_event.unregister(watching_mob, src)
watching_mob = null
update_use_power(1)
diff --git a/code/modules/integrated_electronics/subtypes/output.dm b/code/modules/integrated_electronics/subtypes/output.dm
index beefed282e..c0eb3d5338 100644
--- a/code/modules/integrated_electronics/subtypes/output.dm
+++ b/code/modules/integrated_electronics/subtypes/output.dm
@@ -246,7 +246,7 @@
on_data_written()
/obj/item/integrated_circuit/output/video_camera/Destroy()
- qdel_null(camera)
+ QDEL_NULL(camera)
return ..()
/obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(var/status)
diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm
index 07f65f62b5..1624d6941d 100644
--- a/code/modules/mob/living/carbon/brain/MMI.dm
+++ b/code/modules/mob/living/carbon/brain/MMI.dm
@@ -146,8 +146,8 @@
if(isrobot(loc))
var/mob/living/silicon/robot/borg = loc
borg.mmi = null
- qdel_null(radio)
- qdel_null(brainmob)
+ QDEL_NULL(radio)
+ QDEL_NULL(brainmob)
return ..()
/obj/item/device/mmi/radio_enabled
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index c35fdcbf2a..aac33fe3ae 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -208,14 +208,14 @@ var/list/ai_verbs_default = list(
/mob/living/silicon/ai/Destroy()
ai_list -= src
- qdel_null(announcement)
- qdel_null(eyeobj)
- qdel_null(psupply)
- qdel_null(aiPDA)
- qdel_null(aiCommunicator)
- qdel_null(aiMulti)
- qdel_null(aiRadio)
- qdel_null(aiCamera)
+ QDEL_NULL(announcement)
+ QDEL_NULL(eyeobj)
+ QDEL_NULL(psupply)
+ QDEL_NULL(aiPDA)
+ QDEL_NULL(aiCommunicator)
+ QDEL_NULL(aiMulti)
+ QDEL_NULL(aiRadio)
+ QDEL_NULL(aiCamera)
hack = null
return ..()
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index f4d781a8a0..6fe1d6bdc8 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -13,7 +13,7 @@
if(mind && mind.current == src)
spellremove(src)
ghostize()
- qdel_null(plane_holder)
+ QDEL_NULL(plane_holder)
..()
return QDEL_HINT_HARDDEL_NOW
diff --git a/code/modules/mob/mob_planes.dm b/code/modules/mob/mob_planes.dm
index 7534ca176c..afdc50d883 100644
--- a/code/modules/mob/mob_planes.dm
+++ b/code/modules/mob/mob_planes.dm
@@ -11,7 +11,7 @@
my_mob = this_guy
//It'd be nice to lazy init these but some of them are important to just EXIST. Like without ghost planemaster, you can see ghosts. Go figure.
-
+
// 'Utility' planes
plane_masters[VIS_FULLBRIGHT] = new /obj/screen/plane_master/fullbright //Lighting system (lighting_overlay objects)
plane_masters[VIS_LIGHTING] = new /obj/screen/plane_master/lighting //Lighting system (but different!)
@@ -44,7 +44,7 @@
/datum/plane_holder/Destroy()
my_mob = null
- qdel_null_list(plane_masters) //Goodbye my children, be free
+ QDEL_NULL_LIST(plane_masters) //Goodbye my children, be free
return ..()
/datum/plane_holder/proc/set_vis(var/which = null, var/state = FALSE)
diff --git a/code/modules/multiz/hoist.dm b/code/modules/multiz/hoist.dm
index 9277d17ff9..a1df9389ab 100644
--- a/code/modules/multiz/hoist.dm
+++ b/code/modules/multiz/hoist.dm
@@ -110,7 +110,7 @@
/obj/structure/hoist/Destroy()
if(hoistee)
release_hoistee()
- qdel_null(src.source_hook)
+ QDEL_NULL(src.source_hook)
return ..()
/obj/effect/hoist_hook/Destroy()
@@ -139,7 +139,7 @@
desc += " It looks broken, and the clamp has retracted back into the hoist. Seems like you'd have to re-deploy it to get it to work again."
if(hoistee)
release_hoistee()
- qdel_null(source_hook)
+ QDEL_NULL(source_hook)
/obj/structure/hoist/ex_act(severity)
switch(severity)
diff --git a/code/modules/multiz/zshadow.dm b/code/modules/multiz/zshadow.dm
index 7d8dbb2653..7a04768ae7 100644
--- a/code/modules/multiz/zshadow.dm
+++ b/code/modules/multiz/zshadow.dm
@@ -29,7 +29,7 @@
return QDEL_HINT_QUEUE
/mob/Destroy()
- qdel_null(shadow)
+ QDEL_NULL(shadow)
. = ..()
/mob/zshadow/examine(mob/user, distance, infix, suffix)
diff --git a/code/modules/nano/nanomanager.dm b/code/modules/nano/nanomanager.dm
index 64c59bcefa..b1639f9194 100644
--- a/code/modules/nano/nanomanager.dm
+++ b/code/modules/nano/nanomanager.dm
@@ -1,3 +1,5 @@
+GLOBAL_DATUM_INIT(nanomanager, /datum/nanomanager, new) // NanoManager, the manager for Nano UIs.
+
// This is the window/UI manager for Nano UI
// There should only ever be one (global) instance of nanomanger
/datum/nanomanager
diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm
index ee1056344f..ecf81dcd91 100644
--- a/code/modules/organs/internal/brain.dm
+++ b/code/modules/organs/internal/brain.dm
@@ -55,7 +55,7 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain)
brainmob.client.screen.len = null //clear the hud
/obj/item/organ/internal/brain/Destroy()
- qdel_null(brainmob)
+ QDEL_NULL(brainmob)
. = ..()
/obj/item/organ/internal/brain/proc/transfer_identity(var/mob/living/carbon/H)
diff --git a/code/modules/power/tesla/coil.dm b/code/modules/power/tesla/coil.dm
index 82e84718cf..5b614ce629 100644
--- a/code/modules/power/tesla/coil.dm
+++ b/code/modules/power/tesla/coil.dm
@@ -30,7 +30,7 @@
default_apply_parts()
/obj/machinery/power/tesla_coil/Destroy()
- qdel_null(wires)
+ QDEL_NULL(wires)
return ..()
/obj/machinery/power/tesla_coil/RefreshParts()
diff --git a/code/modules/projectiles/guns/magnetic/magnetic.dm b/code/modules/projectiles/guns/magnetic/magnetic.dm
index 2e8289fb8e..298098698e 100644
--- a/code/modules/projectiles/guns/magnetic/magnetic.dm
+++ b/code/modules/projectiles/guns/magnetic/magnetic.dm
@@ -31,9 +31,9 @@
/obj/item/weapon/gun/magnetic/Destroy()
processing_objects.Remove(src)
- qdel_null(cell)
- qdel_null(loaded)
- qdel_null(capacitor)
+ QDEL_NULL(cell)
+ QDEL_NULL(loaded)
+ QDEL_NULL(capacitor)
. = ..()
/obj/item/weapon/gun/magnetic/get_cell()
diff --git a/code/modules/projectiles/projectile/arc.dm b/code/modules/projectiles/projectile/arc.dm
index 6e434b1e99..8baf37836f 100644
--- a/code/modules/projectiles/projectile/arc.dm
+++ b/code/modules/projectiles/projectile/arc.dm
@@ -20,7 +20,7 @@
return ..()
/obj/item/projectile/arc/Destroy()
- qdel_null(shadow)
+ QDEL_NULL(shadow)
return ..()
/obj/item/projectile/arc/Bump(atom/A, forced=0)
diff --git a/code/modules/shieldgen/shield_gen.dm b/code/modules/shieldgen/shield_gen.dm
index 7c63d0a623..de6d535a05 100644
--- a/code/modules/shieldgen/shield_gen.dm
+++ b/code/modules/shieldgen/shield_gen.dm
@@ -42,7 +42,7 @@
return ..()
/obj/machinery/shield_gen/Destroy()
- qdel_null_list(field)
+ QDEL_NULL_LIST(field)
return ..()
/obj/machinery/shield_gen/emag_act(var/remaining_charges, var/mob/user)
diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm
index 3180ace629..2109d42f44 100644
--- a/code/modules/vehicles/vehicle.dm
+++ b/code/modules/vehicles/vehicle.dm
@@ -50,7 +50,7 @@
//spawn the cell you want in each vehicle
/obj/vehicle/Destroy()
- qdel_null(riding_datum)
+ QDEL_NULL(riding_datum)
return ..()
//BUCKLE HOOKS
diff --git a/polaris.dme b/polaris.dme
index bbe642cdd1..44566ad6a5 100644
--- a/polaris.dme
+++ b/polaris.dme
@@ -18,6 +18,7 @@
#include "code\names.dm"
#include "code\stylesheet.dm"
#include "code\world.dm"
+#include "code\__datastructures\globals.dm"
#include "code\__defines\_compile_options.dm"
#include "code\__defines\_planes+layers.dm"
#include "code\__defines\_tick.dm"
@@ -60,6 +61,10 @@
#include "code\_compatibility\509\JSON Writer.dm"
#include "code\_compatibility\509\text.dm"
#include "code\_compatibility\509\type2type.dm"
+#include "code\_global_vars\misc.dm"
+#include "code\_global_vars\mobs.dm"
+#include "code\_global_vars\sensitive.dm"
+#include "code\_global_vars\lists\mapping.dm"
#include "code\_helpers\_global_objects.dm"
#include "code\_helpers\atmospherics.dm"
#include "code\_helpers\events.dm"
@@ -156,6 +161,7 @@
#include "code\controllers\controller.dm"
#include "code\controllers\emergency_shuttle_controller.dm"
#include "code\controllers\failsafe.dm"
+#include "code\controllers\globals.dm"
#include "code\controllers\hooks-defs.dm"
#include "code\controllers\hooks.dm"
#include "code\controllers\master.dm"