mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
PDAs are dead, long live PDAs. All trace of old PDAs has been scoured from the codebase, and in its place are modular computer PDAs that are feature-equivalent. Essentially every PDA function except the Syndicate detonation feature and Notepad has been ported over, and battery life for handheld computers has been boosted alongside the addition of charging cables to make things easier.
53 lines
1.8 KiB
Plaintext
53 lines
1.8 KiB
Plaintext
var/global/file_uid = 0
|
|
|
|
/datum/computer_file
|
|
var/filename = "NewFile" // Placehard_drive. No spacebars
|
|
var/filetype = "XXX" // File full names are [filename].[filetype] so like NewFile.XXX in this case
|
|
var/filedesc = null
|
|
var/size = 1 // File size in GQ. Integers only!
|
|
var/obj/item/computer_hardware/hard_drive/hard_drive // Harddrive that contains this file.
|
|
var/unsendable = FALSE // Whether the file may be sent to someone via NTNet transfer or other means.
|
|
var/undeletable = FALSE // Whether the file may be deleted. Setting to 1 prevents deletion/renaming/etc.
|
|
var/password = "" // Placeholder for password protected files.
|
|
var/uid // UID of this file
|
|
|
|
/datum/computer_file/New()
|
|
..()
|
|
uid = file_uid
|
|
file_uid++
|
|
|
|
/datum/computer_file/Destroy()
|
|
if(!hard_drive)
|
|
return ..()
|
|
|
|
hard_drive.remove_file(src)
|
|
// 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
|
|
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 |