mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 02:56:14 +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)
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
/obj/item/modular_computer/proc/add_log(var/text)
|
||||
if(!get_ntnet_status())
|
||||
return 0
|
||||
return ntnet_global.add_log(text, network_card)
|
||||
return GLOB.ntnet_global.add_log(text, network_card)
|
||||
|
||||
/obj/item/modular_computer/proc/shutdown_computer(var/loud = 1)
|
||||
kill_program(1)
|
||||
|
||||
@@ -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
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
@@ -63,7 +63,7 @@ var/global/ntnet_card_uid = 1
|
||||
if(!enabled)
|
||||
return 0
|
||||
|
||||
if(!check_functionality() || !ntnet_global || is_banned())
|
||||
if(!check_functionality() || !GLOB.ntnet_global || is_banned())
|
||||
return 0
|
||||
|
||||
return 2
|
||||
@@ -88,7 +88,7 @@ var/global/ntnet_card_uid = 1
|
||||
return "[identification_string] (NID [identification_id])"
|
||||
|
||||
/obj/item/computer_hardware/network_card/proc/is_banned()
|
||||
return ntnet_global.check_banned(identification_id)
|
||||
return GLOB.ntnet_global.check_banned(identification_id)
|
||||
|
||||
// 0 - No signal, 1 - Low signal, 2 - High signal. 3 - Wired Connection
|
||||
/obj/item/computer_hardware/network_card/proc/get_signal(var/specific_action = 0)
|
||||
@@ -98,13 +98,13 @@ var/global/ntnet_card_uid = 1
|
||||
if(!enabled)
|
||||
return 0
|
||||
|
||||
if(!check_functionality() || !ntnet_global || is_banned())
|
||||
if(!check_functionality() || !GLOB.ntnet_global || is_banned())
|
||||
return 0
|
||||
|
||||
if(ethernet) // Computer is connected via wired connection.
|
||||
return 3
|
||||
|
||||
if(!ntnet_global.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
if(!GLOB.ntnet_global.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
return 0
|
||||
|
||||
if(holder2)
|
||||
@@ -114,7 +114,7 @@ var/global/ntnet_card_uid = 1
|
||||
var/list/zlevels_in_range = using_map.get_map_levels(holderz, FALSE)// VOREStation Edit - , om_range = DEFAULT_OVERMAP_RANGE)
|
||||
var/list/zlevels_in_long_range = using_map.get_map_levels(holderz, TRUE, om_range = DEFAULT_OVERMAP_RANGE) - zlevels_in_range
|
||||
var/best = 0
|
||||
for(var/obj/machinery/ntnet_relay/R as anything in ntnet_global.relays)
|
||||
for(var/obj/machinery/ntnet_relay/R as anything in GLOB.ntnet_global.relays)
|
||||
//Relay is down
|
||||
if(!R.operable())
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user