Merge branch 'master' of https://github.com/PolarisSS13/Polaris into Mech_Equipment_Carepackage1

This commit is contained in:
Mechoid
2018-08-23 20:17:49 -07:00
75 changed files with 449 additions and 154 deletions

View File

@@ -10,7 +10,7 @@ datum/pipeline
var/alert_pressure = 0 var/alert_pressure = 0
Destroy() Destroy()
qdel_null(network) QDEL_NULL(network)
if(air && air.volume) if(air && air.volume)
temporarily_store_air() temporarily_store_air()

View File

@@ -72,7 +72,7 @@
return parent.return_network(reference) return parent.return_network(reference)
/obj/machinery/atmospherics/pipe/Destroy() /obj/machinery/atmospherics/pipe/Destroy()
qdel_null(parent) QDEL_NULL(parent)
if(air_temporary) if(air_temporary)
loc.assume_air(air_temporary) loc.assume_air(air_temporary)
for(var/obj/machinery/meter/meter in loc) for(var/obj/machinery/meter/meter in loc)

View File

@@ -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)

View File

@@ -1,13 +1,14 @@
#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. // 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 \ #define MC_SPLIT_TICK \
if(split_tick_phases > 1){\ if(split_tick_phases > 1){\
Master.current_ticklimit = ((original_tick_limit - TICK_USAGE) / split_tick_phases) + TICK_USAGE;\ GLOB.CURRENT_TICKLIMIT = ((original_tick_limit - world.tick_usage) / split_tick_phases) + world.tick_usage;\
--split_tick_phases;\ --split_tick_phases;\
} else {\ } else {\
Master.current_ticklimit = original_tick_limit;\ GLOB.CURRENT_TICKLIMIT = original_tick_limit;\
} }
// Boilerplate code for multi-step processors. See machines.dm for example use. // Boilerplate code for multi-step processors. See machines.dm for example use.
@@ -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 #define SS_PAUSING 5 //in the middle of pausing
// Standard way to define a global subsystem, keep boilerplate organized here! // 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(){\ /datum/controller/subsystem/##X/New(){\
NEW_SS_GLOBAL(SS##X);\ NEW_SS_GLOBAL(SS##X);\
PreInit();\ PreInit();\
}\ }\
/datum/controller/subsystem/##X /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

View File

@@ -3,7 +3,7 @@
#define TICK_LIMIT_MC 70 #define TICK_LIMIT_MC 70
#define TICK_LIMIT_MC_INIT_DEFAULT 98 #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 CHECK_TICK if TICK_CHECK stoplag()
#define TICK_USAGE world.tick_usage #define TICK_USAGE world.tick_usage

View File

@@ -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_INSSATOMS 0 //New should not call Initialize
#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE) #define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
@@ -7,6 +22,15 @@
#define INITIALIZE_HINT_LATELOAD 1 //Call LateInitialize #define INITIALIZE_HINT_LATELOAD 1 //Call LateInitialize
#define INITIALIZE_HINT_QDEL 2 //Call qdel on the atom #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 // SS runlevels
#define RUNLEVEL_INIT 0 // "Initialize Only" - Used for subsystems that should never be fired (Should also have SS_NO_FIRE set) #define RUNLEVEL_INIT 0 // "Initialize Only" - Used for subsystems that should never be fired (Should also have SS_NO_FIRE set)

View File

@@ -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
))

View File

@@ -0,0 +1 @@
GLOBAL_LIST_EMPTY(all_observable_events)

View File

@@ -0,0 +1,2 @@
GLOBAL_LIST_EMPTY(admins) //all clients whom are admins
GLOBAL_PROTECT(admins)

View File

@@ -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.?

View File

@@ -543,7 +543,7 @@ datum/projectile_data
/proc/getOPressureDifferential(var/turf/loc) /proc/getOPressureDifferential(var/turf/loc)
var/minp=16777216; var/minp=16777216;
var/maxp=0; 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/turf/simulated/T=get_turf(get_step(loc,dir))
var/cp=0 var/cp=0
if(T && istype(T) && T.zone) if(T && istype(T) && T.zone)
@@ -564,7 +564,7 @@ datum/projectile_data
/proc/getCardinalAirInfo(var/turf/loc, var/list/stats=list("temperature")) /proc/getCardinalAirInfo(var/turf/loc, var/list/stats=list("temperature"))
var/list/temps = new/list(4) var/list/temps = new/list(4)
for(var/dir in cardinal) for(var/dir in GLOB.cardinal)
var/direction var/direction
switch(dir) switch(dir)
if(NORTH) if(NORTH)

View File

@@ -135,6 +135,6 @@ var/round_start_time = 0
. += CEILING(i*DELTA_CALC, 1) . += CEILING(i*DELTA_CALC, 1)
sleep(i*world.tick_lag*DELTA_CALC) sleep(i*world.tick_lag*DELTA_CALC)
i *= 2 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 #undef DELTA_CALC

View File

