mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
163 lines
5.0 KiB
Plaintext
163 lines
5.0 KiB
Plaintext
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
|
|
|
|
|
|
/*
|
|
Telecomms monitor tracks the overall trafficing of a telecommunications network
|
|
and displays a heirarchy of linked machines.
|
|
*/
|
|
|
|
|
|
/obj/machinery/computer/telecomms/monitor
|
|
name = "Telecommunications Monitor"
|
|
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
|
|
|
|
attack_hand(mob/user as mob)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return
|
|
user.set_machine(src)
|
|
var/dat = "<TITLE>Telecommunications Monitor</TITLE><center><b>Telecommunications Monitor</b></center>"
|
|
|
|
switch(screen)
|
|
|
|
|
|
// --- Main Menu ---
|
|
|
|
if(0)
|
|
dat += "<br>[temp]<br><br>"
|
|
dat += "<br>Current Network: <a href='?src=\ref[src];network=1'>[network]</a><br>"
|
|
if(machinelist.len)
|
|
dat += "<br>Detected Network Entities:<ul>"
|
|
for(var/obj/machinery/telecomms/T in machinelist)
|
|
dat += "<li><a href='?src=\ref[src];viewmachine=[T.id]'>\ref[T] [T.name]</a> ([T.id])</li>"
|
|
dat += "</ul>"
|
|
dat += "<br><a href='?src=\ref[src];operation=release'>\[Flush Buffer\]</a>"
|
|
else
|
|
dat += "<a href='?src=\ref[src];operation=probe'>\[Probe Network\]</a>"
|
|
|
|
|
|
// --- Viewing Machine ---
|
|
|
|
if(1)
|
|
dat += "<br>[temp]<br>"
|
|
dat += "<center><a href='?src=\ref[src];operation=mainmenu'>\[Main Menu\]</a></center>"
|
|
dat += "<br>Current Network: [network]<br>"
|
|
dat += "Selected Network Entity: [SelectedMachine.name] ([SelectedMachine.id])<br>"
|
|
dat += "Linked Entities: <ol>"
|
|
for(var/obj/machinery/telecomms/T in SelectedMachine.links)
|
|
if(!T.hide)
|
|
dat += "<li><a href='?src=\ref[src];viewmachine=[T.id]'>\ref[T.id] [T.name]</a> ([T.id])</li>"
|
|
dat += "</ol>"
|
|
|
|
|
|
|
|
user << browse(dat, "window=comm_monitor;size=575x400")
|
|
onclose(user, "server_control")
|
|
|
|
temp = ""
|
|
return
|
|
|
|
|
|
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 = "<font color = #D70B00>- FAILED: CANNOT PROBE WHEN BUFFER FULL -</font color>"
|
|
|
|
else
|
|
for(var/obj/machinery/telecomms/T in range(25, src))
|
|
if(T.network == network)
|
|
machinelist.Add(T)
|
|
|
|
if(!machinelist.len)
|
|
temp = "<font color = #D70B00>- FAILED: UNABLE TO LOCATE NETWORK ENTITIES IN \[[network]\] -</font color>"
|
|
else
|
|
temp = "<font color = #336699>- [machinelist.len] ENTITIES LOCATED & BUFFERED -</font color>"
|
|
|
|
screen = 0
|
|
|
|
|
|
if(href_list["network"])
|
|
|
|
var/newnet = input(usr, "Which network do you want to view?", "Comm Monitor", network) as null|text
|
|
if(newnet && ((usr in range(1, src) || issilicon(usr))))
|
|
if(length(newnet) > 15)
|
|
temp = "<font color = #D70B00>- FAILED: NETWORK TAG STRING TOO LENGHTLY -</font color>"
|
|
|
|
else
|
|
network = newnet
|
|
screen = 0
|
|
machinelist = list()
|
|
temp = "<font color = #336699>- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -</font color>"
|
|
|
|
updateUsrDialog()
|
|
return
|
|
|
|
attackby(var/obj/item/weapon/D as obj, var/mob/user as mob)
|
|
if(istype(D, /obj/item/weapon/screwdriver))
|
|
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
|
|
if(do_after(user, 20))
|
|
if (src.stat & BROKEN)
|
|
user << "<span class='notice'>The broken glass falls out.</span>"
|
|
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
|
new /obj/item/weapon/material/shard( src.loc )
|
|
var/obj/item/weapon/circuitboard/comm_monitor/M = new /obj/item/weapon/circuitboard/comm_monitor( A )
|
|
for (var/obj/C in src)
|
|
C.loc = src.loc
|
|
A.circuit = M
|
|
A.state = 3
|
|
A.icon_state = "3"
|
|
A.anchored = 1
|
|
qdel(src)
|
|
else
|
|
user << "<span class='notice'>You disconnect the monitor.</span>"
|
|
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
|
var/obj/item/weapon/circuitboard/comm_monitor/M = new /obj/item/weapon/circuitboard/comm_monitor( A )
|
|
for (var/obj/C in src)
|
|
C.loc = src.loc
|
|
A.circuit = M
|
|
A.state = 4
|
|
A.icon_state = "4"
|
|
A.anchored = 1
|
|
qdel(src)
|
|
src.updateUsrDialog()
|
|
return
|
|
|
|
/obj/machinery/computer/telecomms/monitor/emag_act(var/remaining_charges, var/mob/user)
|
|
if(!emagged)
|
|
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
|
|
emagged = 1
|
|
user << "<span class='notice'>You you disable the security protocols</span>"
|
|
src.updateUsrDialog()
|
|
return 1
|