mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-13 00:47:31 +01:00
5c7a012e8b
- Abstracts edit and rename function in the File Manager. - Files are now edited in the program and not a separate input box. - File editor now has an editor toolbar with formatting buttons and keybind functionality. - File descriptions can now be edited. - Forms can now be downloaded into a computer's file manager as a text file. - File browser now shows a file description. - Fixed an issue where copying to/from a USB would throw an error because it didn't read the ID of the device being held. I was planning to add folder functionality, but that requires far more work since we store our files directly into the hard drive, which does file manipulation. Meaning, in order to add folders, I'd need to completely redo how hard drives and the file structure works. I'll tackle that later. CCIA Forms currently generate the entire form, which can be edited without reservation. This is fine, however a future PR may be viable for converting forms to use limited edit-access on fields to streamline the form-filling process. That or just adding the ability for files to display [field] properly. Forms tested by Fabian :) - [x] Fix ID check for copying programs to/from work devices - [x] Add editor/formatting functionality - [x] Test Forms functionality (unless an ultra cool dev can for me :) ) - [x] Add description box for editing - [x] Add actually good formatting to editing - [x] Misc bugtesting with encrypting, decrypting - [x] Fix USB files sticking in browser after USB is removed <details><summary>Video</summary> <p> https://github.com/user-attachments/assets/c6c666de-18fd-41a0-9751-3961aeda48fc </p> </details> --------- Signed-off-by: CatsinHD <31459154+CatsinHD@users.noreply.github.com>
65 lines
1.9 KiB
Plaintext
65 lines
1.9 KiB
Plaintext
GLOBAL_VAR_INIT(file_uid, 0)
|
|
|
|
/datum/computer_file
|
|
/// Placehard_drive. No spacebars
|
|
var/filename = "NewFile"
|
|
/// File full names are [filename].[filetype] so like NewFile.XXX in this case
|
|
var/filetype = "XXX"
|
|
/// Description of the file, shown in file browser.
|
|
var/filedesc = null
|
|
/// File size in GQ. Integers only!
|
|
var/size = 1
|
|
/// Harddrive that contains this file.
|
|
var/obj/item/computer_hardware/hard_drive/hard_drive
|
|
/// Whether the file may be sent to someone via NTNet transfer or other means.
|
|
var/unsendable = FALSE
|
|
/// Whether the file may be deleted. Setting to 1 prevents deletion/renaming/etc.
|
|
var/undeletable = FALSE
|
|
/// Placeholder for password protected files.
|
|
var/password = ""
|
|
/// UID of this file
|
|
var/uid
|
|
|
|
/datum/computer_file/New()
|
|
..()
|
|
uid = GLOB.file_uid
|
|
GLOB.file_uid++
|
|
|
|
/datum/computer_file/Destroy()
|
|
if(!hard_drive)
|
|
return ..()
|
|
|
|
hard_drive.remove_file(src, TRUE)
|
|
// hard_drive.hard_drive is the computer that has drive installed. If we are Destroy()ing program that's currently running kill it.
|
|
if(hard_drive.parent_computer?.active_program == src)
|
|
hard_drive.parent_computer.kill_program(TRUE)
|
|
hard_drive = null
|
|
return ..()
|
|
|
|
// Returns independent copy of this file.
|
|
/datum/computer_file/proc/clone(var/rename = FALSE, var/computer)
|
|
var/datum/computer_file/temp = new type(computer)
|
|
temp.unsendable = unsendable
|
|
temp.undeletable = undeletable
|
|
temp.size = size
|
|
temp.password = password
|
|
if(rename)
|
|
temp.filename = filename + "(Copy)"
|
|
else
|
|
temp.filename = filename
|
|
if(filedesc)
|
|
temp.filedesc = filedesc
|
|
temp.filetype = filetype
|
|
return temp
|
|
|
|
/datum/computer_file/proc/can_access_file(var/mob/user, input_password = "")
|
|
if(!password)
|
|
return TRUE
|
|
else
|
|
if(!input_password)
|
|
input_password = sanitize(input(user, "Please enter a password to access file '[filename]':"))
|
|
if(input_password == password)
|
|
return TRUE
|
|
else
|
|
return FALSE
|