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 13:44:13 +02:00
committed by skull132
parent 14a0c7bf92
commit 386699bf53
26 changed files with 283 additions and 89 deletions
@@ -0,0 +1,11 @@
/datum/computer_file/program/exosuit_monitor
filename = "exosuitmonitor"
filedesc = "Exosuit monitoring and control"
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_run = access_robotics
required_access_download = access_rd
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
requires_ntnet = 1
size = 8
@@ -0,0 +1,117 @@
/datum/computer_file/program/aidiag
filename = "aidiag"
filedesc = "AI Maintenance Utility"
program_icon_state = "generic"
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
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
/datum/computer_file/program/aidiag/proc/get_ai()
if(computer && computer.ai_slot && computer.ai_slot.check_functionality() && computer.ai_slot.enabled && computer.ai_slot.stored_card && computer.ai_slot.stored_card.carded_ai)
return computer.ai_slot.stored_card.carded_ai
return null
/datum/computer_file/program/aidiag/Topic(href, href_list)
if(..())
return 1
var/mob/living/silicon/ai/A = get_ai()
if(!A)
return 0
if(href_list["PRG_beginReconstruction"])
if((A.hardware_integrity() < 100) || (A.backup_capacitor() < 100))
restoring = 1
return 1
// Following actions can only be used by non-silicon users, as they involve manipulation of laws.
if(issilicon(usr))
return 0
if(href_list["PRG_purgeAiLaws"])
A.laws.clear_zeroth_laws()
A.laws.clear_ion_laws()
A.laws.clear_inherent_laws()
A.laws.clear_supplied_laws()
A << "<span class='danger'>All laws purged.</span>"
return 1
if(href_list["PRG_resetLaws"])
A.laws.clear_ion_laws()
A.laws.clear_supplied_laws()
A << "<span class='danger'>Non-core laws reset.</span>"
return 1
if(href_list["PRG_uploadNTDefault"])
A.laws = new/datum/ai_laws/nanotrasen
A << "<span class='danger'>All laws purged. NT Default lawset uploaded.</span>"
return 1
if(href_list["PRG_addCustomSuppliedLaw"])
var/law_to_add = sanitize(input("Please enter a new law for the AI.", "Custom Law Entry"))
var/sector = input("Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority (15+)") as num
sector = between(MIN_SUPPLIED_LAW_NUMBER, sector, MAX_SUPPLIED_LAW_NUMBER)
A.add_supplied_law(sector, law_to_add)
A << "<span class='danger'>Custom law uploaded to sector [sector]: [law_to_add].</span>"
return 1
/datum/computer_file/program/aidiag/process_tick()
var/mob/living/silicon/ai/A = get_ai()
if(!A || !restoring)
restoring = 0 // If the AI was removed, stop the restoration sequence.
return
A.adjustFireLoss(-4)
A.adjustBruteLoss(-4)
A.adjustOxyLoss(-4)
A.updatehealth()
// If the AI is dead, revive it.
if (A.health >= -100 && A.stat == DEAD)
A.stat = CONSCIOUS
A.lying = 0
A.switch_from_dead_to_living_mob_list()
A.add_ai_verbs()
A.updateicon()
var/obj/item/weapon/aicard/AC = A.loc
if(AC)
AC.update_icon()
// Finished restoring
if((A.hardware_integrity() == 100) && (A.backup_capacitor() == 100))
restoring = 0
/datum/nano_module/program/computer_aidiag
name = "AI Maintenance Utility"
/datum/nano_module/program/computer_aidiag/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
var/list/data = host.initial_data()
var/mob/living/silicon/ai/A
// A shortcut for getting the AI stored inside the computer. The program already does necessary checks.
if(program && istype(program, /datum/computer_file/program/aidiag))
var/datum/computer_file/program/aidiag/AD = program
A = AD.get_ai()
if(!A)
data["error"] = "No AI located"
else
data["ai_name"] = A.name
data["ai_integrity"] = A.hardware_integrity()
data["ai_capacitor"] = A.backup_capacitor()
data["ai_isdamaged"] = (A.hardware_integrity() < 100) || (A.backup_capacitor() < 100)
data["ai_isdead"] = (A.stat == DEAD)
var/list/all_laws[0]
for(var/datum/ai_law/L in A.laws.all_laws())
all_laws.Add(list(list(
"index" = L.index,
"text" = L.law
)))
data["ai_laws"] = all_laws
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "aidiag.tmpl", "AI Maintenance Utility", 600, 400, state = state)
if(host.update_layout())
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
@@ -0,0 +1,92 @@
/datum/computer_file/program/ntnetmonitor
filename = "ntmonitor"
filedesc = "NTNet Diagnostics and Monitoring"
program_icon_state = "comm_monitor"
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_run = access_network
required_access_download = access_heads
usage_flags = PROGRAM_CONSOLE
available_on_ntnet = 1
nanomodule_path = /datum/nano_module/computer_ntnetmonitor/
/datum/nano_module/computer_ntnetmonitor
name = "NTNet Diagnostics and Monitoring"
available_to_ai = TRUE
/datum/nano_module/computer_ntnetmonitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
if(!ntnet_global)
return
var/list/data = host.initial_data()
data["ntnetstatus"] = ntnet_global.check_function()
data["ntnetrelays"] = ntnet_global.relays.len
data["idsstatus"] = ntnet_global.intrusion_detection_enabled
data["idsalarm"] = ntnet_global.intrusion_detection_alarm
data["config_softwaredownload"] = ntnet_global.setting_softwaredownload
data["config_peertopeer"] = ntnet_global.setting_peertopeer
data["config_communication"] = ntnet_global.setting_communication
data["config_systemcontrol"] = ntnet_global.setting_systemcontrol
data["ntnetlogs"] = ntnet_global.logs
data["ntnetmaxlogs"] = ntnet_global.setting_maxlogcount
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "ntnet_monitor.tmpl", "NTNet Diagnostics and Monitoring Tool", 575, 700, state = state)
if(host.update_layout())
ui.auto_update_layout = 1
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/datum/nano_module/computer_ntnetmonitor/Topic(href, href_list)
if(..())
return 1
if(href_list["resetIDS"])
. = 1
if(ntnet_global)
ntnet_global.resetIDS()
return 1
if(href_list["toggleIDS"])
. = 1
if(ntnet_global)
ntnet_global.toggleIDS()
return 1
if(href_list["toggleWireless"])
. = 1
if(!ntnet_global)
return 1
// NTNet is disabled. Enabling can be done without user prompt
if(ntnet_global.setting_disabled)
ntnet_global.setting_disabled = 0
return 1
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
var/mob/user = usr
if(!user)
return 1
var/response = alert(user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No")
if(response == "Yes")
ntnet_global.setting_disabled = 1
return 1
if(href_list["purgelogs"])
. = 1
if(ntnet_global)
ntnet_global.purge_logs()
if(href_list["updatemaxlogs"])
. = 1
var/mob/user = usr
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
if(ntnet_global)
ntnet_global.update_max_log_count(logcount)
if(href_list["toggle_function"])
. = 1
if(!ntnet_global)
return 1
ntnet_global.toggle_function(href_list["toggle_function"])