Files
Bubberstation/code/modules/modular_computers/computers/item/disks/computer_disk.dm
John Willard f1f46275f0 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>
2022-10-26 00:29:50 +00:00

57 lines
1.6 KiB
Plaintext

/obj/item/computer_disk
name = "data disk"
desc = "Removable disk used to store data."
icon = 'icons/obj/module.dmi'
icon_state = "datadisk6"
w_class = WEIGHT_CLASS_TINY
///The amount of storage space is on the disk
var/max_capacity = 16
///The amount of storage space we've got filled
var/used_capacity = 0
///List of stored files on this drive. DO NOT MODIFY DIRECTLY!
var/list/datum/computer_file/stored_files = list()
///List of all programs that the disk should start with.
var/list/datum/computer_file/starting_programs = list()
/obj/item/computer_disk/Initialize(mapload)
. = ..()
for(var/programs in starting_programs)
var/datum/computer_file/program/program_type = new programs
add_file(program_type)
/**
* add_file
*
* Attempts to add an already existing file to the computer disk, then adds that capacity to the used capicity.
*/
/obj/item/computer_disk/proc/add_file(datum/computer_file/file)
if((file.size + used_capacity) > max_capacity)
return FALSE
stored_files.Add(file)
used_capacity += file.size
return TRUE
/**
* remove_file
*
* Removes an app from the stored_files list, then removes their size from the capacity.
*/
/obj/item/computer_disk/proc/remove_file(datum/computer_file/file)
if(!(file in stored_files))
return FALSE
stored_files.Remove(file)
used_capacity -= file.size
return TRUE
/obj/item/computer_disk/advanced
name = "advanced data disk"
icon_state = "datadisk5"
max_capacity = 64
/obj/item/computer_disk/super
name = "super data disk"
desc = "Removable disk used to store large amounts of data."
icon_state = "datadisk3"
max_capacity = 256