mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 04:01:41 +00:00
## About The Pull Request I deleted the documentation file of ModPCs because it was barebones and had no new information to give that autodoc couldn't. Just to make sure this isn't a net-negative, I improved on much of the autodoc and comments in general around ModPC code to help people understand easier what's going on around it. I also renamed vars that were too easily confused with other var names, and reworked the ntnet downloader a little; - it now has a search bar - it now has more sections to scroll through, hopefully making it more accurate and easy to find what you need. - also organized the apps that were previously shoved in 'other'. - i also upgraded it to a .tsx because why not video demonstration https://github.com/tgstation/tgstation/assets/53777086/cbba4c1c-b8a8-4ba4-8628-aea8389999fc ## Why It's Good For The Game Adds in a lot of comments that were previously missing, clears up some sources of confusion within ModPC code, and improves NTNet Downloader, something I've procrastinated on doing for a very long time now. ## Changelog 🆑 qol: NTNet Downloader now has a search bar, and programs are now better sorted. /🆑
119 lines
3.6 KiB
Plaintext
119 lines
3.6 KiB
Plaintext
/datum/computer_file/program/filemanager
|
|
filename = "filemanager"
|
|
filedesc = "File Manager"
|
|
extended_desc = "This program allows management of files."
|
|
program_open_overlay = "generic"
|
|
size = 8
|
|
requires_ntnet = FALSE
|
|
available_on_ntnet = FALSE
|
|
undeletable = TRUE
|
|
tgui_id = "NtosFileManager"
|
|
program_icon = "folder"
|
|
|
|
var/open_file
|
|
var/error
|
|
|
|
/datum/computer_file/program/filemanager/ui_act(action, params, datum/tgui/ui, datum/ui_state/state)
|
|
switch(action)
|
|
if("PRG_deletefile")
|
|
var/datum/computer_file/file = computer.find_file_by_name(params["name"])
|
|
if(!file || file.undeletable)
|
|
return
|
|
computer.remove_file(file)
|
|
return TRUE
|
|
if("PRG_usbdeletefile")
|
|
if(!computer.inserted_disk)
|
|
return
|
|
var/datum/computer_file/file = computer.find_file_by_name(params["name"], computer.inserted_disk)
|
|
if(!file || file.undeletable)
|
|
return
|
|
computer.inserted_disk.remove_file(file)
|
|
return TRUE
|
|
if("PRG_renamefile")
|
|
var/datum/computer_file/file = computer.find_file_by_name(params["name"])
|
|
if(!file)
|
|
return
|
|
var/newname = reject_bad_name(params["new_name"])
|
|
if(!newname || newname != params["new_name"])
|
|
playsound(computer, 'sound/machines/terminal_error.ogg', 25, FALSE)
|
|
return
|
|
file.filename = newname
|
|
return TRUE
|
|
if("PRG_usbrenamefile")
|
|
if(!computer.inserted_disk)
|
|
return
|
|
var/datum/computer_file/file = computer.find_file_by_name(params["name"], computer.inserted_disk)
|
|
if(!file)
|
|
return
|
|
var/newname = reject_bad_name(params["new_name"])
|
|
if(!newname || newname != params["new_name"])
|
|
playsound(computer, 'sound/machines/terminal_error.ogg', 25, FALSE)
|
|
return
|
|
file.filename = newname
|
|
return TRUE
|
|
if("PRG_copytousb")
|
|
if(!computer.inserted_disk)
|
|
return
|
|
var/datum/computer_file/F = computer.find_file_by_name(params["name"])
|
|
if(!F)
|
|
return
|
|
if(computer.find_file_by_name(params["name"], computer.inserted_disk))
|
|
return
|
|
var/datum/computer_file/C = F.clone(FALSE)
|
|
computer.inserted_disk.add_file(C)
|
|
return TRUE
|
|
if("PRG_copyfromusb")
|
|
if(!computer.inserted_disk)
|
|
return
|
|
var/datum/computer_file/F = computer.find_file_by_name(params["name"], computer.inserted_disk)
|
|
if(!F || !istype(F))
|
|
return
|
|
if(!computer.can_store_file(F))
|
|
return FALSE
|
|
var/datum/computer_file/C = F.clone(FALSE)
|
|
computer.store_file(C)
|
|
return TRUE
|
|
if("PRG_togglesilence")
|
|
var/datum/computer_file/program/binary = computer.find_file_by_name(params["name"])
|
|
if(!binary || !istype(binary))
|
|
return
|
|
binary.alert_silenced = !binary.alert_silenced
|
|
|
|
/datum/computer_file/program/filemanager/ui_data(mob/user)
|
|
var/list/data = list()
|
|
if(error)
|
|
data["error"] = error
|
|
if(!computer)
|
|
data["error"] = "I/O ERROR: Unable to access hard drive."
|
|
else
|
|
var/list/files = list()
|
|
for(var/datum/computer_file/F as anything in computer.stored_files)
|
|
var/noisy = FALSE
|
|
var/silenced = FALSE
|
|
var/datum/computer_file/program/binary = F
|
|
if(istype(binary))
|
|
noisy = binary.alert_able
|
|
silenced = binary.alert_silenced
|
|
files += list(list(
|
|
"name" = F.filename,
|
|
"type" = F.filetype,
|
|
"size" = F.size,
|
|
"undeletable" = F.undeletable,
|
|
"alert_able" = noisy,
|
|
"alert_silenced" = silenced,
|
|
))
|
|
data["files"] = files
|
|
if(computer.inserted_disk)
|
|
data["usbconnected"] = TRUE
|
|
var/list/usbfiles = list()
|
|
for(var/datum/computer_file/F as anything in computer.inserted_disk.stored_files)
|
|
usbfiles += list(list(
|
|
"name" = F.filename,
|
|
"type" = F.filetype,
|
|
"size" = F.size,
|
|
"undeletable" = F.undeletable,
|
|
))
|
|
data["usbfiles"] = usbfiles
|
|
|
|
return data
|