mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 19:22:20 +00:00
Integrated circuits for modular computers (#80530) This PR integrates circuits for modular computers and a good bits of their programs. The peculiarity here is that modular computers have no fixed amount of unremovable components (except the base one with just a couple ports for now), instead, they're added and removed along with programs. With a few exceptions (such as the messenger and signaler), for these program circuits to work, their associated program has to be either open or in the background. For a reason or another, not all programs have a circuit associated to them, still, however the programs with a circuit are still a handful. They are: - Nanotrasen Pay System - Notepad - SiliConnect - WireCarp - MODsuit Control - Spectre Meter - Direct Messenger* - LifeConnect - Custodial Locator - Fission360 - Camera - Status Display - SignalCommander *By the by, sending messages has a cooldown, so it shouldn't be as spammy. If it turns out to not be enough, I can make it so messages from circuit will be ignored by other messenger circuits. The PR is no longer WIP. I believe modular computers could make for some interesting setups with circuits, since they're fairly flexible and stocked with features unlike many other appliances, therefore also a speck more abusable, though limits, cooldowns, logging and sanitization have been implemented to keep it in check. 🆑 add: Modular Computers now support integrated circuits. What can be done with them depends on the programs installed and whether they're running (open or background). add: Modular Consoles (the machinery) now have a small backup cell they draw power from if the power goes out. /🆑 Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
119 lines
3.5 KiB
Plaintext
119 lines
3.5 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
|
|
program_flags = NONE
|
|
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
|