Turn more unmanaged global vars into GLOB (#20446)

Turned a ton of unmanaged globals into managed globals.
Refactored some UT output.
Removed some unused things, including vars.
Added a test to ensure people don't keep adding new unmanaged vars.
This commit is contained in:
Fluffy
2025-02-17 23:34:02 +00:00
committed by GitHub
parent eff1fb22de
commit 7265630dde
377 changed files with 1893 additions and 2288 deletions
+2 -2
View File
@@ -71,8 +71,8 @@
LOG_DEBUG("API: Throttling bypassed - IP [addr] is whitelisted.")
return FALSE
var/last_time = world_api_rate_limit[addr]
world_api_rate_limit[addr] = REALTIMEOFDAY
var/last_time = GLOB.world_api_rate_limit[addr]
GLOB.world_api_rate_limit[addr] = REALTIMEOFDAY
if (last_time != null && abs(last_time - REALTIMEOFDAY) < GLOB.config.api_rate_limit)
return TRUE
+1 -1
View File
@@ -37,7 +37,7 @@
if (G.client)
P = G.client.prefs
else if (G.ckey)
P = preferences_datums[G.ckey]
P = GLOB.preferences_datums[G.ckey]
else
statuscode = 500
response = "Something went wrong, couldn't find the target's preferences datum"
+7 -7
View File
@@ -6,7 +6,7 @@
/datum/topic_command/get_faxmachines/run_command(queryparams)
var/list/faxlocations = list()
for (var/obj/machinery/photocopier/faxmachine/F in allfaxes)
for (var/obj/machinery/photocopier/faxmachine/F in GLOB.allfaxes)
faxlocations.Add(F.department)
statuscode = 200
@@ -26,9 +26,9 @@
var/list/faxes = list()
switch (queryparams["faxtype"])
if ("received")
faxes = arrived_faxes
faxes = GLOB.arrived_faxes
if ("sent")
faxes = sent_faxes
faxes = GLOB.sent_faxes
if (!faxes || !faxes.len)
statuscode = 404
@@ -60,9 +60,9 @@
var/list/faxes = list()
switch (queryparams["faxtype"])
if ("received")
faxes = arrived_faxes
faxes = GLOB.arrived_faxes
if ("sent")
faxes = sent_faxes
faxes = GLOB.sent_faxes
if (!faxes || !faxes.len)
statuscode = 500
@@ -207,7 +207,7 @@
var/notifyresult = 1
//Send the fax
for (var/obj/machinery/photocopier/faxmachine/F in allfaxes)
for (var/obj/machinery/photocopier/faxmachine/F in GLOB.allfaxes)
if (F.department in targetlist)
sendresult = send_fax(F, faxtitle, faxbody, senderkey, stamptext)
if (sendresult == 1)
@@ -256,7 +256,7 @@
if(F.receivefax(P))
log_and_message_admins("[senderkey] sent a fax message to the [F.department] fax machine via the api. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[F.x];Y=[F.y];Z=[F.z]'>JMP</a>)")
sent_faxes += P
GLOB.sent_faxes += P
return TRUE
else
qdel(P)
+4 -4
View File
@@ -181,12 +181,12 @@
)
/datum/topic_command/auth_client/run_command(queryparams)
if(!(queryparams["clienttoken"] in unauthed))
if(!(queryparams["clienttoken"] in GLOB.unauthed))
statuscode = 404
response = "Client with such token is not found."
return TRUE
var/mob/abstract/unauthed/una = unauthed[queryparams["clienttoken"]]
var/mob/abstract/unauthed/una = GLOB.unauthed[queryparams["clienttoken"]]
if(!istype(una) || !una.client)
statuscode = 500
response = "Somethnig went horribly wrong."
@@ -217,12 +217,12 @@
)
/datum/topic_command/get_auth_client_ip/run_command(queryparams)
if(!(queryparams["clienttoken"] in unauthed))
if(!(queryparams["clienttoken"] in GLOB.unauthed))
statuscode = 404
response = "Unauthed client with such token is not found."
return TRUE
var/mob/abstract/unauthed/una = unauthed[queryparams["clienttoken"]]
var/mob/abstract/unauthed/una = GLOB.unauthed[queryparams["clienttoken"]]
if(!istype(una) || !una.client)
statuscode = 500
@@ -16,7 +16,7 @@
s["roundduration"] = get_round_duration_formatted()
s["gameid"] = GLOB.round_id
s["game_state"] = SSticker ? SSticker.current_state : 0
s["transferring"] = evacuation_controller?.is_evacuating()
s["transferring"] = GLOB.evacuation_controller?.is_evacuating()
s["players"] = GLOB.clients.len
s["staff"] = GLOB.staff.len