pAI Access Lock Program Fix (#9138)

The modular computer pAI access lock program should properly only show when you have a pAI in your computer.
This commit is contained in:
Geeves
2020-06-29 09:18:17 +02:00
committed by GitHub
parent 780b009d39
commit e4c5d7ff77
12 changed files with 267 additions and 244 deletions

View File

@@ -5,6 +5,7 @@
icon_state = "hdd_normal"
hardware_size = 1
origin_tech = list(TECH_DATA = 1, TECH_ENGINEERING = 1)
var/has_installed = FALSE // whether we've been installed in a computer yet
var/max_capacity = 128
var/used_capacity = 0
var/read_only = FALSE // If the HDD is read only
@@ -83,9 +84,11 @@
// Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
/obj/item/computer_hardware/hard_drive/proc/install_default_programs()
store_file(new /datum/computer_file/program/computerconfig(src)) // Computer configuration utility, allows hardware control and displays more info than status bar
store_file(new /datum/computer_file/program/clientmanager(src)) // Client Manager to Enroll the Device
store_file(new /datum/computer_file/program/pai_access_lock(src)) // pAI access control, to stop pesky pAI from messing with computers
if(parent_computer && !has_installed)
store_file(new /datum/computer_file/program/computerconfig(parent_computer)) // Computer configuration utility, allows hardware control and displays more info than status bar
store_file(new /datum/computer_file/program/clientmanager(parent_computer)) // Client Manager to Enroll the Device
store_file(new /datum/computer_file/program/pai_access_lock(parent_computer)) // pAI access control, to stop pesky pAI from messing with computers
has_installed = TRUE
// Use this proc to remove file from the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
/obj/item/computer_hardware/hard_drive/proc/remove_file(var/datum/computer_file/F)
@@ -152,6 +155,7 @@
return ..()
/obj/item/computer_hardware/hard_drive/Initialize(mapload)
. = ..()
install_default_programs()
if(mapload && prob(5))
var/datum/docs_document/file = SSdocs.pick_document_by_tag(SSDOCS_MEDIUM_FILE)
@@ -160,7 +164,6 @@
else
var/datum/computer_file/data/F = SSdocs.create_file(file)
store_file(F)
. = ..()
/obj/item/computer_hardware/hard_drive/proc/reset_drive()
for(var/datum/computer_file/F in stored_files)

View File

@@ -4,7 +4,7 @@
/obj/item/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
var/datum/computer_file/program/prog = new F("Compless")
// 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
@@ -42,7 +42,7 @@
/obj/structure/closet/crate/software_backup/Initialize()
. = ..()
for(var/F in subtypesof(/datum/computer_file/program))
var/datum/computer_file/program/prog = new F
var/datum/computer_file/program/prog = new F("Compless")
// 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