a small addition

This commit is contained in:
Geevies
2020-04-15 19:58:18 +02:00
parent 21deec90c3
commit 94579a73bf
65 changed files with 1200 additions and 1223 deletions
@@ -1,13 +1,13 @@
var/global/file_uid = 0
/datum/computer_file/
var/filename = "NewFile" // Placeholder. No spacebars
var/filetype = "XXX" // File full names are [filename].[filetype] so like NewFile.XXX in this case
/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/size = 1 // File size in GQ. Integers only!
var/obj/item/computer_hardware/hard_drive/holder // Holder that contains this file.
var/unsendable = 0 // Whether the file may be sent to someone via NTNet transfer or other means.
var/undeletable = 0 // Whether the file may be deleted. Setting to 1 prevents deletion/renaming/etc.
var/password = "" // Placeholder for password protected files.
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()
@@ -16,18 +16,18 @@ var/global/file_uid = 0
file_uid++
/datum/computer_file/Destroy()
if(!holder)
if(!hard_drive)
return ..()
holder.remove_file(src)
// holder.holder is the computer that has drive installed. If we are Destroy()ing program that's currently running kill it.
if(holder.holder2 && holder.holder2.active_program == src)
holder.holder2.kill_program(1)
holder = null
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 = 0)
/datum/computer_file/proc/clone(var/rename = FALSE)
var/datum/computer_file/temp = new type
temp.unsendable = unsendable
temp.undeletable = undeletable
@@ -44,9 +44,9 @@ var/global/file_uid = 0
if(!password)
return TRUE
else
if (!input_password)
if(!input_password)
input_password = sanitize(input(user, "Please enter a password to access file '[filename]':"))
if (input_password == password)
if(input_password == password)
return TRUE
else
return FALSE
return FALSE