diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index da92d560b73..02cf70e9194 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -3,10 +3,10 @@ filetype = "PRG" /// File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET! filename = "UnknownProgram" - /// List of required accesses to *run* the program. - var/required_access = null - /// List of required access to download or file host the program - var/transfer_access = null + /// List of required accesses to *run* the program. Any match will do. + var/list/required_access = list() + /// List of required access to download or file host the program. Any match will do. + var/list/transfer_access = list() /// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running. var/program_state = PROGRAM_STATE_KILLED /// Device that runs this program. @@ -106,7 +106,7 @@ return TRUE /** - *Check if the user can run program. Only humans can operate computer. Automatically called in run_program() + *Check if the user can run program. Only humans and silicons can operate computer. Automatically called in run_program() *ID must be inserted into a card slot to be read. If the program is not currently installed (as is the case when *NT Software Hub is checking available software), a list can be given to be used instead. *Arguments: @@ -117,39 +117,41 @@ *access can contain a list of access numbers to check against. If access is not empty, it will be used istead of checking any inserted ID. */ /datum/computer_file/program/proc/can_run(mob/user, loud = FALSE, access_to_check, transfer = FALSE, list/access) - // Defaults to required_access - if(!access_to_check) - if(transfer && transfer_access) - access_to_check = transfer_access - else - access_to_check = required_access - if(!access_to_check) // No required_access, allow it. - return TRUE - - if(!transfer && computer && (computer.obj_flags & EMAGGED)) //emags can bypass the execution locks but not the download ones. + if(issilicon(user)) return TRUE if(isAdminGhostAI(user)) return TRUE - if(issilicon(user)) + if(!transfer && computer && (computer.obj_flags & EMAGGED)) //emags can bypass the execution locks but not the download ones. + return TRUE + + // Defaults to required_access + if(!access_to_check) + if(transfer && length(transfer_access)) + access_to_check = transfer_access + else + access_to_check = required_access + if(!length(access_to_check)) // No required_access, allow it. return TRUE if(!length(access)) - var/obj/item/card/id/D + var/obj/item/card/id/accesscard var/obj/item/computer_hardware/card_slot/card_slot if(computer) card_slot = computer.all_components[MC_CARD] - D = card_slot?.GetID() + accesscard = card_slot?.GetID() - if(!D) + if(!accesscard) if(loud) to_chat(user, span_danger("\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning.")) return FALSE - access = D.GetAccess() + access = accesscard.GetAccess() + + for(var/singular_access in access_to_check) + if(singular_access in access) //For loop checks every individual access entry in the access list. If the user's ID has access to any entry, then we're good. + return TRUE - if(access_to_check in access) - return TRUE if(loud) to_chat(user, span_danger("\The [computer] flashes an \"Access Denied\" warning.")) return FALSE diff --git a/code/modules/modular_computers/file_system/programs/airestorer.dm b/code/modules/modular_computers/file_system/programs/airestorer.dm index e3b4f2ac742..b2c053ab109 100644 --- a/code/modules/modular_computers/file_system/programs/airestorer.dm +++ b/code/modules/modular_computers/file_system/programs/airestorer.dm @@ -7,7 +7,7 @@ size = 12 requires_ntnet = FALSE usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP - transfer_access = ACCESS_HEADS + transfer_access = list(ACCESS_HEADS) available_on_ntnet = TRUE tgui_id = "NtosAiRestorer" program_icon = "laptop-code" diff --git a/code/modules/modular_computers/file_system/programs/borg_monitor.dm b/code/modules/modular_computers/file_system/programs/borg_monitor.dm index 9d9bdcc0321..d6810724efe 100644 --- a/code/modules/modular_computers/file_system/programs/borg_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/borg_monitor.dm @@ -6,7 +6,7 @@ program_icon_state = "generic" extended_desc = "This program allows for remote monitoring of station cyborgs." requires_ntnet = TRUE - transfer_access = ACCESS_ROBOTICS + transfer_access = list(ACCESS_ROBOTICS) size = 5 tgui_id = "NtosCyborgRemoteMonitor" program_icon = "project-diagram" @@ -169,7 +169,7 @@ requires_ntnet = FALSE available_on_ntnet = FALSE available_on_syndinet = TRUE - transfer_access = null + transfer_access = list() tgui_id = "NtosCyborgRemoteMonitorSyndicate" /datum/computer_file/program/borg_monitor/syndicate/run_emag() diff --git a/code/modules/modular_computers/file_system/programs/card.dm b/code/modules/modular_computers/file_system/programs/card.dm index 10f2f0cc94f..55b156f5175 100644 --- a/code/modules/modular_computers/file_system/programs/card.dm +++ b/code/modules/modular_computers/file_system/programs/card.dm @@ -4,7 +4,7 @@ category = PROGRAM_CATEGORY_CREW program_icon_state = "id" extended_desc = "Program for programming employee ID cards to access parts of the station." - transfer_access = ACCESS_HEADS + transfer_access = list(ACCESS_HEADS) requires_ntnet = 0 size = 8 tgui_id = "NtosCard" diff --git a/code/modules/modular_computers/file_system/programs/crewmanifest.dm b/code/modules/modular_computers/file_system/programs/crewmanifest.dm index 69e7bb745b5..31140aaa201 100644 --- a/code/modules/modular_computers/file_system/programs/crewmanifest.dm +++ b/code/modules/modular_computers/file_system/programs/crewmanifest.dm @@ -4,7 +4,7 @@ category = PROGRAM_CATEGORY_CREW program_icon_state = "id" extended_desc = "Program for viewing and printing the current crew manifest" - transfer_access = ACCESS_HEADS + transfer_access = list(ACCESS_HEADS) requires_ntnet = TRUE size = 4 tgui_id = "NtosCrewManifest" diff --git a/code/modules/modular_computers/file_system/programs/jobmanagement.dm b/code/modules/modular_computers/file_system/programs/jobmanagement.dm index 91bc63f16ae..c7d4ce2d06d 100644 --- a/code/modules/modular_computers/file_system/programs/jobmanagement.dm +++ b/code/modules/modular_computers/file_system/programs/jobmanagement.dm @@ -7,7 +7,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) category = PROGRAM_CATEGORY_CREW program_icon_state = "id" extended_desc = "Program for viewing and changing job slot availability." - transfer_access = ACCESS_HEADS + transfer_access = list(ACCESS_HEADS) requires_ntnet = TRUE size = 4 tgui_id = "NtosJobManager" diff --git a/code/modules/modular_computers/file_system/programs/ntmonitor.dm b/code/modules/modular_computers/file_system/programs/ntmonitor.dm index 22d3f20346c..5a34488fd22 100644 --- a/code/modules/modular_computers/file_system/programs/ntmonitor.dm +++ b/code/modules/modular_computers/file_system/programs/ntmonitor.dm @@ -6,7 +6,7 @@ extended_desc = "This program monitors stationwide NTNet network, provides access to logging systems, and allows for configuration changes" size = 12 requires_ntnet = TRUE - required_access = ACCESS_NETWORK //NETWORK CONTROL IS A MORE SECURE PROGRAM. + required_access = list(ACCESS_NETWORK) //NETWORK CONTROL IS A MORE SECURE PROGRAM. available_on_ntnet = TRUE tgui_id = "NtosNetMonitor" program_icon = "network-wired" diff --git a/code/modules/modular_computers/file_system/programs/portrait_printer.dm b/code/modules/modular_computers/file_system/programs/portrait_printer.dm index 1260b761ac2..da6e0b9e2e8 100644 --- a/code/modules/modular_computers/file_system/programs/portrait_printer.dm +++ b/code/modules/modular_computers/file_system/programs/portrait_printer.dm @@ -14,7 +14,7 @@ category = PROGRAM_CATEGORY_CREW program_icon_state = "dummy" extended_desc = "This program connects to a Spinward Sector community art site for viewing and printing art." - transfer_access = ACCESS_LIBRARY + transfer_access = list(ACCESS_LIBRARY) usage_flags = PROGRAM_CONSOLE requires_ntnet = TRUE size = 9 diff --git a/code/modules/modular_computers/file_system/programs/powermonitor.dm b/code/modules/modular_computers/file_system/programs/powermonitor.dm index 810499985e8..8e30fe57c7b 100644 --- a/code/modules/modular_computers/file_system/programs/powermonitor.dm +++ b/code/modules/modular_computers/file_system/programs/powermonitor.dm @@ -7,7 +7,7 @@ program_icon_state = "power_monitor" extended_desc = "This program connects to sensors around the station to provide information about electrical systems" ui_header = "power_norm.gif" - transfer_access = ACCESS_ENGINE + transfer_access = list(ACCESS_ENGINE) usage_flags = PROGRAM_CONSOLE requires_ntnet = 0 size = 9 diff --git a/code/modules/modular_computers/file_system/programs/radar.dm b/code/modules/modular_computers/file_system/programs/radar.dm index 14c190a1903..c0d8d4df643 100644 --- a/code/modules/modular_computers/file_system/programs/radar.dm +++ b/code/modules/modular_computers/file_system/programs/radar.dm @@ -5,7 +5,6 @@ ui_header = "borg_mon.gif" //DEBUG -- new icon before PR program_icon_state = "radarntos" requires_ntnet = TRUE - transfer_access = null available_on_ntnet = FALSE usage_flags = PROGRAM_LAPTOP | PROGRAM_TABLET size = 5 @@ -212,7 +211,7 @@ filedesc = "Lifeline" extended_desc = "This program allows for tracking of crew members via their suit sensors." requires_ntnet = TRUE - transfer_access = ACCESS_MEDICAL + transfer_access = list(ACCESS_MEDICAL) available_on_ntnet = TRUE program_icon = "heartbeat" @@ -261,7 +260,6 @@ program_icon_state = "radarsyndicate" extended_desc = "This program allows for tracking of nuclear authorization disks and warheads." requires_ntnet = FALSE - transfer_access = null available_on_ntnet = FALSE available_on_syndinet = TRUE tgui_id = "NtosRadarSyndicate" diff --git a/code/modules/modular_computers/file_system/programs/robocontrol.dm b/code/modules/modular_computers/file_system/programs/robocontrol.dm index 2ea4acb06f8..c221854f905 100644 --- a/code/modules/modular_computers/file_system/programs/robocontrol.dm +++ b/code/modules/modular_computers/file_system/programs/robocontrol.dm @@ -5,7 +5,6 @@ category = PROGRAM_CATEGORY_SCI program_icon_state = "robot" extended_desc = "A remote controller used for giving basic commands to non-sentient robots." - transfer_access = null requires_ntnet = TRUE size = 12 tgui_id = "NtosRoboControl" diff --git a/code/modules/modular_computers/file_system/programs/robotact.dm b/code/modules/modular_computers/file_system/programs/robotact.dm index 3e5f83410f2..fd87bbcc47e 100644 --- a/code/modules/modular_computers/file_system/programs/robotact.dm +++ b/code/modules/modular_computers/file_system/programs/robotact.dm @@ -6,7 +6,6 @@ ui_header = "robotact.gif" //DEBUG -- new icon before PR program_icon_state = "command" requires_ntnet = FALSE - transfer_access = null available_on_ntnet = FALSE unsendable = TRUE undeletable = TRUE diff --git a/code/modules/modular_computers/file_system/programs/secureye.dm b/code/modules/modular_computers/file_system/programs/secureye.dm index d36bf7d4fb9..7bf038be4e9 100644 --- a/code/modules/modular_computers/file_system/programs/secureye.dm +++ b/code/modules/modular_computers/file_system/programs/secureye.dm @@ -8,7 +8,7 @@ program_icon_state = "generic" extended_desc = "This program allows access to standard security camera networks." requires_ntnet = TRUE - transfer_access = ACCESS_SECURITY + transfer_access = list(ACCESS_SECURITY) usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP size = 5 tgui_id = "NtosSecurEye" diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 8490eae2467..74623579dfd 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -6,7 +6,7 @@ program_icon_state = "smmon_0" extended_desc = "Crystal Integrity Monitoring System, connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines." requires_ntnet = TRUE - transfer_access = ACCESS_CONSTRUCTION + transfer_access = list(ACCESS_CONSTRUCTION) size = 5 tgui_id = "NtosSupermatterMonitor" program_icon = "radiation" @@ -132,7 +132,7 @@ data += active.ui_data() data["singlecrystal"] = FALSE - + else var/list/SMS = list() for(var/obj/machinery/power/supermatter_crystal/S in supermatters) diff --git a/code/modules/modular_computers/file_system/programs/techweb.dm b/code/modules/modular_computers/file_system/programs/techweb.dm index 097bc881040..0a23fbb4b66 100644 --- a/code/modules/modular_computers/file_system/programs/techweb.dm +++ b/code/modules/modular_computers/file_system/programs/techweb.dm @@ -8,8 +8,8 @@ size = 16 tgui_id = "NtosTechweb" program_icon = "atom" - required_access = ACCESS_HEADS - transfer_access = ACCESS_RD + required_access = list(ACCESS_HEADS, ACCESS_RND) + transfer_access = list(ACCESS_RESEARCH) /// Reference to global science techweb var/datum/techweb/stored_research /// Access needed to lock/unlock the console