modular computer stuff

This commit is contained in:
Geeves
2020-01-25 23:08:37 +02:00
parent d56a4c2fe6
commit 658a9ceb83
20 changed files with 352 additions and 387 deletions
@@ -4,12 +4,12 @@
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
requires_ntnet = FALSE
requires_access_to_run = FALSE
required_access_download = access_heads
available_on_ntnet = 1
available_on_ntnet = TRUE
nanomodule_path = /datum/nano_module/program/computer_aidiag/
var/restoring = 0
var/restoring = FALSE
color = LIGHT_COLOR_PURPLE
usage_flags = PROGRAM_CONSOLE
@@ -20,47 +20,47 @@
/datum/computer_file/program/aidiag/Topic(href, href_list)
if(..())
return 1
return TRUE
var/mob/living/silicon/ai/A = get_ai()
if(!A)
return 0
return FALSE
if(href_list["PRG_beginReconstruction"])
if((A.hardware_integrity() < 100) || (A.backup_capacitor() < 100))
restoring = 1
return 1
restoring = TRUE
return TRUE
// Following actions can only be used by non-silicon users, as they involve manipulation of laws.
if(issilicon(usr))
return 0
return FALSE
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()
to_chat(A, "<span class='danger'>All laws purged.</span>")
return 1
return TRUE
if(href_list["PRG_resetLaws"])
A.laws.clear_ion_laws()
A.laws.clear_supplied_laws()
to_chat(A, "<span class='danger'>Non-core laws reset.</span>")
return 1
return TRUE
if(href_list["PRG_uploadNTDefault"])
A.laws = new/datum/ai_laws/nanotrasen
to_chat(A, "<span class='danger'>All laws purged. NT Default lawset uploaded.</span>")
return 1
return TRUE
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)
to_chat(A, "<span class='danger'>Custom law uploaded to sector [sector]: [law_to_add].</span>")
return 1
return TRUE
/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.
restoring = FALSE // If the AI was removed, stop the restoration sequence.
return
A.adjustFireLoss(-4)
A.adjustBruteLoss(-4)
@@ -69,7 +69,7 @@
// If the AI is dead, revive it.
if (A.health >= -100 && A.stat == DEAD)
A.stat = CONSCIOUS
A.lying = 0
A.lying = FALSE
A.switch_from_dead_to_living_mob_list()
A.add_ai_verbs()
A.updateicon()
@@ -78,7 +78,7 @@
AC.update_icon()
// Finished restoring
if((A.hardware_integrity() == 100) && (A.backup_capacitor() == 100))
restoring = 0
restoring = FALSE
/datum/nano_module/program/computer_aidiag
name = "AI Maintenance Utility"
@@ -113,7 +113,7 @@
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.auto_update_layout = TRUE
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
@@ -7,6 +7,6 @@
required_access_run = access_robotics
required_access_download = access_rd
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
requires_ntnet = 1
requires_ntnet = TRUE
size = 8
color = LIGHT_COLOR_PURPLE
@@ -4,13 +4,13 @@
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
requires_ntnet = TRUE
required_access_run = access_network
required_access_download = access_heads
usage_flags = PROGRAM_CONSOLE
color = LIGHT_COLOR_GREEN
available_on_ntnet = 1
available_on_ntnet = TRUE
nanomodule_path = /datum/nano_module/computer_ntnetmonitor/
/datum/nano_module/computer_ntnetmonitor
@@ -40,54 +40,54 @@
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.auto_update_layout = TRUE
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/datum/nano_module/computer_ntnetmonitor/Topic(href, href_list)
if(..())
return 1
return TRUE
if(href_list["resetIDS"])
. = 1
. = TRUE
if(ntnet_global)
ntnet_global.resetIDS()
return 1
return TRUE
if(href_list["toggleIDS"])
. = 1
. = TRUE
if(ntnet_global)
ntnet_global.toggleIDS()
return 1
return TRUE
if(href_list["toggleWireless"])
. = 1
. = TRUE
if(!ntnet_global)
return 1
return TRUE
// NTNet is disabled. Enabling can be done without user prompt
if(ntnet_global.setting_disabled)
ntnet_global.setting_disabled = 0
return 1
ntnet_global.setting_disabled = FALSE
return TRUE
// 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
return TRUE
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
ntnet_global.setting_disabled = TRUE
return TRUE
if(href_list["purgelogs"])
. = 1
. = TRUE
if(ntnet_global)
ntnet_global.purge_logs()
if(href_list["updatemaxlogs"])
. = 1
. = TRUE
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
. = TRUE
if(!ntnet_global)
return 1
return TRUE
ntnet_global.toggle_function(href_list["toggle_function"])