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:
Werner
2016-12-31 12:44:13 +01:00
committed by skull132
parent 14a0c7bf92
commit 386699bf53
26 changed files with 283 additions and 89 deletions

View File

@@ -2,9 +2,10 @@
/datum/computer_file/program
filetype = "PRG"
filename = "UnknownProgram" // File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET!
var/required_access = null // List of required accesses to run/download the program.
var/requires_access_to_run = 1 // Whether the program checks for required_access when run.
var/requires_access_to_download = 1 // Whether the program checks for required_access when downloading.
var/required_access_run = null // List of required accesses to run the program.
var/required_access_download = null // List of required accesses to download the program.
var/requires_access_to_run = PROGRAM_ACCESS_ONE // Whether the program checks for required_access when run. (1 = requires single access, 2 = requires single access from list, 3 = requires all access from list)
var/requires_access_to_download = PROGRAM_ACCESS_ONE // Whether the program checks for required_access when downloading. (1 = requires single access, 2 = requires single access from list, 3 = requires all access from list)
var/datum/nano_module/NM = null // If the program uses NanoModule, put it here and it will be automagically opened. Otherwise implement ui_interact.
var/nanomodule_path = null // Path to nanomodule, make sure to set this if implementing new program.
var/program_state = PROGRAM_STATE_KILLED// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running.
@@ -36,7 +37,8 @@
/datum/computer_file/program/clone()
var/datum/computer_file/program/temp = ..()
temp.required_access = required_access
temp.required_access_run = required_access_run
temp.required_access_download = required_access_download
temp.nanomodule_path = nanomodule_path
temp.filedesc = filedesc
temp.program_icon_state = program_icon_state
@@ -75,11 +77,18 @@
// Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
// User has to wear their ID or have it inhand for ID Scan to work.
// Can also be called manually, with optional parameter being access_to_check to scan the user's ID
/datum/computer_file/program/proc/can_run(var/mob/living/user, var/loud = 0, var/access_to_check)
// Defaults to required_access
// Check type determines how the access should be checked PROGRAM_ACCESS_ONE, PROGRAM_ACCESS_LIST_ONE, PROGRAM_ACCESS_LIST_ALL
/datum/computer_file/program/proc/can_run(var/mob/living/user, var/loud = 0, var/access_to_check, var/check_type)
// Defaults to required_access_run
if(!access_to_check)
access_to_check = required_access
if(!access_to_check) // No required_access, allow it.
access_to_check = required_access_run
//Default to requires_access_to_run
if(!check_type)
check_type = requires_access_to_run
// No required_access, allow it.
if(!access_to_check || !requires_access_to_run)
return 1
if(!istype(user))
@@ -91,10 +100,65 @@
user << "<span class='danger'>\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning.</span>"
return 0
if(access_to_check in I.access)
if(check_type == PROGRAM_ACCESS_ONE) //Check for single access
if(access_to_check in I.access)
return 1
else if(loud)
user << "<span class='danger'>\The [computer] flashes an \"Access Denied\" warning.</span>"
else if(check_type == PROGRAM_ACCESS_LIST_ONE)
for(var/check in access_to_check) //Loop through all the accesse's to check
if(check in I.access) //Success on first match
return 1
else if(check_type == PROGRAM_ACCESS_LIST_ALL)
for(var/check in access_to_check) //Loop through all the accesse's to check
if(!check in I.access) //Fail on first miss
return 0
else // Should never happen - So fail silently
return 0
// Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
// User has to wear their ID or have it inhand for ID Scan to work.
// Can also be called manually, with optional parameter being access_to_check to scan the user's ID
// Check type determines how the access should be checked PROGRAM_ACCESS_ONE, PROGRAM_ACCESS_LIST_ONE, PROGRAM_ACCESS_LIST_ALL
/datum/computer_file/program/proc/can_download(var/mob/living/user, var/loud = 0, var/access_to_check, var/check_type)
// Defaults to required_access_run
if(!access_to_check)
access_to_check = required_access_download
//Default to requires_access_to_run
if(!check_type)
check_type = requires_access_to_download
// No required_access, allow it.
if(!access_to_check || !requires_access_to_download)
return 1
else if(loud)
user << "<span class='danger'>\The [computer] flashes an \"Access Denied\" warning.</span>"
if(!istype(user))
return 0
var/obj/item/weapon/card/id/I = user.GetIdCard()
if(!I)
if(loud)
user << "<span class='danger'>\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning.</span>"
return 0
if(check_type == PROGRAM_ACCESS_ONE) //Check for single access
if(access_to_check in I.access)
return 1
else if(loud)
user << "<span class='danger'>\The [computer] flashes an \"Access Denied\" warning.</span>"
else if(check_type == PROGRAM_ACCESS_LIST_ONE)
for(var/check in access_to_check) //Loop through all the accesse's to check
if(check in I.access) //Success on first match
return 1
else if(check_type == PROGRAM_ACCESS_LIST_ALL)
for(var/check in access_to_check) //Loop through all the accesse's to check
if(!check in I.access) //Fail on first miss
return 0
else // Should never happen - So fail silently
return 0
// This attempts to retrieve header data for NanoUIs. If implementing completely new device of different type than existing ones
// always include the device here in this proc. This proc basically relays the request to whatever is running the program.

