mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-26 18:21:56 +00:00
Makes all global variables handled by the GLOB controller (#13152)
* Handlers converted, now to fix 3532 compile errors * 3532 compile fixes later, got runtimes on startup * Well the server loads now atleast * Take 2 * Oops
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
var/global/file_uid = 0
|
||||
GLOBAL_VAR_INIT(file_uid, 0)
|
||||
|
||||
/datum/computer_file
|
||||
var/filename = "NewFile" // Placeholder. No spacebars
|
||||
@@ -12,8 +12,8 @@ var/global/file_uid = 0
|
||||
|
||||
/datum/computer_file/New()
|
||||
..()
|
||||
uid = file_uid
|
||||
file_uid++
|
||||
uid = GLOB.file_uid
|
||||
GLOB.file_uid++
|
||||
|
||||
/datum/computer_file/Destroy()
|
||||
if(!holder)
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
return 1
|
||||
switch(href_list["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]" == href_list["targid"])
|
||||
target = R
|
||||
return 1
|
||||
@@ -66,14 +66,14 @@
|
||||
if(target)
|
||||
executed = 1
|
||||
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.all_components[MC_NET]
|
||||
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 = 1
|
||||
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 = 1
|
||||
return 1
|
||||
|
||||
/datum/computer_file/program/ntnet_dos/ui_data(mob/user)
|
||||
if(!ntnet_global)
|
||||
if(!GLOB.ntnet_global)
|
||||
return
|
||||
|
||||
var/list/data = get_header_data()
|
||||
@@ -96,7 +96,7 @@
|
||||
data["dos_strings"] += list(list("nums" = string))
|
||||
else
|
||||
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
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
if(job)
|
||||
if(!job_blacklisted(job))
|
||||
if((job.total_positions <= GLOB.player_list.len * (max_relative_positions / 100)))
|
||||
var/delta = (world.time / 10) - time_last_changed_position
|
||||
var/delta = (world.time / 10) - GLOB.time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] < 0))
|
||||
return 1
|
||||
return -2
|
||||
@@ -117,7 +117,7 @@
|
||||
if(job)
|
||||
if(!job_blacklisted(job))
|
||||
if(job.total_positions > job.current_positions)
|
||||
var/delta = (world.time / 10) - time_last_changed_position
|
||||
var/delta = (world.time / 10) - GLOB.time_last_changed_position
|
||||
if((change_position_cooldown < delta) || (opened_positions[job.title] > 0))
|
||||
return 1
|
||||
return -2
|
||||
@@ -180,7 +180,7 @@
|
||||
switch(href_list["action"])
|
||||
if("PRG_modify")
|
||||
if(modify)
|
||||
data_core.manifest_modify(modify.registered_name, modify.assignment)
|
||||
GLOB.data_core.manifest_modify(modify.registered_name, modify.assignment)
|
||||
modify.name = "[modify.registered_name]'s ID Card ([modify.assignment])"
|
||||
card_slot.try_eject(1, user)
|
||||
else
|
||||
@@ -302,7 +302,7 @@
|
||||
var/content
|
||||
if(mode == 2)
|
||||
title = "crew manifest ([station_time_timestamp()])"
|
||||
content = "<h4>Crew Manifest</h4><br>[data_core ? data_core.get_manifest(0) : ""]"
|
||||
content = "<h4>Crew Manifest</h4><br>[GLOB.data_core ? GLOB.data_core.get_manifest(0) : ""]"
|
||||
else if(modify && !mode)
|
||||
title = "access report"
|
||||
content = {"<h4>Access Report</h4>
|
||||
@@ -346,7 +346,7 @@
|
||||
if(can_open_job(j) != 1)
|
||||
return 1
|
||||
if(opened_positions[edit_job_target] >= 0)
|
||||
time_last_changed_position = world.time / 10
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
j.total_positions++
|
||||
opened_positions[edit_job_target]++
|
||||
log_game("[key_name(usr)] has opened a job slot for job \"[j]\".")
|
||||
@@ -362,7 +362,7 @@
|
||||
return 1
|
||||
//Allow instant closing without cooldown if a position has been opened before
|
||||
if(opened_positions[edit_job_target] <= 0)
|
||||
time_last_changed_position = world.time / 10
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
j.total_positions--
|
||||
opened_positions[edit_job_target]--
|
||||
log_game("[key_name(usr)] has closed a job slot for job \"[j]\".")
|
||||
@@ -413,7 +413,7 @@
|
||||
data["mode"] = mode
|
||||
data["printing"] = printing
|
||||
data["printer"] = printer ? TRUE : FALSE
|
||||
data["manifest"] = data_core ? data_core.get_manifest(0) : null
|
||||
data["manifest"] = GLOB.data_core ? GLOB.data_core.get_manifest(0) : null
|
||||
data["target_name"] = modify ? modify.name : "-----"
|
||||
data["target_owner"] = modify && modify.registered_name ? modify.registered_name : "-----"
|
||||
data["target_rank"] = get_target_rank()
|
||||
@@ -429,19 +429,19 @@
|
||||
var/list/job_formats = SSjobs.format_jobs_for_id_computer(modify)
|
||||
|
||||
data["top_jobs"] = format_jobs(list("Captain", "Custom"), data["target_rank"], job_formats)
|
||||
data["engineering_jobs"] = format_jobs(engineering_positions, data["target_rank"], job_formats)
|
||||
data["medical_jobs"] = format_jobs(medical_positions, data["target_rank"], job_formats)
|
||||
data["science_jobs"] = format_jobs(science_positions, data["target_rank"], job_formats)
|
||||
data["security_jobs"] = format_jobs(security_positions, data["target_rank"], job_formats)
|
||||
data["support_jobs"] = format_jobs(support_positions, data["target_rank"], job_formats)
|
||||
data["civilian_jobs"] = format_jobs(civilian_positions, data["target_rank"], job_formats)
|
||||
data["special_jobs"] = format_jobs(whitelisted_positions, data["target_rank"], job_formats)
|
||||
data["engineering_jobs"] = format_jobs(GLOB.engineering_positions, data["target_rank"], job_formats)
|
||||
data["medical_jobs"] = format_jobs(GLOB.medical_positions, data["target_rank"], job_formats)
|
||||
data["science_jobs"] = format_jobs(GLOB.science_positions, data["target_rank"], job_formats)
|
||||
data["security_jobs"] = format_jobs(GLOB.security_positions, data["target_rank"], job_formats)
|
||||
data["support_jobs"] = format_jobs(GLOB.support_positions, data["target_rank"], job_formats)
|
||||
data["civilian_jobs"] = format_jobs(GLOB.civilian_positions, data["target_rank"], job_formats)
|
||||
data["special_jobs"] = format_jobs(GLOB.whitelisted_positions, data["target_rank"], job_formats)
|
||||
data["centcom_jobs"] = format_jobs(get_all_centcom_jobs(), data["target_rank"], job_formats)
|
||||
data["card_skins"] = format_card_skins(get_station_card_skins())
|
||||
|
||||
data["job_slots"] = format_job_slots()
|
||||
|
||||
var/time_to_wait = round(change_position_cooldown - ((world.time / 10) - time_last_changed_position), 1)
|
||||
var/time_to_wait = round(change_position_cooldown - ((world.time / 10) - GLOB.time_last_changed_position), 1)
|
||||
var/mins = round(time_to_wait / 60)
|
||||
var/seconds = time_to_wait - (60*mins)
|
||||
data["cooldown_mins"] = mins
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
/datum/computer_file/program/comm/proc/change_security_level(mob/user, new_level)
|
||||
tmp_alertlevel = new_level
|
||||
var/old_level = security_level
|
||||
var/old_level = GLOB.security_level
|
||||
if(!tmp_alertlevel)
|
||||
tmp_alertlevel = SEC_LEVEL_GREEN
|
||||
if(tmp_alertlevel < SEC_LEVEL_GREEN)
|
||||
@@ -58,10 +58,10 @@
|
||||
if(tmp_alertlevel > SEC_LEVEL_BLUE)
|
||||
tmp_alertlevel = SEC_LEVEL_BLUE //Cannot engage delta with this
|
||||
set_security_level(tmp_alertlevel)
|
||||
if(security_level != old_level)
|
||||
if(GLOB.security_level != old_level)
|
||||
log_game("[key_name(user)] has changed the security level to [get_security_level()].")
|
||||
message_admins("[key_name_admin(user)] has changed the security level to [get_security_level()].")
|
||||
switch(security_level)
|
||||
switch(GLOB.security_level)
|
||||
if(SEC_LEVEL_GREEN)
|
||||
feedback_inc("alert_comms_green", 1)
|
||||
if(SEC_LEVEL_BLUE)
|
||||
@@ -101,7 +101,7 @@
|
||||
ui.set_layout_key("program")
|
||||
ui.open()
|
||||
|
||||
/datum/computer_file/program/comm/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state)
|
||||
/datum/computer_file/program/comm/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
|
||||
var/list/data = get_header_data()
|
||||
data["is_ai"] = isAI(user) || isrobot(user)
|
||||
data["menu_state"] = data["is_ai"] ? ai_menu_state : menu_state
|
||||
@@ -128,7 +128,7 @@
|
||||
)
|
||||
)
|
||||
|
||||
data["security_level"] = security_level
|
||||
data["security_level"] = GLOB.security_level
|
||||
data["str_security_level"] = capitalize(get_security_level())
|
||||
data["levels"] = list(
|
||||
list("id" = SEC_LEVEL_GREEN, "name" = "Green"),
|
||||
@@ -326,7 +326,7 @@
|
||||
Nuke_request(input, usr)
|
||||
to_chat(usr, "<span class='notice'>Request sent.</span>")
|
||||
log_game("[key_name(usr)] has requested the nuclear codes from Centcomm")
|
||||
priority_announcement.Announce("The codes for the on-station nuclear self-destruct have been requested by [usr]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested",'sound/AI/commandreport.ogg')
|
||||
GLOB.priority_announcement.Announce("The codes for the on-station nuclear self-destruct have been requested by [usr]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested",'sound/AI/commandreport.ogg')
|
||||
centcomm_message_cooldown = 1
|
||||
spawn(6000)//10 minute cooldown
|
||||
centcomm_message_cooldown = 0
|
||||
|
||||
@@ -43,6 +43,6 @@
|
||||
data["poweravail"] = powernet.avail
|
||||
data["powerload"] = powernet.viewload
|
||||
data["powerdemand"] = powernet.load
|
||||
data["apcs"] = apc_repository.apc_data(powernet)
|
||||
data["apcs"] = GLOB.apc_repository.apc_data(powernet)
|
||||
|
||||
return data
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
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(!PRG || !istype(PRG))
|
||||
return 0
|
||||
@@ -37,10 +37,10 @@
|
||||
|
||||
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
|
||||
@@ -135,7 +135,7 @@
|
||||
data["disk_size"] = hard_drive.max_capacity
|
||||
data["disk_used"] = hard_drive.used_capacity
|
||||
var/list/all_entries[0]
|
||||
for(var/A in ntnet_global.available_station_software)
|
||||
for(var/A in GLOB.ntnet_global.available_station_software)
|
||||
var/datum/computer_file/program/P = A
|
||||
// Only those programs our user can run will show in the list
|
||||
if(!P.can_run(user,transfer = 1))
|
||||
@@ -151,7 +151,7 @@
|
||||
data["hackedavailable"] = 0
|
||||
if(computer.emagged) // If we are running on emagged computer we have access to some "bonus" software
|
||||
var/list/hacked_programs[0]
|
||||
for(var/S in ntnet_global.available_antag_software)
|
||||
for(var/S in GLOB.ntnet_global.available_antag_software)
|
||||
var/datum/computer_file/program/P = S
|
||||
data["hackedavailable"] = 1
|
||||
hacked_programs.Add(list(list(
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
|
||||
/datum/computer_file/program/chatclient/ui_data(mob/user)
|
||||
if(!ntnet_global || !ntnet_global.chat_channels)
|
||||
if(!GLOB.ntnet_global || !GLOB.ntnet_global.chat_channels)
|
||||
return
|
||||
|
||||
var/list/data = get_header_data()
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
else // Channel selection screen
|
||||
var/list/all_channels[0]
|
||||
for(var/C in ntnet_global.chat_channels)
|
||||
for(var/C in GLOB.ntnet_global.chat_channels)
|
||||
var/datum/ntnet_conversation/conv = C
|
||||
if(conv && conv.title)
|
||||
all_channels.Add(list(list(
|
||||
@@ -108,7 +108,7 @@
|
||||
if("PRG_joinchannel")
|
||||
. = 1
|
||||
var/datum/ntnet_conversation/C
|
||||
for(var/datum/ntnet_conversation/chan in ntnet_global.chat_channels)
|
||||
for(var/datum/ntnet_conversation/chan in GLOB.ntnet_global.chat_channels)
|
||||
if(chan.id == text2num(href_list["id"]))
|
||||
C = chan
|
||||
break
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var/global/nttransfer_uid = 0
|
||||
GLOBAL_VAR_INIT(nttransfer_uid, 0)
|
||||
|
||||
/datum/computer_file/program/nttransfer
|
||||
filename = "nttransfer"
|
||||
@@ -24,8 +24,8 @@ var/global/nttransfer_uid = 0
|
||||
var/upload_menu = 0 // 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()
|
||||
@@ -100,7 +100,7 @@ var/global/nttransfer_uid = 0
|
||||
return 1
|
||||
switch(href_list["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]" == href_list["id"])
|
||||
remote = P
|
||||
break
|
||||
@@ -118,8 +118,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
|
||||
@@ -145,7 +145,7 @@ var/global/nttransfer_uid = 0
|
||||
if(!P.can_run(usr,transfer = 1))
|
||||
error = "Access Error: Insufficient rights to upload file."
|
||||
provided_file = F
|
||||
ntnet_global.fileservers.Add(src)
|
||||
GLOB.ntnet_global.fileservers.Add(src)
|
||||
return
|
||||
error = "I/O Error: Unable to locate file on hard drive."
|
||||
return 1
|
||||
@@ -183,7 +183,7 @@ var/global/nttransfer_uid = 0
|
||||
data["upload_filelist"] = all_files
|
||||
else
|
||||
var/list/all_servers[0]
|
||||
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)
|
||||
all_servers.Add(list(list(
|
||||
"uid" = P.unique_token,
|
||||
"filename" = "[P.provided_file.filename].[P.provided_file.filetype]",
|
||||
|
||||
@@ -24,22 +24,22 @@
|
||||
switch(href_list["action"])
|
||||
if("resetIDS")
|
||||
. = 1
|
||||
if(ntnet_global)
|
||||
ntnet_global.resetIDS()
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.resetIDS()
|
||||
return 1
|
||||
if("toggleIDS")
|
||||
. = 1
|
||||
if(ntnet_global)
|
||||
ntnet_global.toggleIDS()
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.toggleIDS()
|
||||
return 1
|
||||
if("toggleWireless")
|
||||
. = 1
|
||||
if(!ntnet_global)
|
||||
if(!GLOB.ntnet_global)
|
||||
return 1
|
||||
|
||||
// NTNet is disabled. Enabling can be done without user prompt
|
||||
if(ntnet_global.setting_disabled)
|
||||
ntnet_global.setting_disabled = 0
|
||||
if(GLOB.ntnet_global.setting_disabled)
|
||||
GLOB.ntnet_global.setting_disabled = 0
|
||||
return 1
|
||||
|
||||
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
|
||||
@@ -48,43 +48,43 @@
|
||||
return 1
|
||||
var/response = alert(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", "Yes", "No")
|
||||
if(response == "Yes")
|
||||
ntnet_global.setting_disabled = 1
|
||||
GLOB.ntnet_global.setting_disabled = 1
|
||||
return 1
|
||||
if("purgelogs")
|
||||
. = 1
|
||||
if(ntnet_global)
|
||||
ntnet_global.purge_logs()
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.purge_logs()
|
||||
if("updatemaxlogs")
|
||||
. = 1
|
||||
var/mob/user = usr
|
||||
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
|
||||
if(ntnet_global)
|
||||
ntnet_global.update_max_log_count(logcount)
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.update_max_log_count(logcount)
|
||||
if("toggle_function")
|
||||
. = 1
|
||||
if(!ntnet_global)
|
||||
if(!GLOB.ntnet_global)
|
||||
return 1
|
||||
ntnet_global.toggle_function(text2num(href_list["id"]))
|
||||
GLOB.ntnet_global.toggle_function(text2num(href_list["id"]))
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/ui_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()
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user