Removes tablet hard drives entirely (HDD & SSD) (#70678)

* Removes HDD's entirely

HDDs have been removed, though the code for it is still currently lingering as it's required for portable disks. I'll have to find a solution to this one day, but as I am going to sleep, this is a problem for future me.

* starts on removing SSD

* updatepaths and kills off SSD

* update path :D

* Fixes to programs and icons

* Ready for review now

I read over everything I did and tried to fix anything I saw wasn't done right. Hopefully better comments now.

* merge conflict  fix

* can't win them all

* takes viruses into account in paths, fixes it in snowcabin

* Renames the updatepaths

* removes the qdel loop

* accidentally new'ed programs twice

* Fix program's computer var

* destroy pen and disk, dont run kill program on something killed

* more fixes for pens and idle threads

* Fixes PDAs installing apps twice.

* simplifies inserted disk & PDA disk

* fuck's sake

* Use istype instead

* revert

* Revert "revert"

This reverts commit 9ede628c6fef9c7c86417234f6d8ada1ff9e2fef.

* why did that happen

* Update code/modules/modular_computers/computers/item/tablet.dm

* MC_SSD added to master lol

Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
This commit is contained in:
John Willard
2022-10-26 00:29:50 +00:00
committed by GitHub
co-authored by ShizCalev
parent 336752b4f7
commit f1f46275f0
70 changed files with 976 additions and 1295 deletions
@@ -28,9 +28,7 @@
computer.visible_message(span_notice("\The [computer]'s screen brightly flashes and loud electrical buzzing is heard."))
computer.enabled = FALSE
computer.update_appearance()
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
var/obj/item/computer_hardware/battery/battery_module = computer.all_components[MC_CELL]
qdel(hard_drive)
computer.take_damage(25, BRUTE, 0, 0)
if(battery_module && prob(25))
qdel(battery_module)
@@ -19,13 +19,12 @@
if(!computer)
return 0
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
var/obj/item/computer_hardware/battery/battery_module = computer.all_components[MC_CELL]
var/list/data = get_header_data()
data["disk_size"] = hard_drive.max_capacity
data["disk_used"] = hard_drive.used_capacity
data["disk_size"] = computer.max_capacity
data["disk_used"] = computer.used_capacity
data["power_usage"] = computer.last_power_usage
data["battery_exists"] = battery_module ? 1 : 0
if(battery_module?.battery)
@@ -18,30 +18,23 @@
if(.)
return
var/obj/item/computer_hardware/hard_drive/HDD = computer.all_components[MC_HDD]
var/obj/item/computer_hardware/hard_drive/RHDD = computer.all_components[MC_SDD]
switch(action)
if("PRG_deletefile")
if(!HDD)
return
var/datum/computer_file/file = HDD.find_file_by_name(params["name"])
var/datum/computer_file/file = computer.find_file_by_name(params["name"])
if(!file || file.undeletable)
return
HDD.remove_file(file)
computer.remove_file(file)
return TRUE
if("PRG_usbdeletefile")
if(!RHDD)
if(!computer.inserted_disk)
return
var/datum/computer_file/file = RHDD.find_file_by_name(params["name"])
var/datum/computer_file/file = computer.find_file_by_name(params["name"], computer.inserted_disk)
if(!file || file.undeletable)
return
RHDD.remove_file(file)
computer.inserted_disk.remove_file(file)
return TRUE
if("PRG_renamefile")
if(!HDD)
return
var/datum/computer_file/file = HDD.find_file_by_name(params["name"])
var/datum/computer_file/file = computer.find_file_by_name(params["name"])
if(!file)
return
var/newname = reject_bad_name(params["new_name"])
@@ -51,9 +44,9 @@
file.filename = newname
return TRUE
if("PRG_usbrenamefile")
if(!RHDD)
if(!computer.inserted_disk)
return
var/datum/computer_file/file = RHDD.find_file_by_name(params["name"])
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"])
@@ -63,43 +56,38 @@
file.filename = newname
return TRUE
if("PRG_copytousb")
if(!HDD || !RHDD)
if(!computer.inserted_disk)
return
var/datum/computer_file/F = HDD.find_file_by_name(params["name"])
var/datum/computer_file/F = computer.find_file_by_name(params["name"])
if(!F)
return
var/datum/computer_file/C = F.clone(FALSE)
RHDD.store_file(C)
computer.inserted_disk.add_file(C)
return TRUE
if("PRG_copyfromusb")
if(!HDD || !RHDD)
if(!computer.inserted_disk)
return
var/datum/computer_file/F = RHDD.find_file_by_name(params["name"])
var/datum/computer_file/F = computer.find_file_by_name(params["name"], computer.inserted_disk)
if(!F || !istype(F))
return
var/datum/computer_file/C = F.clone(FALSE)
HDD.store_file(C)
computer.store_file(C)
return TRUE
if("PRG_togglesilence")
if(!HDD)
return
var/datum/computer_file/program/binary = HDD.find_file_by_name(params["name"])
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 = get_header_data()
var/obj/item/computer_hardware/hard_drive/HDD = computer.all_components[MC_HDD]
var/obj/item/computer_hardware/hard_drive/portable/RHDD = computer.all_components[MC_SDD]
if(error)
data["error"] = error
if(!computer || !HDD)
if(!computer)
data["error"] = "I/O ERROR: Unable to access hard drive."
else
var/list/files = list()
for(var/datum/computer_file/F in HDD.stored_files)
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
@@ -112,18 +100,18 @@
"size" = F.size,
"undeletable" = F.undeletable,
"alert_able" = noisy,
"alert_silenced" = silenced
"alert_silenced" = silenced,
))
data["files"] = files
if(RHDD)
if(computer.inserted_disk)
data["usbconnected"] = TRUE
var/list/usbfiles = list()
for(var/datum/computer_file/F in RHDD.stored_files)
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
"undeletable" = F.undeletable,
))
data["usbfiles"] = usbfiles
@@ -27,7 +27,7 @@
linked_techweb = SSresearch.science_tech
/datum/computer_file/program/scipaper_program/proc/recheck_file_presence()
if(selected_file in holder.stored_files)
if(selected_file in computer.stored_files)
return FALSE
UnregisterSignal(selected_file, COMSIG_MODULAR_COMPUTER_FILE_DELETED)
selected_file = null
@@ -84,7 +84,7 @@
data["allowedTiers"] = list()
data["allowedPartners"] = list()
// Both the file and experiment list are assoc lists. ID as value, display name as keys.
for(var/datum/computer_file/data/ordnance/ordnance_file in holder.stored_files)
for(var/datum/computer_file/data/ordnance/ordnance_file in computer.stored_files)
data["fileList"] += list(ordnance_file.filename = ordnance_file.uid)
if(selected_file)
for (var/possible_experiment in selected_file.possible_experiments)
@@ -180,7 +180,7 @@
if(selected_file)
UnregisterSignal(selected_file, COMSIG_MODULAR_COMPUTER_FILE_DELETED)
paper_to_be.set_experiment() // Clears the paper info.
for(var/datum/computer_file/data/ordnance/ordnance_data in holder.stored_files)
for(var/datum/computer_file/data/ordnance/ordnance_data in computer.stored_files)
if(ordnance_data.uid == params["selected_uid"])
selected_file = ordnance_data
RegisterSignal(selected_file, COMSIG_MODULAR_COMPUTER_FILE_DELETED, .proc/recheck_file_presence)
@@ -53,9 +53,7 @@
if(PRG.available_on_syndinet && !emagged)
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))
if(!computer || !computer.can_store_file(PRG))
return FALSE
ui_header = "downloader_running.gif"
@@ -84,8 +82,7 @@
if(!downloaded_file)
return
generate_network_log("Completed download of file [hacked_download ? "**ENCRYPTED**" : "[downloaded_file.filename].[downloaded_file.filetype]"].")
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
if(!computer || !hard_drive || !hard_drive.store_file(downloaded_file))
if(!computer || !computer.store_file(downloaded_file))
// 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
@@ -146,29 +143,27 @@
data["downloadspeed"] = download_netspeed
data["downloadcompletion"] = round(download_completion, 0.1)
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
data["disk_size"] = hard_drive.max_capacity
data["disk_used"] = hard_drive.used_capacity
data["disk_size"] = computer.max_capacity
data["disk_used"] = computer.used_capacity
data["emagged"] = emagged
var/list/repo = antag_repo | main_repo
var/list/program_categories = list()
for(var/I in repo)
var/datum/computer_file/program/P = I
if(!(P.category in program_categories))
program_categories.Add(P.category)
for(var/datum/computer_file/program/programs as anything in repo)
if(!(programs.category in program_categories))
program_categories.Add(programs.category)
data["programs"] += list(list(
"icon" = P.program_icon,
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"category" = P.category,
"installed" = !!hard_drive.find_file_by_name(P.filename),
"compatible" = check_compatibility(P),
"size" = P.size,
"access" = emagged && P.available_on_syndinet ? TRUE : P.can_run(user,transfer = 1, access = access),
"verifiedsource" = P.available_on_ntnet,
"icon" = programs.program_icon,
"filename" = programs.filename,
"filedesc" = programs.filedesc,
"fileinfo" = programs.extended_desc,
"category" = programs.category,
"installed" = !!computer.find_file_by_name(programs.filename),
"compatible" = check_compatibility(programs),
"size" = programs.size,
"access" = emagged && programs.available_on_syndinet ? TRUE : programs.can_run(user,transfer = 1, access = access),
"verifiedsource" = programs.available_on_ntnet,
))
data["categories"] = show_categories & program_categories
@@ -44,8 +44,6 @@
/// The path for the current loaded image in rsc
var/photo_path
/// Whether or not this app is loaded on a silicon's tablet.
var/is_silicon = FALSE
/// Whether or not we're in a mime PDA.
var/mime_mode = FALSE
/// Whether this app can send messages to all.
@@ -84,10 +82,7 @@
sortmode = /proc/cmp_pdaname_asc
for(var/obj/item/modular_computer/P in sort_list(GLOB.TabletMessengers, sortmode))
var/obj/item/computer_hardware/hard_drive/drive = P.all_components[MC_HDD]
if(!drive)
continue
for(var/datum/computer_file/program/messenger/app in drive.stored_files)
for(var/datum/computer_file/program/messenger/app in P.stored_files)
if(!P.saved_identification || !P.saved_job || app.invisible || app.monitor_hidden)
continue
dictionary += P
@@ -179,17 +174,15 @@
to_chat(usr, span_notice("ERROR: User no longer exists."))
return
var/obj/item/computer_hardware/hard_drive/drive = target.all_components[MC_HDD]
for(var/datum/computer_file/program/messenger/app in drive.stored_files)
for(var/datum/computer_file/program/messenger/app in computer.stored_files)
if(!app.sending_and_receiving && !sending_virus)
to_chat(usr, span_notice("ERROR: Device has receiving disabled."))
return
if(sending_virus)
var/obj/item/computer_hardware/hard_drive/portable/virus/disk = computer.all_components[MC_SDD]
var/obj/item/computer_disk/virus/disk = computer.inserted_disk
if(istype(disk))
disk.send_virus(target, usr)
disk.send_virus(src, target, usr)
return UI_UPDATE
send_message(usr, list(target))
@@ -204,24 +197,29 @@
sending_virus = !sending_virus
return UI_UPDATE
/datum/computer_file/program/messenger/ui_static_data(mob/user)
var/list/data = ..()
data["owner"] = computer.saved_identification
data["ringer_status"] = ringer_status
data["sending_and_receiving"] = sending_and_receiving
data["sortByJob"] = sort_by_job
data["isSilicon"] = issilicon(user)
data["viewing_messages"] = viewing_messages
return data
/datum/computer_file/program/messenger/ui_data(mob/user)
var/list/data = get_header_data()
data["owner"] = computer.saved_identification
data["messages"] = messages
data["ringer_status"] = ringer_status
data["sending_and_receiving"] = sending_and_receiving
data["messengers"] = ScrubMessengerList()
data["viewing_messages"] = viewing_messages
data["sortByJob"] = sort_by_job
data["isSilicon"] = is_silicon
data["photo"] = photo_path
data["canSpam"] = spam_mode
var/obj/item/computer_hardware/hard_drive/portable/virus/disk = computer.all_components[MC_SDD]
if(disk)
data["virus_attach"] = istype(disk, /obj/item/computer_hardware/hard_drive/portable/virus)
var/obj/item/computer_disk/virus/disk = computer.inserted_disk
if(disk && istype(disk))
data["virus_attach"] = TRUE
data["sending_virus"] = sending_virus
return data
@@ -366,11 +364,11 @@
messages += list(message_data)
var/mob/living/L = null
if(holder.holder.loc && isliving(holder.holder.loc))
L = holder.holder.loc
if(computer.loc && isliving(computer.loc))
L = computer.loc
//Maybe they are a pAI!
else
L = get(holder.holder, /mob/living/silicon)
L = get(computer, /mob/living/silicon)
if(L && (L.stat == CONSCIOUS || L.stat == SOFT_CRIT))
var/reply = "(<a href='byond://?src=[REF(src)];choice=[signal.data["rigged"] ? "mess_us_up" : "Message"];skiprefresh=1;target=[signal.data["ref"]]'>Reply</a>)"
@@ -124,15 +124,11 @@
logfile.stored_text = "[logfile.stored_text][logstring]\[BR\]"
logfile.stored_text = "[logfile.stored_text]\[b\]Logfile dump completed.\[/b\]"
logfile.calculate_size()
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
if(!computer || !hard_drive || !hard_drive.store_file(logfile))
if(!computer || !computer.store_file(logfile))
if(!computer)
// This program shouldn't even be runnable without computer.
CRASH("Var computer is null!")
if(!hard_drive)
computer.visible_message(span_warning("\The [computer] shows an \"I/O Error - Hard drive connection error\" warning."))
else // In 99.9% cases this will mean our HDD is full
computer.visible_message(span_warning("\The [computer] shows an \"I/O Error - Hard drive may be full. Please free some space and try again. Required space: [logfile.size]GQ\" warning."))
computer.visible_message(span_warning("\The [computer] shows an \"I/O Error - Hard drive may be full. Please free some space and try again. Required space: [logfile.size]GQ\" warning."))
return TRUE
if("PRG_renamechannel")
if(!authed)
@@ -52,16 +52,11 @@
if("toggle_mass_pda")
if(!SSnetworks.station_network)
return
var/mob/user = ui.user
var/obj/item/modular_computer/target_tablet = locate(params["ref"]) in GLOB.TabletMessengers
if(!istype(target_tablet))
return
var/obj/item/computer_hardware/hard_drive/drive = target_tablet.all_components[MC_HDD]
if(!drive)
to_chat(user, span_boldnotice("Target tablet somehow is lacking a hard drive."))
return
for(var/datum/computer_file/program/messenger/messenger_app in drive.stored_files)
for(var/datum/computer_file/program/messenger/messenger_app in computer.stored_files)
messenger_app.spam_mode = !messenger_app.spam_mode
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
@@ -91,10 +86,7 @@
for(var/obj/item/modular_computer/messenger in GetViewableDevices())
var/list/tablet_data = list()
if(messenger.saved_identification)
var/obj/item/computer_hardware/hard_drive/drive = messenger.all_components[MC_HDD]
if(!drive)
continue
for(var/datum/computer_file/program/messenger/messenger_app in drive.stored_files)
for(var/datum/computer_file/program/messenger/messenger_app in computer.stored_files)
tablet_data["enabled_spam"] += messenger_app.spam_mode
tablet_data["name"] += messenger.saved_identification