View File

@@ -4,7 +4,9 @@
nanomodule_path = /datum/nano_module/program/card_mod
program_icon_state = "id"
extended_desc = "Program for programming employee ID cards to access parts of the station."
required_access = access_change_ids
required_access_run = access_change_ids
required_access_download = access_change_ids
usage_flags = PROGRAM_CONSOLE
requires_ntnet = 0
size = 8

View File

@@ -9,10 +9,11 @@
program_icon_state = "comm"
nanomodule_path = /datum/nano_module/program/comm
extended_desc = "Used to command and control the station. Can relay long-range communications."
required_access = access_heads
required_access_run = access_heads
required_access_download = access_heads
requires_ntnet = 1
size = 12
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
usage_flags = PROGRAM_CONSOLE
network_destination = "station long-range communication array"
var/datum/comm_message_listener/message_core = new

View File

@@ -7,7 +7,8 @@
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"
required_access = access_engine
required_access_run = access_engine
required_access_download = access_ce
requires_ntnet = 1
network_destination = "power monitoring system"
size = 9
@@ -64,11 +65,12 @@
nanomodule_path = /datum/nano_module/atmos_control
program_icon_state = "atmos_control"
extended_desc = "This program allows remote control of air alarms around the station. This program can not be run on tablet computers."
required_access = access_atmospherics
required_access_run = access_atmospherics
required_access_download = access_ce
requires_ntnet = 1
network_destination = "atmospheric control system"
requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
usage_flags = PROGRAM_CONSOLE
size = 17
/datum/computer_file/program/rcon_console
@@ -77,11 +79,12 @@
nanomodule_path = /datum/nano_module/rcon
program_icon_state = "generic"
extended_desc = "This program allows remote control of power distribution systems around the station. This program can not be run on tablet computers."
required_access = access_engine
required_access_run = access_engine
required_access_download = access_ce
requires_ntnet = 1
network_destination = "RCON remote control system"
requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
usage_flags = PROGRAM_CONSOLE
size = 19
// Night-Mode Toggle for CE
@@ -91,9 +94,10 @@
nanomodule_path = /datum/nano_module/lighting_ctrl
program_icon_state = "comm_monitor"
extended_desc = "This program allows mass-control of the station's lighting systems. This program cannot be run on tablet computers."
required_access = access_ce
required_access_run = access_heads
required_access_download = access_ce
requires_ntnet = 1
network_destination = "APC Coordinator"
requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
size = 9
usage_flags = PROGRAM_CONSOLE
size = 9

View File

@@ -125,7 +125,7 @@
. = 1
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
var/obj/item/weapon/computer_hardware/hard_drive/portable/RHDD = computer.portable_drive
if(!HDD || !RHDD)
if(!HDD || !RHDD || computer.software_locked)
return 1
var/datum/computer_file/F = HDD.find_file_by_name(href_list["PRG_copytousb"])
if(!F || !istype(F))
@@ -136,7 +136,7 @@
. = 1
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
var/obj/item/weapon/computer_hardware/hard_drive/portable/RHDD = computer.portable_drive
if(!HDD || !RHDD)
if(!HDD || !RHDD || computer.software_locked)
return 1
var/datum/computer_file/F = RHDD.find_file_by_name(href_list["PRG_copyfromusb"])
if(!F || !istype(F))
@@ -205,4 +205,4 @@
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
#undef MAX_TEXTFILE_LENGTH
#undef MAX_TEXTFILE_LENGTH

