mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Organizes programs folder.
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
/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. Requires direct AI connection via intellicard slot."
|
||||
size = 12
|
||||
requires_ntnet = 0
|
||||
usage_flags = PROGRAM_CONSOLE
|
||||
transfer_access = access_heads
|
||||
available_on_ntnet = 1
|
||||
var/restoring = FALSE
|
||||
|
||||
/datum/computer_file/program/aidiag/proc/get_ai(cardcheck)
|
||||
|
||||
var/obj/item/weapon/computer_hardware/ai_slot/ai_slot
|
||||
|
||||
if(computer)
|
||||
ai_slot = computer.all_components[MC_AI]
|
||||
|
||||
if(computer && ai_slot && ai_slot.check_functionality())
|
||||
if(cardcheck == 1)
|
||||
return ai_slot
|
||||
if(ai_slot.enabled && ai_slot.stored_card)
|
||||
if(cardcheck == 2)
|
||||
return ai_slot.stored_card
|
||||
if(locate(/mob/living/silicon/ai) in ai_slot.stored_card)
|
||||
return locate(/mob/living/silicon/ai) in ai_slot.stored_card
|
||||
|
||||
return null
|
||||
|
||||
/datum/computer_file/program/aidiag/Topic(href, list/href_list)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
var/mob/living/silicon/ai/A = get_ai()
|
||||
if(!A)
|
||||
restoring = FALSE
|
||||
|
||||
switch(href_list["action"])
|
||||
if("PRG_beginReconstruction")
|
||||
if(A && A.health < 100)
|
||||
restoring = TRUE
|
||||
return TRUE
|
||||
if("PRG_eject")
|
||||
if(computer.all_components[MC_AI])
|
||||
var/obj/item/weapon/computer_hardware/ai_slot/ai_slot = computer.all_components[MC_AI]
|
||||
if(ai_slot && ai_slot.stored_card)
|
||||
ai_slot.try_eject(0,usr)
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/aidiag/process_tick()
|
||||
..()
|
||||
if(!restoring) //Put the check here so we don't check for an ai all the time
|
||||
return
|
||||
var/obj/item/device/aicard/cardhold = get_ai(2)
|
||||
|
||||
var/obj/item/weapon/computer_hardware/ai_slot/ai_slot = get_ai(1)
|
||||
|
||||
|
||||
var/mob/living/silicon/ai/A = get_ai()
|
||||
if(!A || !cardhold)
|
||||
restoring = FALSE // If the AI was removed, stop the restoration sequence.
|
||||
if(ai_slot)
|
||||
ai_slot.locked = FALSE
|
||||
return
|
||||
|
||||
if(cardhold.flush)
|
||||
ai_slot.locked = FALSE
|
||||
restoring = FALSE
|
||||
return
|
||||
ai_slot.locked = TRUE
|
||||
A.adjustOxyLoss(-1)
|
||||
A.adjustFireLoss(-1)
|
||||
A.adjustToxLoss(-1)
|
||||
A.adjustBruteLoss(-1)
|
||||
A.updatehealth()
|
||||
if(A.health >= 0 && A.stat == DEAD)
|
||||
A.stat = CONSCIOUS
|
||||
A.lying = 0
|
||||
dead_mob_list -= A
|
||||
living_mob_list += A
|
||||
// Finished restoring
|
||||
if(A.health >= 100)
|
||||
ai_slot.locked = FALSE
|
||||
restoring = FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/computer_file/program/aidiag/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
var/mob/living/silicon/ai/AI
|
||||
// A shortcut for getting the AI stored inside the computer. The program already does necessary checks.
|
||||
AI = get_ai()
|
||||
|
||||
var/obj/item/device/aicard/aicard = get_ai(2)
|
||||
|
||||
if(!aicard)
|
||||
data["nocard"] = TRUE
|
||||
data["error"] = "Please insert an intelliCard."
|
||||
else
|
||||
if(!AI)
|
||||
data["error"] = "No AI located"
|
||||
else
|
||||
var/obj/item/device/aicard/cardhold = AI.loc
|
||||
if(cardhold.flush)
|
||||
data["error"] = "Flush in progress"
|
||||
else
|
||||
data["name"] = AI.name
|
||||
data["restoring"] = restoring
|
||||
data["health"] = (AI.health + 100) / 2
|
||||
data["isDead"] = AI.stat == DEAD
|
||||
|
||||
var/list/all_laws[0]
|
||||
for(var/datum/ai_law/L in AI.laws.all_laws())
|
||||
all_laws.Add(list(list(
|
||||
"index" = L.index,
|
||||
"text" = L.law
|
||||
)))
|
||||
|
||||
data["ai_laws"] = all_laws
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/aidiag/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
|
||||
assets.send(user)
|
||||
ui = new(user, src, ui_key, "ai_restorer.tmpl", "Integrity Restorer", 600, 400)
|
||||
ui.set_auto_update(1)
|
||||
ui.open()
|
||||
|
||||
/datum/computer_file/program/aidiag/kill_program(forced)
|
||||
restoring = FALSE
|
||||
return ..(forced)
|
||||
@@ -0,0 +1,90 @@
|
||||
/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 = access_network //Network control is a more secure program.
|
||||
available_on_ntnet = 1
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
|
||||
assets.send(user)
|
||||
ui = new(user, src, ui_key, "ntnet_monitor.tmpl", "NTNet Diagnostics and Monitoring Tool", 575, 700)
|
||||
ui.set_auto_update(1)
|
||||
ui.open()
|
||||
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/Topic(href, list/href_list)
|
||||
if(..())
|
||||
return 1
|
||||
switch(href_list["action"])
|
||||
if("resetIDS")
|
||||
. = 1
|
||||
if(ntnet_global)
|
||||
ntnet_global.resetIDS()
|
||||
return 1
|
||||
if("toggleIDS")
|
||||
. = 1
|
||||
if(ntnet_global)
|
||||
ntnet_global.toggleIDS()
|
||||
return 1
|
||||
if("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("purgelogs")
|
||||
. = 1
|
||||
if(ntnet_global)
|
||||
ntnet_global.purge_logs()
|
||||
if("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("toggle_function")
|
||||
. = 1
|
||||
if(!ntnet_global)
|
||||
return 1
|
||||
ntnet_global.toggle_function(text2num(href_list["id"]))
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
|
||||
if(!ntnet_global)
|
||||
return
|
||||
var/list/data = get_header_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"] = list()
|
||||
|
||||
for(var/i in ntnet_global.logs)
|
||||
data["ntnetlogs"] += list(list("entry" = i))
|
||||
data["ntnetmaxlogs"] = ntnet_global.setting_maxlogcount
|
||||
|
||||
return data
|
||||
Reference in New Issue
Block a user