@@ -1427,3 +1427,6 @@ var/mob/dview/dview_mob = new
return "Northwest" return "Northwest"
if(337.5) if(337.5)
return "North-Northwest" return "North-Northwest"
/proc/pass()
return

View File

@@ -65,9 +65,9 @@
#define CanInteract(user, state) (CanUseTopic(user, state) == STATUS_INTERACTIVE) #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)]") } #define ARGS_DEBUG log_debug("[__FILE__] - [__LINE__]") ; for(var/arg in args) { log_debug("\t[log_info_line(arg)]") }

View File

@@ -31,7 +31,7 @@
if(owner) if(owner)
Remove(owner) Remove(owner)
target = null target = null
qdel_null(button) QDEL_NULL(button)
return ..() return ..()
/datum/action/proc/Grant(mob/living/T) /datum/action/proc/Grant(mob/living/T)
@@ -48,7 +48,7 @@
if(button) if(button)
if(T.client) if(T.client)
T.client.screen -= button T.client.screen -= button
qdel_null(button) QDEL_NULL(button)
T.actions.Remove(src) T.actions.Remove(src)
T.update_action_buttons() T.update_action_buttons()
owner = null owner = null

View File

@@ -154,7 +154,7 @@ var/const/tk_maxrange = 15
O.anchored = 1 O.anchored = 1
O.density = 0 O.density = 0
O.layer = FLY_LAYER O.layer = FLY_LAYER
O.set_dir(pick(cardinal)) O.set_dir(pick(GLOB.cardinal))
O.icon = 'icons/effects/effects.dmi' O.icon = 'icons/effects/effects.dmi'
O.icon_state = "nothing" O.icon_state = "nothing"
flick("empdisable",O) flick("empdisable",O)

View File

@@ -4,10 +4,10 @@
/datum/controller/process/nanoui/statProcess() /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() /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 var/datum/nanoui/NUI = last_object
if(istype(NUI) && !QDELETED(NUI)) if(istype(NUI) && !QDELETED(NUI))
try try
@@ -16,4 +16,4 @@
catchException(e, NUI) catchException(e, NUI)
else else
catchBadType(NUI) catchBadType(NUI)
nanomanager.processing_uis -= NUI GLOB.nanomanager.processing_uis -= NUI

View File

@@ -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)

View File

@@ -6,7 +6,21 @@
* Odds are, there is a reason * 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 /datum/controller/master
name = "Master" name = "Master"
@@ -48,10 +62,6 @@ var/datum/controller/master/Master = new()
var/static/restart_timeout = 0 var/static/restart_timeout = 0
var/static/restart_count = 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() /datum/controller/master/New()
// Highlander-style: there can only be one! Kill off the old and replace it with the new. // Highlander-style: there can only be one! Kill off the old and replace it with the new.
var/list/_subsystems = list() var/list/_subsystems = list()
@@ -67,6 +77,9 @@ var/datum/controller/master/Master = new()
_subsystems += new I _subsystems += new I
Master = src Master = src
if(!GLOB)
new /datum/controller/global_vars
/datum/controller/master/Destroy() /datum/controller/master/Destroy()
..() ..()
// Tell qdel() to Del() this object. // 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 // -1 if we encountered a runtime trying to recreate it
/proc/Recreate_MC() /proc/Recreate_MC()
. = -1 //so if we runtime, things know we failed . = -1 //so if we runtime, things know we failed
if (world.time < Master.restart_timeout) if (world.time < GLOB.MC_restart_timeout)
return 0 return 0
if (world.time < Master.restart_clear) if (world.time < GLOB.MC_restart_clear)
Master.restart_count *= 0.5 GLOB.MC_restart_count *= 0.5
var/delay = 50 * ++Master.restart_count var/delay = 50 * ++GLOB.MC_restart_count
Master.restart_timeout = world.time + delay GLOB.MC_restart_timeout = world.time + delay
Master.restart_clear = world.time + (delay * 2) GLOB.MC_restart_clear = world.time + (delay * 2)
Master.processing = FALSE //stop ticking this one Master.processing = FALSE //stop ticking this one
try try
new/datum/controller/master() new/datum/controller/master()
@@ -136,6 +149,7 @@ var/datum/controller/master/Master = new()
if (istype(Master.subsystems)) if (istype(Master.subsystems))
if(FireHim) if(FireHim)
Master.subsystems += new BadBoy.type //NEW_SS_GLOBAL will remove the old one Master.subsystems += new BadBoy.type //NEW_SS_GLOBAL will remove the old one
subsystems = Master.subsystems subsystems = Master.subsystems
current_runlevel = Master.current_runlevel current_runlevel = Master.current_runlevel
StartProcessing(10) StartProcessing(10)
@@ -162,13 +176,13 @@ var/datum/controller/master/Master = new()
var/start_timeofday = REALTIMEOFDAY var/start_timeofday = REALTIMEOFDAY
// Initialize subsystems. // 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) for (var/datum/controller/subsystem/SS in subsystems)
if (SS.flags & SS_NO_INIT) if (SS.flags & SS_NO_INIT)
continue continue
SS.Initialize(REALTIMEOFDAY) SS.Initialize(REALTIMEOFDAY)
CHECK_TICK CHECK_TICK
current_ticklimit = TICK_LIMIT_RUNNING GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
var/time = (REALTIMEOFDAY - start_timeofday) / 10 var/time = (REALTIMEOFDAY - start_timeofday) / 10
var/msg = "Initializations complete within [time] second[time == 1 ? "" : "s"]!" 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))) tickdrift = max(0, MC_AVERAGE_FAST(tickdrift, (((REALTIMEOFDAY - init_timeofday) - (world.time - init_time)) / world.tick_lag)))
var/starting_tick_usage = TICK_USAGE var/starting_tick_usage = TICK_USAGE
if (processing <= 0) if (processing <= 0)
current_ticklimit = TICK_LIMIT_RUNNING GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
sleep(10) sleep(10)
continue 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) // (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. 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 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)) sleep(world.tick_lag * (processing * sleep_delta))
continue continue
@@ -332,7 +346,7 @@ var/datum/controller/master/Master = new()
if (!error_level) if (!error_level)
iteration++ iteration++
error_level++ error_level++
current_ticklimit = TICK_LIMIT_RUNNING GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
sleep(10) sleep(10)
continue continue
@@ -344,7 +358,7 @@ var/datum/controller/master/Master = new()
if (!error_level) if (!error_level)
iteration++ iteration++
error_level++ error_level++
current_ticklimit = TICK_LIMIT_RUNNING GLOB.CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
sleep(10) sleep(10)
continue continue
error_level-- error_level--
@@ -355,9 +369,9 @@ var/datum/controller/master/Master = new()
iteration++ iteration++
last_run = world.time last_run = world.time
src.sleep_delta = MC_AVERAGE_FAST(src.sleep_delta, sleep_delta) 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) 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)) 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. // Reduce tick allocation for subsystems that overran on their last tick.
tick_precentage = max(tick_precentage*0.5, tick_precentage-queue_node.tick_overrun) 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)) if (!(queue_node_flags & SS_TICKER))
ran_non_ticker = TRUE ran_non_ticker = TRUE