View File

@@ -4,7 +4,9 @@
nanomodule_path = /datum/nano_module/crew_monitor
program_icon_state = "crew"
extended_desc = "This program connects to life signs monitoring system to provide basic information on crew health."
required_access = access_medical
required_access_run = access_medical
required_access_download = access_cmo
requires_ntnet = 1
network_destination = "crew lifesigns monitoring system"
size = 11
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP

View File

@@ -32,7 +32,7 @@
if(PRG.available_on_syndinet && !computer_emagged)
return 0
if(!computer || !computer.hard_drive || !computer.hard_drive.try_store_file(PRG))
if(!computer || !computer.hard_drive || !computer.hard_drive.try_store_file(PRG) || computer.software_locked)
return 0
ui_header = "downloader_running.gif"
@@ -85,8 +85,10 @@
switch(ntnet_status)
if(1)
download_netspeed = NTNETSPEED_LOWSIGNAL
downstream_variance = 0.3
if(2)
download_netspeed = NTNETSPEED_HIGHSIGNAL
downstream_variance = 0.2
if(3)
download_netspeed = NTNETSPEED_ETHERNET
@@ -162,28 +164,29 @@
data["disk_size"] = my_computer.hard_drive.max_capacity
data["disk_used"] = my_computer.hard_drive.used_capacity
var/list/all_entries[0]
for(var/datum/computer_file/program/P in ntnet_global.available_station_software)
// Only those programs our user can run will show in the list
if(!P.can_run(user) && P.requires_access_to_download)
continue
all_entries.Add(list(list(
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"size" = P.size
)))
data["hackedavailable"] = 0
if(prog.computer_emagged) // If we are running on emagged computer we have access to some "bonus" software
var/list/hacked_programs[0]
for(var/datum/computer_file/program/P in ntnet_global.available_antag_software)
data["hackedavailable"] = 1
hacked_programs.Add(list(list(
if(!my_computer.software_locked) //To lock installation of software on work computers until the IT Department is properly implemented
for(var/datum/computer_file/program/P in ntnet_global.available_station_software)
// Only those programs our user can run will show in the list
if(!P.can_download(user) && P.requires_access_to_download)
continue
all_entries.Add(list(list(
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"size" = P.size
)))
data["hacked_programs"] = hacked_programs
data["hackedavailable"] = 0
if(prog.computer_emagged) // If we are running on emagged computer we have access to some "bonus" software
var/list/hacked_programs[0]
for(var/datum/computer_file/program/P in ntnet_global.available_antag_software)
data["hackedavailable"] = 1
hacked_programs.Add(list(list(
"filename" = P.filename,
"filedesc" = P.filedesc,
"fileinfo" = P.extended_desc,
"size" = P.size
)))
data["hacked_programs"] = hacked_programs
data["downloadable_programs"] = all_entries
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)

View File

@@ -4,6 +4,8 @@
nanomodule_path = /datum/nano_module/exosuit_control
program_icon_state = "mecha"
extended_desc = "This program allows remote monitoring and administration of exosuits with tracking beacons installed."
required_access = access_robotics
required_access_run = access_robotics
required_access_download = access_rd
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
requires_ntnet = 1
size = 8
size = 8

View File

@@ -5,8 +5,8 @@
extended_desc = "This program is capable of reconstructing damaged AI systems. It can also be used to upload basic laws to the AI. Requires direct AI connection via intellicard slot."
size = 12
requires_ntnet = 0
required_access = access_heads
requires_access_to_run = 0
required_access_download = access_heads
available_on_ntnet = 1
nanomodule_path = /datum/nano_module/program/computer_aidiag/
var/restoring = 0
@@ -114,4 +114,4 @@
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
ui.set_auto_update(1)

View File

@@ -5,7 +5,10 @@
extended_desc = "This program monitors stationwide NTNet network, provides access to logging systems, and allows for configuration changes"
size = 12
requires_ntnet = 1
required_access = access_network
required_access_run = access_network
required_access_download = access_heads
usage_flags = PROGRAM_CONSOLE
available_on_ntnet = 1
nanomodule_path = /datum/nano_module/computer_ntnetmonitor/

View File

@@ -30,6 +30,7 @@
size = 12
available_on_ntnet = 1
requires_ntnet = 1
required_access_download = access_heads
/datum/nano_module/camera_monitor
name = "Camera Monitoring program"