mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Merge pull request #5502 from Anewbe/glob_is_hungry_for_souls
Partially ports the GLOB system
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
38
code/__datastructures/globals.dm
Normal file
38
code/__datastructures/globals.dm
Normal 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)
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
32
code/_global_vars/lists/mapping.dm
Normal file
32
code/_global_vars/lists/mapping.dm
Normal 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
|
||||
))
|
||||
1
code/_global_vars/misc.dm
Normal file
1
code/_global_vars/misc.dm
Normal file
@@ -0,0 +1 @@
|
||||
GLOBAL_LIST_EMPTY(all_observable_events)
|
||||
2
code/_global_vars/mobs.dm
Normal file
2
code/_global_vars/mobs.dm
Normal file
@@ -0,0 +1,2 @@
|
||||
GLOBAL_LIST_EMPTY(admins) //all clients whom are admins
|
||||
GLOBAL_PROTECT(admins)
|
||||
11
code/_global_vars/sensitive.dm
Normal file
11
code/_global_vars/sensitive.dm
Normal 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.?
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -1427,3 +1427,6 @@ var/mob/dview/dview_mob = new
|
||||
return "Northwest"
|
||||
if(337.5)
|
||||
return "North-Northwest"
|
||||
|
||||
/proc/pass()
|
||||
return
|
||||
@@ -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)]") }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
GLOB.nanomanager.processing_uis -= NUI
|
||||
59
code/controllers/globals.dm
Normal file
59
code/controllers/globals.dm
Normal 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)
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/datum/progressbar/Destroy()
|
||||
if (client)
|
||||
client.images -= bar
|
||||
qdel_null(bar)
|
||||
QDEL_NULL(bar)
|
||||
user = null
|
||||
client = null
|
||||
return ..()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
illusion.emote(what_to_emote)
|
||||
|
||||
/obj/item/weapon/spell/illusion/Destroy()
|
||||
qdel_null(illusion)
|
||||
QDEL_NULL(illusion)
|
||||
copied = null
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
visible_message("<span class='notice'>The mask rapidly retracts just before /the [src] is destroyed!</span>")
|
||||
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)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/pipelayer/Destroy()
|
||||
qdel_null(W)
|
||||
QDEL_NULL(W)
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/pipelayer/RefreshParts()
|
||||
|
||||
@@ -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
|
||||
. = ..()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 = {"
|
||||
|
||||
@@ -76,5 +76,5 @@
|
||||
G.epitaph = epitaph
|
||||
G.add_fingerprint(usr)
|
||||
G.dir = user.dir
|
||||
qdel_null(src)
|
||||
QDEL_NULL(src)
|
||||
return
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
/obj/machinery/holoplant/proc/deactivate()
|
||||
overlays -= plant
|
||||
qdel_null(plant)
|
||||
QDEL_NULL(plant)
|
||||
set_light(0)
|
||||
use_power = 0
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -84,3 +84,111 @@
|
||||
<option value='?_src_=vars;explode=\ref[src]'>Trigger explosion</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
|
||||
)
|
||||
@@ -254,4 +254,4 @@
|
||||
if(master.first == src)
|
||||
master.first = null
|
||||
if(next && !next.gc_destroyed)
|
||||
qdel_null(next)
|
||||
QDEL_NULL(next)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
return QDEL_HINT_QUEUE
|
||||
|
||||
/mob/Destroy()
|
||||
qdel_null(shadow)
|
||||
QDEL_NULL(shadow)
|
||||
. = ..()
|
||||
|
||||
/mob/zshadow/examine(mob/user, distance, infix, suffix)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user