View File

@@ -125,7 +125,7 @@
debug_variables(alarm_manager) debug_variables(alarm_manager)
feedback_add_details("admin_verb", "DAlarm") feedback_add_details("admin_verb", "DAlarm")
if("Nano") if("Nano")
debug_variables(nanomanager) debug_variables(GLOB.nanomanager)
feedback_add_details("admin_verb", "DNano") feedback_add_details("admin_verb", "DNano")
if("Chemistry") if("Chemistry")
debug_variables(chemistryProcess) debug_variables(chemistryProcess)

View File

@@ -85,7 +85,7 @@
current.verbs -= /datum/changeling/proc/EvolutionMenu current.verbs -= /datum/changeling/proc/EvolutionMenu
current.mind = null 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 if(new_character.mind) //remove any mind currently in our new body's mind variable
new_character.mind.current = null new_character.mind.current = null

View File

@@ -8,7 +8,7 @@
// /old_dir: The dir before the change. // /old_dir: The dir before the change.
// /new_dir: The dir after 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 /decl/observ/dir_set
name = "Direction 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) /atom/movable/Entered(var/atom/movable/am, atom/old_loc)
. = ..() . = ..()
if(. != CANCEL_MOVE_EVENT && dir_set_event.has_listeners(am)) if(. != CANCEL_MOVE_EVENT && GLOB.dir_set_event.has_listeners(am))
dir_set_event.register(src, am, /atom/proc/recursive_dir_set) GLOB.dir_set_event.register(src, am, /atom/proc/recursive_dir_set)
/atom/movable/Exited(var/atom/movable/am, atom/old_loc) /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)

View File

@@ -7,7 +7,7 @@
// /mob/equipper: The mob that equipped the item. // /mob/equipper: The mob that equipped the item.
// /obj/item/item: The equipped item. // /obj/item/item: The equipped item.
// slot: The slot equipped to. // 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 /decl/observ/mob_equipped
name = "Mob Equipped" name = "Mob Equipped"
@@ -22,7 +22,7 @@ var/decl/observ/mob_equipped/mob_equipped_event = new()
// /obj/item/item: The equipped item. // /obj/item/item: The equipped item.
// /mob/equipper: The mob that equipped the item. // /mob/equipper: The mob that equipped the item.
// slot: The slot equipped to. // 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 /decl/observ/item_equipped
name = "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) /obj/item/equipped(var/mob/user, var/slot)
. = ..() . = ..()
mob_equipped_event.raise_event(user, src, slot) GLOB.mob_equipped_event.raise_event(user, src, slot)
item_equipped_event.raise_event(src, user, slot) GLOB.item_equipped_event.raise_event(src, user, slot)

View File

@@ -11,8 +11,8 @@
/proc/register_all_movement(var/event_source, var/listener) /proc/register_all_movement(var/event_source, var/listener)
moved_event.register(event_source, listener, /atom/movable/proc/recursive_move) 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) /proc/unregister_all_movement(var/event_source, var/listener)
moved_event.unregister(event_source, listener, /atom/movable/proc/recursive_move) 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)

