Modular Cmp Updates
This commit is contained in:
@@ -11,10 +11,11 @@
|
||||
available_on_ntnet = FALSE
|
||||
ui_header = "downloader_finished.gif"
|
||||
tgui_id = "NtosNetDownloader"
|
||||
program_icon = "download"
|
||||
|
||||
var/datum/computer_file/program/downloaded_file = null
|
||||
var/hacked_download = 0
|
||||
var/download_completion = 0 //GQ of downloaded data.
|
||||
var/hacked_download = FALSE
|
||||
var/download_completion = FALSE //GQ of downloaded data.
|
||||
var/download_netspeed = 0
|
||||
var/downloaderror = ""
|
||||
var/obj/item/modular_computer/my_computer = null
|
||||
@@ -36,33 +37,33 @@
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/proc/begin_file_download(filename)
|
||||
if(downloaded_file)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/datum/computer_file/program/PRG = SSnetworks.station_network.find_ntnet_file_by_name(filename)
|
||||
|
||||
if(!PRG || !istype(PRG))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
// Attempting to download antag only program, but without having emagged/syndicate computer. No.
|
||||
if(PRG.available_on_syndinet && !emagged)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
|
||||
|
||||
if(!computer || !hard_drive || !hard_drive.can_store_file(PRG))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
ui_header = "downloader_running.gif"
|
||||
|
||||
if(PRG in main_repo)
|
||||
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.")
|
||||
hacked_download = 0
|
||||
hacked_download = FALSE
|
||||
else if(PRG in antag_repo)
|
||||
generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.")
|
||||
hacked_download = 1
|
||||
hacked_download = TRUE
|
||||
else
|
||||
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from unspecified server.")
|
||||
hacked_download = 0
|
||||
hacked_download = FALSE
|
||||
|
||||
downloaded_file = PRG.clone()
|
||||
|
||||
@@ -71,7 +72,7 @@
|
||||
return
|
||||
generate_network_log("Aborted download of file [hacked_download ? "**ENCRYPTED**" : "[downloaded_file.filename].[downloaded_file.filetype]"].")
|
||||
downloaded_file = null
|
||||
download_completion = 0
|
||||
download_completion = FALSE
|
||||
ui_header = "downloader_finished.gif"
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/proc/complete_file_download()
|
||||
@@ -83,7 +84,7 @@
|
||||
// The download failed
|
||||
downloaderror = "I/O ERROR - Unable to save file. Check whether you have enough free space on your hard drive and whether your hard drive is properly connected. If the issue persists contact your system administrator for assistance."
|
||||
downloaded_file = null
|
||||
download_completion = 0
|
||||
download_completion = FALSE
|
||||
ui_header = "downloader_finished.gif"
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/process_tick()
|
||||
@@ -104,21 +105,22 @@
|
||||
download_completion += download_netspeed
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
switch(action)
|
||||
if("PRG_downloadfile")
|
||||
if(!downloaded_file)
|
||||
begin_file_download(params["filename"])
|
||||
return 1
|
||||
return TRUE
|
||||
if("PRG_reseterror")
|
||||
if(downloaderror)
|
||||
download_completion = 0
|
||||
download_netspeed = 0
|
||||
download_completion = FALSE
|
||||
download_netspeed = FALSE
|
||||
downloaded_file = null
|
||||
downloaderror = ""
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/ui_data(mob/user)
|
||||
my_computer = computer
|
||||
@@ -148,7 +150,7 @@
|
||||
for(var/A in main_repo)
|
||||
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, access = access) || hard_drive.find_file_by_name(P.filename))
|
||||
if(hard_drive.find_file_by_name(P.filename))
|
||||
continue
|
||||
all_entries.Add(list(list(
|
||||
"filename" = P.filename,
|
||||
@@ -156,6 +158,7 @@
|
||||
"fileinfo" = P.extended_desc,
|
||||
"compatibility" = check_compatibility(P),
|
||||
"size" = P.size,
|
||||
"access" = P.can_run(user,transfer = 1, access = access)
|
||||
)))
|
||||
data["hackedavailable"] = FALSE
|
||||
if(emagged) // If we are running on emagged computer we have access to some "bonus" software
|
||||
@@ -169,7 +172,9 @@
|
||||
"filename" = P.filename,
|
||||
"filedesc" = P.filedesc,
|
||||
"fileinfo" = P.extended_desc,
|
||||
"compatibility" = check_compatibility(P),
|
||||
"size" = P.size,
|
||||
"access" = TRUE,
|
||||
)))
|
||||
data["hacked_programs"] = hacked_programs
|
||||
|
||||
@@ -180,13 +185,13 @@
|
||||
/datum/computer_file/program/ntnetdownload/proc/check_compatibility(datum/computer_file/program/P)
|
||||
var/hardflag = computer.hardware_flag
|
||||
|
||||
if(P && P.is_supported_by_hardware(hardflag,0))
|
||||
if(P?.is_supported_by_hardware(hardflag,0))
|
||||
return "Compatible"
|
||||
return "Incompatible!"
|
||||
|
||||
/datum/computer_file/program/ntnetdownload/kill_program(forced)
|
||||
abort_file_download()
|
||||
return ..(forced)
|
||||
return ..()
|
||||
|
||||
////////////////////////
|
||||
//Syndicate Downloader//
|
||||
@@ -199,7 +204,7 @@
|
||||
filedesc = "Software Download Tool"
|
||||
program_icon_state = "generic"
|
||||
extended_desc = "This program allows downloads of software from shared Syndicate repositories"
|
||||
requires_ntnet = 0
|
||||
requires_ntnet = FALSE
|
||||
ui_header = "downloader_finished.gif"
|
||||
tgui_id = "NtosNetDownloader"
|
||||
emagged = TRUE
|
||||
|
||||
Reference in New Issue
Block a user