Convert some more globals (#19231)

* move ref lists from world new to ref list creation

* tg styl

* .

* next globals

* ugh

* some more

* pain

* .

* horror

* .

* .

* .

* shoe me

* ye

* .

* eh

* .

* .

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
Kashargul
2026-03-02 23:57:41 +01:00
committed by GitHub
parent ecca95d008
commit 1fcbb216e7
100 changed files with 547 additions and 797 deletions
@@ -44,9 +44,9 @@
if(progress >= target_progress)
reset()
RFID.stored_card.access |= target_access.id
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Unauthorised access to primary keycode database from device: [computer.network_card.get_network_tag()] - downloaded access codes for: [target_access.desc].")
ntnet_global.intrusion_detection_alarm = 1
if(GLOB.ntnet_global.intrusion_detection_enabled)
GLOB.ntnet_global.add_log("IDS WARNING - Unauthorised access to primary keycode database from device: [computer.network_card.get_network_tag()] - downloaded access codes for: [target_access.desc].")
GLOB.ntnet_global.intrusion_detection_alarm = 1
message = "Successfully decrypted and saved operational key codes. Downloaded access codes for: [target_access.desc]"
target_access = null
@@ -72,13 +72,13 @@
return
running = TRUE
target_access = get_access_by_id("[params["access_target"]]")
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Unauthorised access attempt to primary keycode database from device: [computer.network_card.get_network_tag()]")
ntnet_global.intrusion_detection_alarm = TRUE
if(GLOB.ntnet_global.intrusion_detection_enabled)
GLOB.ntnet_global.add_log("IDS WARNING - Unauthorised access attempt to primary keycode database from device: [computer.network_card.get_network_tag()]")
GLOB.ntnet_global.intrusion_detection_alarm = TRUE
return TRUE
/datum/computer_file/program/access_decrypter/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
if(!ntnet_global)
if(!GLOB.ntnet_global)
return
var/list/data = get_header_data()
@@ -41,7 +41,7 @@
..(forced)
/datum/computer_file/program/ntnet_dos/tgui_data(mob/user)
if(!ntnet_global)
if(!GLOB.ntnet_global)
return
var/list/data = get_header_data()
@@ -56,7 +56,7 @@
else
data["target"] = FALSE
data["relays"] = list()
for(var/obj/machinery/ntnet_relay/R in ntnet_global.relays)
for(var/obj/machinery/ntnet_relay/R in GLOB.ntnet_global.relays)
data["relays"] += list(list("id" = R.uid))
data["focus"] = target ? target.uid : null
@@ -67,7 +67,7 @@
return TRUE
switch(action)
if("PRG_target_relay")
for(var/obj/machinery/ntnet_relay/R in ntnet_global.relays)
for(var/obj/machinery/ntnet_relay/R in GLOB.ntnet_global.relays)
if(R.uid == text2num(params["targid"]))
target = R
break
@@ -83,8 +83,8 @@
if(target)
executed = TRUE
target.dos_sources.Add(src)
if(ntnet_global.intrusion_detection_enabled)
if(GLOB.ntnet_global.intrusion_detection_enabled)
var/obj/item/computer_hardware/network_card/network_card = computer.network_card
ntnet_global.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
ntnet_global.intrusion_detection_alarm = TRUE
GLOB.ntnet_global.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
GLOB.ntnet_global.intrusion_detection_alarm = TRUE
return TRUE
@@ -17,6 +17,6 @@
// The program is active and connected to one of the station's networks. Has a very small chance to trigger IDS alarm every tick.
if(prob(0.1))
if(ntnet_global.intrusion_detection_enabled)
ntnet_global.add_log("IDS WARNING - Unauthorised access detected to camera network by device with NID [computer.network_card.get_network_tag()]")
ntnet_global.intrusion_detection_alarm = 1
if(GLOB.ntnet_global.intrusion_detection_enabled)
GLOB.ntnet_global.add_log("IDS WARNING - Unauthorised access detected to camera network by device with NID [computer.network_card.get_network_tag()]")
GLOB.ntnet_global.intrusion_detection_alarm = 1
@@ -27,13 +27,10 @@
/*
General message handling stuff
*/
var/list/comm_message_listeners = list() //We first have to initialize list then we can use it.
var/datum/comm_message_listener/global_message_listener = new //May be used by admins
var/last_message_id = 0
/proc/get_comm_message_id()
last_message_id = last_message_id + 1
return last_message_id
GLOB.last_message_id = GLOB.last_message_id + 1
return GLOB.last_message_id
/proc/post_comm_message(var/message_title, var/message_text)
var/list/message = list()
@@ -41,7 +38,7 @@ var/last_message_id = 0
message["title"] = message_title
message["contents"] = message_text
for(var/datum/comm_message_listener/l in comm_message_listeners)
for(var/datum/comm_message_listener/l in GLOB.comm_message_listeners)
l.Add(message)
/datum/comm_message_listener
@@ -50,7 +47,7 @@ var/last_message_id = 0
/datum/comm_message_listener/New()
..()
messages = list()
comm_message_listeners.Add(src)
GLOB.comm_message_listeners.Add(src)
/datum/comm_message_listener/proc/Add(var/list/message)
messages[++messages.len] = message
@@ -57,7 +57,7 @@
"download_rate" = download_netspeed
)
else // Viewing list of articles
for(var/datum/computer_file/data/news_article/F in ntnet_global.available_news)
for(var/datum/computer_file/data/news_article/F in GLOB.ntnet_global.available_news)
if(!show_archived && F.archived)
continue
all_articles.Add(list(list(
@@ -87,7 +87,7 @@
if(downloading || loaded_article)
return TRUE
for(var/datum/computer_file/data/news_article/N in ntnet_global.available_news)
for(var/datum/computer_file/data/news_article/N in GLOB.ntnet_global.available_news)
if(N.uid == text2num(params["uid"]))
loaded_article = N.clone()
downloading = 1
@@ -37,17 +37,17 @@
if(downloaded_file)
return 0
var/datum/computer_file/program/PRG = ntnet_global.find_ntnet_file_by_name(filename)
var/datum/computer_file/program/PRG = GLOB.ntnet_global.find_ntnet_file_by_name(filename)
if(!check_file_download(filename))
return 0
ui_header = "downloader_running.gif"
if(PRG in ntnet_global.available_station_software)
if(PRG in GLOB.ntnet_global.available_station_software)
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.")
hacked_download = 0
else if(PRG in ntnet_global.available_antag_software)
else if(PRG in GLOB.ntnet_global.available_antag_software)
generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.")
hacked_download = 1
else
@@ -58,7 +58,7 @@
/datum/computer_file/program/ntnetdownload/proc/check_file_download(var/filename)
//returns 1 if file can be downloaded, returns 0 if download prohibited
var/datum/computer_file/program/PRG = ntnet_global.find_ntnet_file_by_name(filename)
var/datum/computer_file/program/PRG = GLOB.ntnet_global.find_ntnet_file_by_name(filename)
if(!PRG || !istype(PRG))
return 0
@@ -154,7 +154,7 @@
data["disk_size"] = my_computer.hard_drive.max_capacity
data["disk_used"] = my_computer.hard_drive.used_capacity
var/list/all_entries[0]
for(var/datum/computer_file/program/P in ntnet_global.available_station_software)
for(var/datum/computer_file/program/P in GLOB.ntnet_global.available_station_software)
// Only those programs our user can run will show in the list
if(!P.can_run(user) && P.requires_access_to_download || my_computer.hard_drive.find_file_by_name(P.filename))
continue
@@ -169,7 +169,7 @@
data["hackedavailable"] = FALSE
if(computer_emagged) // If we are running on emagged computer we have access to some "bonus" software
var/list/hacked_programs[0]
for(var/datum/computer_file/program/P in ntnet_global.available_antag_software)
for(var/datum/computer_file/program/P in GLOB.ntnet_global.available_antag_software)
if(my_computer.hard_drive.find_file_by_name(P.filename))
continue
data["hackedavailable"] = TRUE
@@ -30,7 +30,7 @@
if(..())
return
var/datum/ntnet_conversation/channel = ntnet_global.get_chat_channel_by_id(active_channel)
var/datum/ntnet_conversation/channel = GLOB.ntnet_global.get_chat_channel_by_id(active_channel)
var/authed = FALSE
if(channel && ((channel.operator == src) || netadmin_mode))
authed = TRUE
@@ -59,7 +59,7 @@
return TRUE
active_channel = new_target
channel = ntnet_global.get_chat_channel_by_id(new_target)
channel = GLOB.ntnet_global.get_chat_channel_by_id(new_target)
if(!(src in channel.clients) && !channel.password)
channel.add_client(src)
return TRUE
@@ -85,7 +85,7 @@
channel.remove_client(src) // We shouldn't be in channel's user list, but just in case...
return TRUE
if(isliving(ui.user) && can_run(ui.user, TRUE, ACCESS_NETWORK))
for(var/datum/ntnet_conversation/chan as anything in ntnet_global.chat_channels)
for(var/datum/ntnet_conversation/chan as anything in GLOB.ntnet_global.chat_channels)
chan.remove_client(src)
netadmin_mode = TRUE
return TRUE
@@ -93,7 +93,7 @@
var/newname = sanitize(params["new_name"])
if(!newname)
return
for(var/datum/ntnet_conversation/chan as anything in ntnet_global.chat_channels)
for(var/datum/ntnet_conversation/chan as anything in GLOB.ntnet_global.chat_channels)
if(src in chan.clients)
chan.add_status_message("[username] is now known as [newname].")
username = newname
@@ -148,7 +148,7 @@
/datum/computer_file/program/chatclient/process_tick()
..()
var/datum/ntnet_conversation/channel = ntnet_global.get_chat_channel_by_id(active_channel)
var/datum/ntnet_conversation/channel = GLOB.ntnet_global.get_chat_channel_by_id(active_channel)
if(program_state != PROGRAM_STATE_KILLED)
ui_header = "ntnrc_idle.gif"
if(channel)
@@ -163,7 +163,7 @@
ui_header = "ntnrc_idle.gif"
/datum/computer_file/program/chatclient/kill_program(forced = FALSE)
for(var/datum/ntnet_conversation/channel as anything in ntnet_global.chat_channels)
for(var/datum/ntnet_conversation/channel as anything in GLOB.ntnet_global.chat_channels)
channel.remove_client(src)
..()
@@ -173,13 +173,13 @@
return data
/datum/computer_file/program/chatclient/tgui_data(mob/user)
if(!ntnet_global || !ntnet_global.chat_channels)
if(!GLOB.ntnet_global || !GLOB.ntnet_global.chat_channels)
return list()
var/list/data = get_header_data()
var/list/all_channels = list()
for(var/datum/ntnet_conversation/conv as anything in ntnet_global.chat_channels)
for(var/datum/ntnet_conversation/conv as anything in GLOB.ntnet_global.chat_channels)
if(conv && conv.title)
all_channels.Add(list(list(
"chan" = conv.title,
@@ -190,7 +190,7 @@
data["active_channel"] = active_channel
data["username"] = username
data["adminmode"] = netadmin_mode
var/datum/ntnet_conversation/channel = ntnet_global.get_chat_channel_by_id(active_channel)
var/datum/ntnet_conversation/channel = GLOB.ntnet_global.get_chat_channel_by_id(active_channel)
if(channel)
data["title"] = channel.title
var/authed = FALSE
@@ -1,4 +1,4 @@
var/global/nttransfer_uid = 0
GLOBAL_VAR_INIT(nttransfer_uid, 0)
/datum/computer_file/program/nttransfer
filename = "nttransfer"
@@ -27,8 +27,8 @@ var/global/nttransfer_uid = 0
var/upload_menu = FALSE // Whether we show the program list and upload menu
/datum/computer_file/program/nttransfer/New()
unique_token = nttransfer_uid
nttransfer_uid++
unique_token = GLOB.nttransfer_uid
GLOB.nttransfer_uid++
..()
/datum/computer_file/program/nttransfer/process_tick()
@@ -109,7 +109,7 @@ var/global/nttransfer_uid = 0
data["servers"] = list()
if(!(downloaded_file || provided_file || upload_menu))
var/list/all_servers = list()
for(var/datum/computer_file/program/nttransfer/P in ntnet_global.fileservers)
for(var/datum/computer_file/program/nttransfer/P in GLOB.ntnet_global.fileservers)
if(!P.provided_file)
continue
all_servers.Add(list(list(
@@ -127,7 +127,7 @@ var/global/nttransfer_uid = 0
return TRUE
switch(action)
if("PRG_downloadfile")
for(var/datum/computer_file/program/nttransfer/P in ntnet_global.fileservers)
for(var/datum/computer_file/program/nttransfer/P in GLOB.ntnet_global.fileservers)
if(P.unique_token == text2num(params["uid"]))
remote = P
break
@@ -145,8 +145,8 @@ var/global/nttransfer_uid = 0
error = ""
upload_menu = 0
finalize_download()
if(src in ntnet_global.fileservers)
ntnet_global.fileservers.Remove(src)
if(src in GLOB.ntnet_global.fileservers)
GLOB.ntnet_global.fileservers.Remove(src)
for(var/datum/computer_file/program/nttransfer/T in connected_clients)
T.crash_download("Remote server has forcibly closed the connection")
provided_file = null
@@ -167,7 +167,7 @@ var/global/nttransfer_uid = 0
error = "I/O Error: File locked."
return
provided_file = F
ntnet_global.fileservers |= src
GLOB.ntnet_global.fileservers |= src
return
error = "I/O Error: Unable to locate file on hard drive."
return TRUE
@@ -50,7 +50,7 @@
data["messages"] = all_messages
var/list/all_accounts = list()
for(var/datum/computer_file/data/email_account/account in ntnet_global.email_accounts)
for(var/datum/computer_file/data/email_account/account in GLOB.ntnet_global.email_accounts)
if(!account.can_login)
continue
all_accounts.Add(list(list(
@@ -85,7 +85,7 @@
return TRUE
current_account.suspended = !current_account.suspended
ntnet_global.add_log_with_ids_check("EMAIL LOG: SA-EDIT Account [current_account.login] has been [current_account.suspended ? "" : "un" ]suspended by SA [I.registered_name] ([I.assignment]).")
GLOB.ntnet_global.add_log_with_ids_check("EMAIL LOG: SA-EDIT Account [current_account.login] has been [current_account.suspended ? "" : "un" ]suspended by SA [I.registered_name] ([I.assignment]).")
error = "Account [current_account.login] has been [current_account.suspended ? "" : "un" ]suspended."
return TRUE
@@ -97,7 +97,7 @@
if(!newpass)
return TRUE
current_account.password = newpass
ntnet_global.add_log_with_ids_check("EMAIL LOG: SA-EDIT Password for account [current_account.login] has been changed by SA [I.registered_name] ([I.assignment]).")
GLOB.ntnet_global.add_log_with_ids_check("EMAIL LOG: SA-EDIT Password for account [current_account.login] has been changed by SA [I.registered_name] ([I.assignment]).")
return TRUE
if("viewmail")
@@ -111,7 +111,7 @@
return TRUE
if("viewaccount")
for(var/datum/computer_file/data/email_account/email_account in ntnet_global.email_accounts)
for(var/datum/computer_file/data/email_account/email_account in GLOB.ntnet_global.email_accounts)
if(email_account.uid == text2num(params["viewaccount"]))
current_account = email_account
break
@@ -126,7 +126,7 @@
return TRUE
var/complete_login = "[newlogin]@[newdomain]"
if(ntnet_global.does_email_exist(complete_login))
if(GLOB.ntnet_global.does_email_exist(complete_login))
error = "Error creating account: An account with same address already exists."
return TRUE
@@ -13,29 +13,29 @@
category = PROG_ADMIN
/datum/computer_file/program/ntnetmonitor/tgui_data(mob/user)
if(!ntnet_global)
if(!GLOB.ntnet_global)
return
var/list/data = get_header_data()
data["ntnetstatus"] = ntnet_global.check_function()
data["ntnetrelays"] = ntnet_global.relays.len
data["idsstatus"] = ntnet_global.intrusion_detection_enabled
data["idsalarm"] = ntnet_global.intrusion_detection_alarm
data["ntnetstatus"] = GLOB.ntnet_global.check_function()
data["ntnetrelays"] = GLOB.ntnet_global.relays.len
data["idsstatus"] = GLOB.ntnet_global.intrusion_detection_enabled
data["idsalarm"] = GLOB.ntnet_global.intrusion_detection_alarm
data["config_softwaredownload"] = ntnet_global.setting_softwaredownload
data["config_peertopeer"] = ntnet_global.setting_peertopeer
data["config_communication"] = ntnet_global.setting_communication
data["config_systemcontrol"] = ntnet_global.setting_systemcontrol
data["config_softwaredownload"] = GLOB.ntnet_global.setting_softwaredownload
data["config_peertopeer"] = GLOB.ntnet_global.setting_peertopeer
data["config_communication"] = GLOB.ntnet_global.setting_communication
data["config_systemcontrol"] = GLOB.ntnet_global.setting_systemcontrol
data["ntnetlogs"] = list()
data["minlogs"] = MIN_NTNET_LOGS
data["maxlogs"] = MAX_NTNET_LOGS
data["banned_nids"] = list(ntnet_global.banned_nids)
data["banned_nids"] = list(GLOB.ntnet_global.banned_nids)
for(var/i in ntnet_global.logs)
for(var/i in GLOB.ntnet_global.logs)
data["ntnetlogs"] += list(list("entry" = i))
data["ntnetmaxlogs"] = ntnet_global.setting_maxlogcount
data["ntnetmaxlogs"] = GLOB.ntnet_global.setting_maxlogcount
return data
@@ -44,51 +44,51 @@
return
switch(action)
if("resetIDS")
if(ntnet_global)
ntnet_global.resetIDS()
if(GLOB.ntnet_global)
GLOB.ntnet_global.resetIDS()
return TRUE
if("toggleIDS")
if(ntnet_global)
ntnet_global.toggleIDS()
if(GLOB.ntnet_global)
GLOB.ntnet_global.toggleIDS()
return TRUE
if("toggleWireless")
if(!ntnet_global)
if(!GLOB.ntnet_global)
return
// NTNet is disabled. Enabling can be done without user prompt
if(ntnet_global.setting_disabled)
ntnet_global.setting_disabled = FALSE
if(GLOB.ntnet_global.setting_disabled)
GLOB.ntnet_global.setting_disabled = FALSE
return TRUE
var/response = tgui_alert(ui.user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", list("Yes", "No"))
if(response == "Yes" && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
ntnet_global.setting_disabled = TRUE
GLOB.ntnet_global.setting_disabled = TRUE
return TRUE
if("purgelogs")
if(ntnet_global)
ntnet_global.purge_logs()
if(GLOB.ntnet_global)
GLOB.ntnet_global.purge_logs()
return TRUE
if("updatemaxlogs")
var/logcount = params["new_number"]
if(ntnet_global)
ntnet_global.update_max_log_count(logcount)
if(GLOB.ntnet_global)
GLOB.ntnet_global.update_max_log_count(logcount)
return TRUE
if("toggle_function")
if(!ntnet_global)
if(!GLOB.ntnet_global)
return
ntnet_global.toggle_function(text2num(params["id"]))
GLOB.ntnet_global.toggle_function(text2num(params["id"]))
return TRUE
if("ban_nid")
if(!ntnet_global)
if(!GLOB.ntnet_global)
return
var/nid = tgui_input_number(ui.user,"Enter NID of device which you want to block from the network:", "Enter NID")
if(nid && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
ntnet_global.banned_nids |= nid
GLOB.ntnet_global.banned_nids |= nid
return TRUE
if("unban_nid")
if(!ntnet_global)
if(!GLOB.ntnet_global)
return
var/nid = tgui_input_number(ui.user,"Enter NID of device which you want to unblock from the network:", "Enter NID")
if(nid && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
ntnet_global.banned_nids -= nid
GLOB.ntnet_global.banned_nids -= nid
return TRUE