View File

@@ -22,7 +22,7 @@
/datum/progressbar/Destroy() /datum/progressbar/Destroy()
if (client) if (client)
client.images -= bar client.images -= bar
qdel_null(bar) QDEL_NULL(bar)
user = null user = null
client = null client = null
return ..() return ..()

View File

@@ -22,7 +22,7 @@
welder.setWelding(1) welder.setWelding(1)
/obj/item/weapon/spell/flame_tongue/Destroy() /obj/item/weapon/spell/flame_tongue/Destroy()
qdel_null(welder) QDEL_NULL(welder)
return ..() return ..()
/obj/item/weapon/weldingtool/spell /obj/item/weapon/weldingtool/spell

View File

@@ -62,7 +62,7 @@
illusion.emote(what_to_emote) illusion.emote(what_to_emote)
/obj/item/weapon/spell/illusion/Destroy() /obj/item/weapon/spell/illusion/Destroy()
qdel_null(illusion) QDEL_NULL(illusion)
copied = null copied = null
return ..() return ..()

View File

@@ -22,8 +22,8 @@
return 1 return 1
/obj/machinery/portable_atmospherics/Destroy() /obj/machinery/portable_atmospherics/Destroy()
qdel_null(air_contents) QDEL_NULL(air_contents)
qdel_null(holding) QDEL_NULL(holding)
. = ..() . = ..()
/obj/machinery/portable_atmospherics/initialize() /obj/machinery/portable_atmospherics/initialize()

View File

@@ -12,8 +12,8 @@
create_fillers() create_fillers()
/obj/machinery/door/airlock/multi_tile/Destroy() /obj/machinery/door/airlock/multi_tile/Destroy()
qdel_null(filler1) QDEL_NULL(filler1)
qdel_null(filler2) QDEL_NULL(filler2)
return ..() return ..()
/obj/machinery/door/airlock/multi_tile/Move() /obj/machinery/door/airlock/multi_tile/Move()

View File

@@ -241,6 +241,7 @@
var/plants_loaded = 0 var/plants_loaded = 0
for(var/obj/G in P.contents) for(var/obj/G in P.contents)
if(accept_check(G)) if(accept_check(G))
P.remove_from_storage(G) //fixes ui bug - Pull Request 5515
stock(G) stock(G)
plants_loaded = 1 plants_loaded = 1
if(plants_loaded) if(plants_loaded)

View File

@@ -36,8 +36,8 @@
visible_message("<span class='notice'>The mask rapidly retracts just before /the [src] is destroyed!</span>") visible_message("<span class='notice'>The mask rapidly retracts just before /the [src] is destroyed!</span>")
breather = null breather = null
qdel_null(tank) QDEL_NULL(tank)
qdel_null(contained) QDEL_NULL(contained)
return ..() return ..()
/obj/machinery/oxygen_pump/MouseDrop(var/mob/living/carbon/human/target, src_location, over_location) /obj/machinery/oxygen_pump/MouseDrop(var/mob/living/carbon/human/target, src_location, over_location)

View File

@@ -28,7 +28,7 @@
update_icon() update_icon()
/obj/machinery/pipelayer/Destroy() /obj/machinery/pipelayer/Destroy()
qdel_null(W) QDEL_NULL(W)
. = ..() . = ..()
/obj/machinery/pipelayer/RefreshParts() /obj/machinery/pipelayer/RefreshParts()

View File

@@ -174,11 +174,11 @@
cell = null cell = null
internal_tank = null internal_tank = null
qdel_null(pr_int_temp_processor) QDEL_NULL(pr_int_temp_processor)
qdel_null(pr_inertial_movement) QDEL_NULL(pr_inertial_movement)
qdel_null(pr_give_air) QDEL_NULL(pr_give_air)
qdel_null(pr_internal_damage) QDEL_NULL(pr_internal_damage)
qdel_null(spark_system) QDEL_NULL(spark_system)
mechas_list -= src //global mech list mechas_list -= src //global mech list
. = ..() . = ..()

View File

@@ -12,7 +12,7 @@
sparks.attach(loc) sparks.attach(loc)
/obj/item/weapon/antag_spawner/Destroy() /obj/item/weapon/antag_spawner/Destroy()
qdel_null(sparks) QDEL_NULL(sparks)
return ..() return ..()
/obj/item/weapon/antag_spawner/proc/spawn_antag(client/C, turf/T) /obj/item/weapon/antag_spawner/proc/spawn_antag(client/C, turf/T)

View File

@@ -149,8 +149,8 @@
..() ..()
/obj/structure/closet/body_bag/cryobag/Destroy() /obj/structure/closet/body_bag/cryobag/Destroy()
qdel_null(syringe) QDEL_NULL(syringe)
qdel_null(tank) QDEL_NULL(tank)
return ..() return ..()
/obj/structure/closet/body_bag/cryobag/open() /obj/structure/closet/body_bag/cryobag/open()

