Downloader Program Improvements (#1389)

The downloader program will no longer show things you already have installed. Clears up some needless clutter, since theres never any reason to download something twice - you can make local copies on the hard drive.

Software lock now works. It didn't before. For the record i still dislike this feature but i fixed it anyway.
Added some information/error messages for when the download list is empty, to explain why
The footer with the version number is now fixed to the bottom of the window instead of floating up
Optimisation: Auto update is now disabled on the software selection menu and enabled when you're downloading something. Saves on needless processing.

Version number incremented
This commit is contained in:
NanakoAC
2017-01-04 01:40:45 +00:00
committed by skull132
parent 402c0b14cf
commit 3bbdb9764b
2 changed files with 68 additions and 26 deletions
@@ -155,40 +155,23 @@
if(prog.downloaderror) // Download errored. Wait until user resets the program.
data["error"] = prog.downloaderror
else if(prog.downloaded_file) // Download running. Wait please..
if (ui)
ui.set_auto_update(1)
data["downloadname"] = prog.downloaded_file.filename
data["downloaddesc"] = prog.downloaded_file.filedesc
data["downloadsize"] = prog.downloaded_file.size
data["downloadspeed"] = prog.download_netspeed //Even if it does update every 2 seconds, this is bad coding on everyone's count. :ree:
data["downloadcompletion"] = round(prog.download_completion, 0.01)
else // No download running, pick file.
if (ui)
ui.set_auto_update(0)//No need for auto updating on the software menu
data["disk_size"] = my_computer.hard_drive.max_capacity
data["disk_used"] = my_computer.hard_drive.used_capacity
var/list/all_entries[0]
if(!my_computer.software_locked) //To lock installation of software on work computers until the IT Department is properly implemented
for(var/datum/computer_file/program/P in ntnet_global.available_station_software)
// Only those programs our user can run will show in the list
if(!P.can_download(user) && P.requires_access_to_download)
continue
all_entries.Add(list(list(
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"size" = P.size
)))
data["hackedavailable"] = 0
if(prog.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)
data["hackedavailable"] = 1
hacked_programs.Add(list(list(
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"size" = P.size
)))
data["hacked_programs"] = hacked_programs
data["downloadable_programs"] = all_entries
data += get_programlist(user)
else
data["downloadable_programs"] = list()
data["locked"] = 1
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_downloader.tmpl", "NTNet Download Program", 575, 700, state = state)
@@ -196,3 +179,52 @@
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/datum/nano_module/program/computer_ntnetdownload/proc/get_programlist(var/mob/user)
var/list/all_entries[0]
var/datum/computer_file/program/ntnetdownload/prog = program
var/list/data = list()
for(var/datum/computer_file/program/P in ntnet_global.available_station_software)
var/installed = 0
for(var/datum/computer_file/program/Q in program.holder.stored_files)
if (istype(P, Q.type))
installed = 1
break
if (!installed)
// Only those programs our user can run will show in the list
if(!P.can_download(user) && P.requires_access_to_download)
continue
all_entries.Add(list(list(
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"size" = P.size
)))
data["hackedavailable"] = 0
if(prog.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)
var/installed = 0
for(var/datum/computer_file/program/Q in program.holder.stored_files)
if (istype(P, Q.type))
installed = 1
break
if (!installed)
data["hackedavailable"] = 1
hacked_programs.Add(list(list(
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"size" = P.size
)))
data["hacked_programs"] = hacked_programs
data["downloadable_programs"] = all_entries
return data