mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 20:37:34 +01:00
Various Tweaks to modular computers (#1320)
Added different run and download access levels Added the possibility to check for one access, one in a list, all in a list Tweaked the access levels required to download software. Generally speaking, only departmental heads can now download departmental software Locked down the software of the preset consoles. (No downloading games on them) Fixed being unable to eject portable storage devices Locked down work consoles dont accept portable storage devices Added a software backup crate to secure storage
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
origin_tech = list(TECH_DATA = 1, TECH_ENGINEERING = 1)
|
||||
var/max_capacity = 128
|
||||
var/used_capacity = 0
|
||||
var/read_only = 0 // If the HDD is read only
|
||||
var/list/stored_files = list() // List of stored files on this drive. DO NOT MODIFY DIRECTLY!
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/advanced
|
||||
@@ -96,7 +97,7 @@
|
||||
if(!F || !istype(F))
|
||||
return 0
|
||||
|
||||
if(!stored_files)
|
||||
if(!stored_files || read_only)
|
||||
return 0
|
||||
|
||||
if(!check_functionality())
|
||||
@@ -121,6 +122,8 @@
|
||||
/obj/item/weapon/computer_hardware/hard_drive/proc/can_store_file(var/size = 1)
|
||||
// In the unlikely event someone manages to create that many files.
|
||||
// BYOND is acting weird with numbers above 999 in loops (infinite loop prevention)
|
||||
if(read_only)
|
||||
return 0
|
||||
if(stored_files.len >= 999)
|
||||
return 0
|
||||
if(used_capacity + size > max_capacity)
|
||||
@@ -164,4 +167,4 @@
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/New()
|
||||
install_default_programs()
|
||||
..()
|
||||
..()
|
||||
|
||||
@@ -29,4 +29,4 @@
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/New()
|
||||
..()
|
||||
stored_files = list()
|
||||
recalculate_size()
|
||||
recalculate_size()
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/super/preset/all/New()
|
||||
..()
|
||||
add_programs()
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/super/preset/all/proc/add_programs()
|
||||
for(var/F in typesof(/datum/computer_file/program))
|
||||
var/datum/computer_file/program/prog = new F
|
||||
// Invalid type (shouldn't be possible but just in case), invalid filetype (not executable program) or invalid filename (unset program)
|
||||
if(!prog || !istype(prog) || prog.filename == "UnknownProgram" || prog.filetype != "PRG")
|
||||
continue
|
||||
// Check whether the program should be available for station/antag download, if yes, add it to lists.
|
||||
if(prog.available_on_ntnet)
|
||||
store_file(prog)
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/backup
|
||||
var/_program = null //Change that far to the file name of the backup program you would like to spawn
|
||||
origin_tech = list() //Nope, no research levels from backup disks
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/backup/New(loc, var/prog_name)
|
||||
..()
|
||||
_program = prog_name
|
||||
add_program()
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/backup/proc/add_program()
|
||||
if(_program == null)
|
||||
qdel(src) //Delete itself if no program is set
|
||||
return
|
||||
var/datum/computer_file/program/PRG = ntnet_global.find_ntnet_file_by_name(_program)
|
||||
if(!PRG)
|
||||
qdel(src) //Delete itself it no matching program is found
|
||||
return
|
||||
max_capacity = PRG.size // Set the capacity of the backup disk to the capacity of the program
|
||||
store_file(PRG)
|
||||
read_only = 1
|
||||
desc = "A read-only backup storage crystal containing a backup of the following software: [PRG.filename]"
|
||||
name = "[PRG.filename] backup crystal"
|
||||
|
||||
|
||||
/obj/structure/closet/crate/software_backup
|
||||
desc = "A crate containing a backup of all the NT Software available"
|
||||
name = "Backup Software Crate"
|
||||
|
||||
/obj/structure/closet/crate/software_backup/initialize()
|
||||
for(var/F in typesof(/datum/computer_file/program))
|
||||
var/datum/computer_file/program/prog = new F
|
||||
// Invalid type (shouldn't be possible but just in case), invalid filetype (not executable program) or invalid filename (unset program)
|
||||
if(!prog || !istype(prog) || prog.filename == "UnknownProgram" || prog.filetype != "PRG")
|
||||
continue
|
||||
// Check whether the program should be available for station/antag download, if yes, add it to lists.
|
||||
if(prog.available_on_ntnet)
|
||||
new /obj/item/weapon/computer_hardware/hard_drive/portable/backup(src, prog.filename)
|
||||
Reference in New Issue
Block a user