View File

@@ -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 if (src.id && prob(90)) //IDs are kept in 90% of the cases
src.id.forceMove(get_turf(src.loc)) src.id.forceMove(get_turf(src.loc))
else else
qdel_null(src.id) QDEL_NULL(src.id)
qdel_null(src.cartridge) QDEL_NULL(src.cartridge)
qdel_null(src.pai) QDEL_NULL(src.pai)
return ..() return ..()
/obj/item/device/pda/clown/Crossed(AM as mob|obj) //Clown PDA is slippery. /obj/item/device/pda/clown/Crossed(AM as mob|obj) //Clown PDA is slippery.

View File

@@ -79,7 +79,7 @@ var/list/civilian_cartridges = list(
var/list/stored_data = list() var/list/stored_data = list()
/obj/item/weapon/cartridge/Destroy() /obj/item/weapon/cartridge/Destroy()
qdel_null(radio) QDEL_NULL(radio)
return ..() return ..()
/obj/item/weapon/cartridge/engineering /obj/item/weapon/cartridge/engineering

View File

@@ -298,8 +298,8 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
all_communicators -= src all_communicators -= src
processing_objects -= src processing_objects -= src
listening_objects.Remove(src) listening_objects.Remove(src)
qdel_null(camera) QDEL_NULL(camera)
qdel_null(exonet) QDEL_NULL(exonet)
return ..() return ..()

View File

@@ -32,8 +32,8 @@
/obj/item/device/defib_kit/Destroy() /obj/item/device/defib_kit/Destroy()
. = ..() . = ..()
qdel_null(paddles) QDEL_NULL(paddles)
qdel_null(bcell) QDEL_NULL(bcell)
/obj/item/device/defib_kit/loaded //starts with a cell /obj/item/device/defib_kit/loaded //starts with a cell
bcell = /obj/item/weapon/cell/apc bcell = /obj/item/weapon/cell/apc

View File

@@ -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 //Will stop people throwing friend pAIs into the singularity so they can respawn
if(!isnull(pai)) if(!isnull(pai))
pai.death(0) pai.death(0)
qdel_null(radio) QDEL_NULL(radio)
return ..() return ..()
/obj/item/device/paicard/attack_self(mob/user) /obj/item/device/paicard/attack_self(mob/user)

View File

@@ -35,7 +35,7 @@ var/global/list/active_radio_jammers = list()
/obj/item/device/radio_jammer/Destroy() /obj/item/device/radio_jammer/Destroy()
if(on) if(on)
turn_off() turn_off()
qdel_null(power_source) QDEL_NULL(power_source)
return ..() return ..()
/obj/item/device/radio_jammer/get_cell() /obj/item/device/radio_jammer/get_cell()

View File

@@ -27,9 +27,9 @@
/obj/item/weapon/flamethrower/Destroy() /obj/item/weapon/flamethrower/Destroy()
qdel_null(weldtool) QDEL_NULL(weldtool)
qdel_null(igniter) QDEL_NULL(igniter)
qdel_null(ptank) QDEL_NULL(ptank)
. = ..() . = ..()
/obj/item/weapon/flamethrower/process() /obj/item/weapon/flamethrower/process()

View File

@@ -20,8 +20,8 @@
create_reagents(1000) create_reagents(1000)
Destroy() Destroy()
qdel_null(detonator) QDEL_NULL(detonator)
qdel_null_list(beakers) QDEL_NULL_LIST(beakers)
return ..() return ..()
attack_self(mob/user as mob) attack_self(mob/user as mob)

View File

@@ -23,7 +23,7 @@
V.mechassist() V.mechassist()
for(var/L in need_amend) for(var/L in need_amend)
V.add_assistable_langs(L) V.add_assistable_langs(L)
qdel_null(src) QDEL_NULL(src)
/obj/item/weapon/implant/language/get_data() /obj/item/weapon/implant/language/get_data()
var/dat = {" var/dat = {"

View File

@@ -76,5 +76,5 @@
G.epitaph = epitaph G.epitaph = epitaph
G.add_fingerprint(usr) G.add_fingerprint(usr)
G.dir = user.dir G.dir = user.dir
qdel_null(src) QDEL_NULL(src)
return return

View File

@@ -65,7 +65,7 @@
return ..() return ..()
/obj/item/weapon/storage/laundry_basket/dropped(mob/user as mob) /obj/item/weapon/storage/laundry_basket/dropped(mob/user as mob)
qdel_null(linked) QDEL_NULL(linked)
return ..() return ..()
/obj/item/weapon/storage/laundry_basket/show_to(mob/user as mob) /obj/item/weapon/storage/laundry_basket/show_to(mob/user as mob)

View File

@@ -40,14 +40,14 @@
/obj/item/weapon/storage/Destroy() /obj/item/weapon/storage/Destroy()
close_all() close_all()
qdel_null(boxes) QDEL_NULL(boxes)
qdel_null(src.storage_start) QDEL_NULL(src.storage_start)
qdel_null(src.storage_continue) QDEL_NULL(src.storage_continue)
qdel_null(src.storage_end) QDEL_NULL(src.storage_end)
qdel_null(src.stored_start) QDEL_NULL(src.stored_start)
qdel_null(src.stored_continue) QDEL_NULL(src.stored_continue)
qdel_null(src.stored_end) QDEL_NULL(src.stored_end)
qdel_null(closer) QDEL_NULL(closer)
. = ..() . = ..()
/obj/item/weapon/storage/MouseDrop(obj/over_object as obj) /obj/item/weapon/storage/MouseDrop(obj/over_object as obj)

View File

@@ -24,7 +24,7 @@
ion_trail.set_up(src) ion_trail.set_up(src)
/obj/item/weapon/tank/jetpack/Destroy() /obj/item/weapon/tank/jetpack/Destroy()
qdel_null(ion_trail) QDEL_NULL(ion_trail)
return ..() return ..()
/obj/item/weapon/tank/jetpack/examine(mob/user) /obj/item/weapon/tank/jetpack/examine(mob/user)

View File

@@ -70,10 +70,10 @@ var/list/global/tank_gauge_cache = list()
return return
/obj/item/weapon/tank/Destroy() /obj/item/weapon/tank/Destroy()
qdel_null(air_contents) QDEL_NULL(air_contents)
processing_objects.Remove(src) processing_objects.Remove(src)
qdel_null(src.proxyassembly) QDEL_NULL(src.proxyassembly)
if(istype(loc, /obj/item/device/transfer_valve)) if(istype(loc, /obj/item/device/transfer_valve))
var/obj/item/device/transfer_valve/TTV = loc var/obj/item/device/transfer_valve/TTV = loc

View File

@@ -65,7 +65,7 @@
/obj/item/weapon/tool/crowbar/power/Destroy() /obj/item/weapon/tool/crowbar/power/Destroy()
if(counterpart) if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly. counterpart.counterpart = null // So it can qdel cleanly.
qdel_null(counterpart) QDEL_NULL(counterpart)
return ..() return ..()
/obj/item/weapon/tool/crowbar/power/attack_self(mob/user) /obj/item/weapon/tool/crowbar/power/attack_self(mob/user)

View File

@@ -113,7 +113,7 @@
/obj/item/weapon/tool/screwdriver/power/Destroy() /obj/item/weapon/tool/screwdriver/power/Destroy()
if(counterpart) if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly. counterpart.counterpart = null // So it can qdel cleanly.
qdel_null(counterpart) QDEL_NULL(counterpart)
return ..() return ..()
/obj/item/weapon/tool/screwdriver/power/attack_self(mob/user) /obj/item/weapon/tool/screwdriver/power/attack_self(mob/user)

View File

@@ -81,7 +81,7 @@
/obj/item/weapon/tool/wirecutters/power/Destroy() /obj/item/weapon/tool/wirecutters/power/Destroy()
if(counterpart) if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly. counterpart.counterpart = null // So it can qdel cleanly.
qdel_null(counterpart) QDEL_NULL(counterpart)
return ..() return ..()
/obj/item/weapon/tool/wirecutters/power/attack_self(mob/user) /obj/item/weapon/tool/wirecutters/power/attack_self(mob/user)

View File

@@ -59,7 +59,7 @@
/obj/item/weapon/tool/wrench/power/Destroy() /obj/item/weapon/tool/wrench/power/Destroy()
if(counterpart) if(counterpart)
counterpart.counterpart = null // So it can qdel cleanly. counterpart.counterpart = null // So it can qdel cleanly.
qdel_null(counterpart) QDEL_NULL(counterpart)
return ..() return ..()
/obj/item/weapon/tool/wrench/power/attack_self(mob/user) /obj/item/weapon/tool/wrench/power/attack_self(mob/user)

View File

@@ -52,7 +52,7 @@
/obj/machinery/holoplant/proc/deactivate() /obj/machinery/holoplant/proc/deactivate()
overlays -= plant overlays -= plant
qdel_null(plant) QDEL_NULL(plant)
set_light(0) set_light(0)
use_power = 0 use_power = 0

View File

@@ -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. 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) // 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. // These are all default values that will load should the forumdbconfig.txt file fail to read for whatever reason.
var/forumsqladdress = "localhost" var/forumsqladdress = "localhost"

View File

@@ -84,3 +84,111 @@
<option value='?_src_=vars;explode=\ref[src]'>Trigger explosion</option> <option value='?_src_=vars;explode=\ref[src]'>Trigger explosion</option>
<option value='?_src_=vars;emp=\ref[src]'>Trigger EM pulse</option> <option value='?_src_=vars;emp=\ref[src]'>Trigger EM pulse</option>
"} "}
/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 {"
(<a href='?_src_=vars;datumedit=\ref[src];varnameedit=[varname]'>E</a>)
(<a href='?_src_=vars;datumchange=\ref[src];varnamechange=[varname]'>C</a>)
(<a href='?_src_=vars;datummass=\ref[src];varnamemass=[varname]'>M</a>)
[hide_watch ? "" : "(<a href='?_src_=vars;datumwatch=\ref[src];varnamewatch=[varname]'>W</a>)"]
"}
// No mass editing of clients
/client/make_view_variables_variable_entry(var/varname, var/value, var/hide_watch = 0)
return {"
(<a href='?_src_=vars;datumedit=\ref[src];varnameedit=[varname]'>E</a>)
(<a href='?_src_=vars;datumchange=\ref[src];varnamechange=[varname]'>C</a>)
[hide_watch ? "" : "(<a href='?_src_=vars;datumwatch=\ref[src];varnamewatch=[varname]'>W</a>)"]
"}
// 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, "<span class='warning'>\The [src] does not have a var '[var_to_edit]'</span>")
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
)

View File

@@ -254,4 +254,4 @@
if(master.first == src) if(master.first == src)
master.first = null master.first = null
if(next && !next.gc_destroyed) if(next && !next.gc_destroyed)
qdel_null(next) QDEL_NULL(next)

View File

@@ -8,7 +8,7 @@
pockets.max_storage_space = ITEMSIZE_COST_SMALL * 2 pockets.max_storage_space = ITEMSIZE_COST_SMALL * 2
/obj/item/clothing/suit/storage/Destroy() /obj/item/clothing/suit/storage/Destroy()
qdel_null(pockets) QDEL_NULL(pockets)
return ..() return ..()
/obj/item/clothing/suit/storage/attack_hand(mob/user as mob) /obj/item/clothing/suit/storage/attack_hand(mob/user as mob)

View File

@@ -124,7 +124,7 @@
watching_mob = user watching_mob = user
moved_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition) 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) destroyed_event.register(watching_mob, src, /obj/machinery/station_map/proc/stopWatching)
update_use_power(2) update_use_power(2)
@@ -153,7 +153,7 @@
spawn(5) //we give it time to fade out spawn(5) //we give it time to fade out
M.client.images -= holomap_datum.station_map M.client.images -= holomap_datum.station_map
moved_event.unregister(watching_mob, src) 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) destroyed_event.unregister(watching_mob, src)
watching_mob = null watching_mob = null
update_use_power(1) update_use_power(1)

