mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-16 01:25:10 +01:00
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:
@@ -11,8 +11,8 @@ var/global/ntnrc_uid = 0
|
||||
/datum/ntnet_conversation/New()
|
||||
id = ntnrc_uid
|
||||
ntnrc_uid++
|
||||
if(ntnet_global)
|
||||
ntnet_global.chat_channels.Add(src)
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.chat_channels.Add(src)
|
||||
..()
|
||||
|
||||
/datum/ntnet_conversation/proc/add_message(var/message, var/username)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var/global/datum/ntnet/ntnet_global = new()
|
||||
|
||||
|
||||
|
||||
// This is the NTNet datum. There can be only one NTNet datum in game at once. Modular computers read data from this.
|
||||
/datum/ntnet/
|
||||
/datum/ntnet
|
||||
var/list/relays = list()
|
||||
var/list/logs = list()
|
||||
var/list/available_station_software = list()
|
||||
@@ -38,8 +38,8 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
|
||||
// If new NTNet datum is spawned, it replaces the old one.
|
||||
/datum/ntnet/New()
|
||||
if(ntnet_global && (ntnet_global != src))
|
||||
ntnet_global = src // There can be only one.
|
||||
if(GLOB.ntnet_global && (GLOB.ntnet_global != src))
|
||||
GLOB.ntnet_global = src // There can be only one.
|
||||
if (SSatoms && SSatoms.initialized > INITIALIZATION_INSSATOMS)
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.machines)
|
||||
relays.Add(R)
|
||||
@@ -139,7 +139,7 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
// Generates service email list. Currently only used by broadcaster service
|
||||
/datum/ntnet/proc/build_emails_list()
|
||||
for(var/F in subtypesof(/datum/computer_file/data/email_account/service))
|
||||
new F()
|
||||
email_accounts += new F(TRUE)
|
||||
|
||||
// Attempts to find a downloadable file according to filename var
|
||||
/datum/ntnet/proc/find_ntnet_file_by_name(var/filename)
|
||||
@@ -193,7 +193,7 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
add_log("Configuration Updated. Wireless network firewall now [setting_systemcontrol ? "allows" : "disallows"] remote control of station's systems.")
|
||||
|
||||
/datum/ntnet/proc/does_email_exist(var/login)
|
||||
for(var/datum/computer_file/data/email_account/A in ntnet_global.email_accounts)
|
||||
for(var/datum/computer_file/data/email_account/A in GLOB.ntnet_global.email_accounts)
|
||||
if(A.login == login)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
if((dos_overload > dos_capacity) && !dos_failure)
|
||||
dos_failure = 1
|
||||
update_icon()
|
||||
ntnet_global.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
|
||||
GLOB.ntnet_global.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
|
||||
// If the DoS buffer reaches 0 again, restart.
|
||||
if((dos_overload == 0) && dos_failure)
|
||||
dos_failure = 0
|
||||
update_icon()
|
||||
ntnet_global.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
||||
GLOB.ntnet_global.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
||||
..()
|
||||
|
||||
/obj/machinery/ntnet_relay/tgui_interact(mob/user, datum/tgui/ui)
|
||||
@@ -83,16 +83,16 @@
|
||||
dos_overload = 0
|
||||
dos_failure = 0
|
||||
update_icon()
|
||||
ntnet_global.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
||||
GLOB.ntnet_global.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
||||
. = TRUE
|
||||
if("toggle")
|
||||
enabled = !enabled
|
||||
ntnet_global.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
|
||||
GLOB.ntnet_global.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
|
||||
update_icon()
|
||||
. = TRUE
|
||||
if("purge")
|
||||
ntnet_global.banned_nids.Cut()
|
||||
ntnet_global.add_log("Manual override: Network blacklist cleared.")
|
||||
GLOB.ntnet_global.banned_nids.Cut()
|
||||
GLOB.ntnet_global.add_log("Manual override: Network blacklist cleared.")
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/ntnet_relay/Initialize(mapload)
|
||||
@@ -102,15 +102,15 @@
|
||||
|
||||
/obj/machinery/ntnet_relay/Initialize(mapload)
|
||||
. = ..()
|
||||
if(ntnet_global)
|
||||
ntnet_global.relays.Add(src)
|
||||
NTNet = ntnet_global
|
||||
ntnet_global.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.relays.Add(src)
|
||||
NTNet = GLOB.ntnet_global
|
||||
GLOB.ntnet_global.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
|
||||
|
||||
/obj/machinery/ntnet_relay/Destroy()
|
||||
if(ntnet_global)
|
||||
ntnet_global.relays.Remove(src)
|
||||
ntnet_global.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.relays.Remove(src)
|
||||
GLOB.ntnet_global.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
|
||||
NTNet = null
|
||||
for(var/datum/computer_file/program/ntnet_dos/D in dos_sources)
|
||||
D.target = null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/datum/computer_file/data/email_account/
|
||||
/datum/computer_file/data/email_account
|
||||
var/list/inbox = list()
|
||||
var/list/outbox = list()
|
||||
var/list/spam = list()
|
||||
@@ -24,12 +24,13 @@
|
||||
stored_message.calculate_size()
|
||||
size += stored_message.size
|
||||
|
||||
/datum/computer_file/data/email_account/New()
|
||||
ntnet_global.email_accounts.Add(src)
|
||||
/datum/computer_file/data/email_account/New(glob_load)
|
||||
if(!glob_load)
|
||||
GLOB.ntnet_global.email_accounts += src
|
||||
..()
|
||||
|
||||
/datum/computer_file/data/email_account/Destroy()
|
||||
ntnet_global.email_accounts.Remove(src)
|
||||
GLOB.ntnet_global.email_accounts -= src
|
||||
. = ..()
|
||||
|
||||
/datum/computer_file/data/email_account/proc/all_emails()
|
||||
@@ -37,7 +38,7 @@
|
||||
|
||||
/datum/computer_file/data/email_account/proc/send_mail(var/recipient_address, var/datum/computer_file/data/email_message/message, var/relayed = 0)
|
||||
var/datum/computer_file/data/email_account/recipient
|
||||
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.login == recipient_address)
|
||||
recipient = account
|
||||
break
|
||||
@@ -48,12 +49,12 @@
|
||||
if(!recipient.receive_mail(message, relayed))
|
||||
return
|
||||
|
||||
ntnet_global.add_log_with_ids_check("EMAIL LOG: [login] -> [recipient.login] title: [message.title].")
|
||||
GLOB.ntnet_global.add_log_with_ids_check("EMAIL LOG: [login] -> [recipient.login] title: [message.title].")
|
||||
return 1
|
||||
|
||||
/datum/computer_file/data/email_account/proc/receive_mail(var/datum/computer_file/data/email_message/received_message, var/relayed)
|
||||
received_message.set_timestamp()
|
||||
if(!ntnet_global.intrusion_detection_enabled)
|
||||
if(!GLOB.ntnet_global.intrusion_detection_enabled)
|
||||
inbox.Add(received_message)
|
||||
return 1
|
||||
// Spam filters may occassionally let something through, or mark something as spam that isn't spam.
|
||||
@@ -70,10 +71,10 @@
|
||||
return 1
|
||||
|
||||
// Address namespace (@internal-services.nt) for email addresses with special purpose only!.
|
||||
/datum/computer_file/data/email_account/service/
|
||||
/datum/computer_file/data/email_account/service
|
||||
can_login = FALSE
|
||||
|
||||
/datum/computer_file/data/email_account/service/broadcaster/
|
||||
/datum/computer_file/data/email_account/service/broadcaster
|
||||
login = EMAIL_BROADCAST
|
||||
|
||||
/datum/computer_file/data/email_account/service/broadcaster/receive_mail(var/datum/computer_file/data/email_message/received_message, var/relayed)
|
||||
@@ -84,7 +85,7 @@
|
||||
log_and_message_admins("Broadcast email address used by [usr]. Message title: [received_message.title].")
|
||||
|
||||
spawn(0)
|
||||
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)
|
||||
var/datum/computer_file/data/email_message/new_message = received_message.clone()
|
||||
send_mail(email_account.login, new_message, 1)
|
||||
sleep(2)
|
||||
@@ -105,7 +106,7 @@
|
||||
log_and_message_admins("Broadcast email address used by [usr]. Message title: [received_message.title].")
|
||||
|
||||
spawn(0)
|
||||
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)
|
||||
var/datum/computer_file/data/email_message/new_message = received_message.clone()
|
||||
send_mail(email_account.login, new_message, 1)
|
||||
sleep(2)
|
||||
|
||||
Reference in New Issue
Block a user