Files
Bubberstation/code/modules/modular_computers/file_system/programs/wirecarp.dm
John Willard ddd3f53943 PDA general maintenance (NTNet downloader rework) (#79741)
## About The Pull Request

I deleted the documentation file of ModPCs because it was barebones and
had no new information to give that autodoc couldn't. Just to make sure
this isn't a net-negative, I improved on much of the autodoc and
comments in general around ModPC code to help people understand easier
what's going on around it.
I also renamed vars that were too easily confused with other var names,
and reworked the ntnet downloader a little;
- it now has a search bar
- it now has more sections to scroll through, hopefully making it more
accurate and easy to find what you need.
- also organized the apps that were previously shoved in 'other'.
- i also upgraded it to a .tsx because why not

video demonstration


https://github.com/tgstation/tgstation/assets/53777086/cbba4c1c-b8a8-4ba4-8628-aea8389999fc

## Why It's Good For The Game

Adds in a lot of comments that were previously missing, clears up some
sources of confusion within ModPC code, and improves NTNet Downloader,
something I've procrastinated on doing for a very long time now.

## Changelog

🆑
qol: NTNet Downloader now has a search bar, and programs are now better
sorted.
/🆑
2023-11-19 19:00:18 -05:00

70 lines
2.5 KiB
Plaintext

/datum/computer_file/program/ntnetmonitor
filename = "wirecarp"
filedesc = "WireCarp"
downloader_category = PROGRAM_CATEGORY_SECURITY
program_open_overlay = "comm_monitor"
extended_desc = "This program monitors stationwide NTNet network, provides access to logging systems, and allows for configuration changes"
size = 12
requires_ntnet = TRUE
run_access = list(ACCESS_NETWORK) //NETWORK CONTROL IS A MORE SECURE PROGRAM.
available_on_ntnet = TRUE
tgui_id = "NtosNetMonitor"
program_icon = "network-wired"
/datum/computer_file/program/ntnetmonitor/ui_act(action, list/params, datum/tgui/ui)
switch(action)
if("resetIDS")
SSmodular_computers.intrusion_detection_alarm = FALSE
return TRUE
if("toggleIDS")
SSmodular_computers.intrusion_detection_enabled = !SSmodular_computers.intrusion_detection_enabled
return TRUE
if("toggle_relay")
var/obj/machinery/ntnet_relay/target_relay = locate(params["ref"]) in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)
if(!istype(target_relay))
return
target_relay.set_relay_enabled(!target_relay.relay_enabled)
return TRUE
if("purgelogs")
SSmodular_computers.purge_logs()
return TRUE
if("toggle_mass_pda")
if(!(params["ref"] in GLOB.pda_messengers))
return
var/datum/computer_file/program/messenger/target_messenger = GLOB.pda_messengers[params["ref"]]
target_messenger.spam_mode = !target_messenger.spam_mode
return TRUE
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
var/list/data = list()
data["ntnetrelays"] = list()
for(var/obj/machinery/ntnet_relay/relays as anything in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay))
var/list/relay_data = list()
relay_data["is_operational"] = !!relays.is_operational
relay_data["name"] = relays.name
relay_data["ref"] = REF(relays)
data["ntnetrelays"] += list(relay_data)
data["idsstatus"] = SSmodular_computers.intrusion_detection_enabled
data["idsalarm"] = SSmodular_computers.intrusion_detection_alarm
data["ntnetlogs"] = list()
for(var/i in SSmodular_computers.modpc_logs)
data["ntnetlogs"] += list(list("entry" = i))
data["tablets"] = list()
for(var/messenger_ref in get_messengers_sorted_by_name())
var/datum/computer_file/program/messenger/app = GLOB.pda_messengers[messenger_ref]
var/obj/item/modular_computer/pda = app.computer
var/list/tablet_data = list()
tablet_data["enabled_spam"] = app.spam_mode
tablet_data["name"] = pda.saved_identification
tablet_data["ref"] = REF(app)
data["tablets"] += list(tablet_data)
return data