View File

@@ -246,7 +246,7 @@
on_data_written() on_data_written()
/obj/item/integrated_circuit/output/video_camera/Destroy() /obj/item/integrated_circuit/output/video_camera/Destroy()
qdel_null(camera) QDEL_NULL(camera)
return ..() return ..()
/obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(var/status) /obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(var/status)

View File

@@ -146,8 +146,8 @@
if(isrobot(loc)) if(isrobot(loc))
var/mob/living/silicon/robot/borg = loc var/mob/living/silicon/robot/borg = loc
borg.mmi = null borg.mmi = null
qdel_null(radio) QDEL_NULL(radio)
qdel_null(brainmob) QDEL_NULL(brainmob)
return ..() return ..()
/obj/item/device/mmi/radio_enabled /obj/item/device/mmi/radio_enabled

View File

@@ -208,14 +208,14 @@ var/list/ai_verbs_default = list(
/mob/living/silicon/ai/Destroy() /mob/living/silicon/ai/Destroy()
ai_list -= src ai_list -= src
qdel_null(announcement) QDEL_NULL(announcement)
qdel_null(eyeobj) QDEL_NULL(eyeobj)
qdel_null(psupply) QDEL_NULL(psupply)
qdel_null(aiPDA) QDEL_NULL(aiPDA)
qdel_null(aiCommunicator) QDEL_NULL(aiCommunicator)
qdel_null(aiMulti) QDEL_NULL(aiMulti)
qdel_null(aiRadio) QDEL_NULL(aiRadio)
qdel_null(aiCamera) QDEL_NULL(aiCamera)
hack = null hack = null
return ..() return ..()

View File

@@ -13,7 +13,7 @@
if(mind && mind.current == src) if(mind && mind.current == src)
spellremove(src) spellremove(src)
ghostize() ghostize()
qdel_null(plane_holder) QDEL_NULL(plane_holder)
..() ..()
return QDEL_HINT_HARDDEL_NOW return QDEL_HINT_HARDDEL_NOW

View File

@@ -44,7 +44,7 @@
/datum/plane_holder/Destroy() /datum/plane_holder/Destroy()
my_mob = null my_mob = null
qdel_null_list(plane_masters) //Goodbye my children, be free QDEL_NULL_LIST(plane_masters) //Goodbye my children, be free
return ..() return ..()
/datum/plane_holder/proc/set_vis(var/which = null, var/state = FALSE) /datum/plane_holder/proc/set_vis(var/which = null, var/state = FALSE)

View File

@@ -110,7 +110,7 @@
/obj/structure/hoist/Destroy() /obj/structure/hoist/Destroy()
if(hoistee) if(hoistee)
release_hoistee() release_hoistee()
qdel_null(src.source_hook) QDEL_NULL(src.source_hook)
return ..() return ..()
/obj/effect/hoist_hook/Destroy() /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." 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) if(hoistee)
release_hoistee() release_hoistee()
qdel_null(source_hook) QDEL_NULL(source_hook)
/obj/structure/hoist/ex_act(severity) /obj/structure/hoist/ex_act(severity)
switch(severity) switch(severity)

View File

@@ -29,7 +29,7 @@
return QDEL_HINT_QUEUE return QDEL_HINT_QUEUE
/mob/Destroy() /mob/Destroy()
qdel_null(shadow) QDEL_NULL(shadow)
. = ..() . = ..()
/mob/zshadow/examine(mob/user, distance, infix, suffix) /mob/zshadow/examine(mob/user, distance, infix, suffix)

View File

@@ -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 // This is the window/UI manager for Nano UI
// There should only ever be one (global) instance of nanomanger // There should only ever be one (global) instance of nanomanger
/datum/nanomanager /datum/nanomanager

View File

@@ -55,7 +55,7 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain)
brainmob.client.screen.len = null //clear the hud brainmob.client.screen.len = null //clear the hud
/obj/item/organ/internal/brain/Destroy() /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) /obj/item/organ/internal/brain/proc/transfer_identity(var/mob/living/carbon/H)

