/*
Telecomms monitor tracks the overall trafficing of a telecommunications network
and displays a heirarchy of linked machines.
*/
/obj/machinery/computer/telecomms/monitor
name = "telecommunications monitoring console"
icon_screen = "comm_monitor"
var/screen = 0 // the screen number:
var/list/machinelist = list() // the machines located by the computer
var/obj/machinery/telecomms/SelectedMachine
var/network = "NULL" // the network to probe
var/temp = "" // temporary feedback messages
circuit = /obj/item/weapon/circuitboard/computer/comm_monitor
/obj/machinery/computer/telecomms/monitor/attack_hand(mob/user)
if(..())
return
user.set_machine(src)
var/dat = "
Telecommunications MonitorTelecommunications Monitor"
switch(screen)
// --- Main Menu ---
if(0)
dat += "
[temp]
"
dat += "
Current Network: [network]
"
if(machinelist.len)
dat += "
Detected Network Entities:"
for(var/obj/machinery/telecomms/T in machinelist)
dat += "- \ref[T] [T.name] ([T.id])
"
dat += "
"
dat += "
\[Flush Buffer\]"
else
dat += "\[Probe Network\]"
// --- Viewing Machine ---
if(1)
dat += "
[temp]
"
dat += "\[Main Menu\]"
dat += "
Current Network: [network]
"
dat += "Selected Network Entity: [SelectedMachine.name] ([SelectedMachine.id])
"
dat += "Linked Entities: "
for(var/obj/machinery/telecomms/T in SelectedMachine.links)
if(!T.hide)
dat += "- \ref[T.id] [T.name] ([T.id])
"
dat += "
"
user << browse(dat, "window=comm_monitor;size=575x400")
onclose(user, "server_control")
temp = ""
return
/obj/machinery/computer/telecomms/monitor/Topic(href, href_list)
if(..())
return
add_fingerprint(usr)
usr.set_machine(src)
if(href_list["viewmachine"])
screen = 1
for(var/obj/machinery/telecomms/T in machinelist)
if(T.id == href_list["viewmachine"])
SelectedMachine = T
break
if(href_list["operation"])
switch(href_list["operation"])
if("release")
machinelist = list()
screen = 0
if("mainmenu")
screen = 0
if("probe")
if(machinelist.len > 0)
temp = "- FAILED: CANNOT PROBE WHEN BUFFER FULL -"
else
for(var/obj/machinery/telecomms/T in urange(25, src))
if(T.network == network)
machinelist.Add(T)
if(!machinelist.len)
temp = "- FAILED: UNABLE TO LOCATE NETWORK ENTITIES IN \[[network]\] -"
else
temp = "- [machinelist.len] ENTITIES LOCATED & BUFFERED -"
screen = 0
if(href_list["network"])
var/newnet = stripped_input(usr, "Which network do you want to view?", "Comm Monitor", network)
if(newnet && ((usr in range(1, src)) || issilicon(usr)))
if(length(newnet) > 15)
temp = "- FAILED: NETWORK TAG STRING TOO LENGHTLY -"
else
network = newnet
screen = 0
machinelist = list()
temp = "- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -"
updateUsrDialog()
return
/obj/machinery/computer/telecomms/monitor/attackby()
. = ..()
updateUsrDialog()