View File

@@ -30,7 +30,7 @@
default_apply_parts() default_apply_parts()
/obj/machinery/power/tesla_coil/Destroy() /obj/machinery/power/tesla_coil/Destroy()
qdel_null(wires) QDEL_NULL(wires)
return ..() return ..()
/obj/machinery/power/tesla_coil/RefreshParts() /obj/machinery/power/tesla_coil/RefreshParts()

View File

@@ -31,9 +31,9 @@
/obj/item/weapon/gun/magnetic/Destroy() /obj/item/weapon/gun/magnetic/Destroy()
processing_objects.Remove(src) processing_objects.Remove(src)
qdel_null(cell) QDEL_NULL(cell)
qdel_null(loaded) QDEL_NULL(loaded)
qdel_null(capacitor) QDEL_NULL(capacitor)
. = ..() . = ..()
/obj/item/weapon/gun/magnetic/get_cell() /obj/item/weapon/gun/magnetic/get_cell()

View File

@@ -20,7 +20,7 @@
return ..() return ..()
/obj/item/projectile/arc/Destroy() /obj/item/projectile/arc/Destroy()
qdel_null(shadow) QDEL_NULL(shadow)
return ..() return ..()
/obj/item/projectile/arc/Bump(atom/A, forced=0) /obj/item/projectile/arc/Bump(atom/A, forced=0)

View File

@@ -42,7 +42,7 @@
return ..() return ..()
/obj/machinery/shield_gen/Destroy() /obj/machinery/shield_gen/Destroy()
qdel_null_list(field) QDEL_NULL_LIST(field)
return ..() return ..()
/obj/machinery/shield_gen/emag_act(var/remaining_charges, var/mob/user) /obj/machinery/shield_gen/emag_act(var/remaining_charges, var/mob/user)

View File

@@ -50,7 +50,7 @@
//spawn the cell you want in each vehicle //spawn the cell you want in each vehicle
/obj/vehicle/Destroy() /obj/vehicle/Destroy()
qdel_null(riding_datum) QDEL_NULL(riding_datum)
return ..() return ..()
//BUCKLE HOOKS //BUCKLE HOOKS

View File

@@ -18,6 +18,7 @@
#include "code\names.dm" #include "code\names.dm"
#include "code\stylesheet.dm" #include "code\stylesheet.dm"
#include "code\world.dm" #include "code\world.dm"
#include "code\__datastructures\globals.dm"
#include "code\__defines\_compile_options.dm" #include "code\__defines\_compile_options.dm"
#include "code\__defines\_planes+layers.dm" #include "code\__defines\_planes+layers.dm"
#include "code\__defines\_tick.dm" #include "code\__defines\_tick.dm"
@@ -60,6 +61,10 @@
#include "code\_compatibility\509\JSON Writer.dm" #include "code\_compatibility\509\JSON Writer.dm"
#include "code\_compatibility\509\text.dm" #include "code\_compatibility\509\text.dm"
#include "code\_compatibility\509\type2type.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\_global_objects.dm"
#include "code\_helpers\atmospherics.dm" #include "code\_helpers\atmospherics.dm"
#include "code\_helpers\events.dm" #include "code\_helpers\events.dm"
@@ -156,6 +161,7 @@
#include "code\controllers\controller.dm" #include "code\controllers\controller.dm"
#include "code\controllers\emergency_shuttle_controller.dm" #include "code\controllers\emergency_shuttle_controller.dm"
#include "code\controllers\failsafe.dm" #include "code\controllers\failsafe.dm"
#include "code\controllers\globals.dm"
#include "code\controllers\hooks-defs.dm" #include "code\controllers\hooks-defs.dm"
#include "code\controllers\hooks.dm" #include "code\controllers\hooks.dm"
#include "code\controllers\master.dm" #include "code\controllers\master.dm"