mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 07:57:50 +00:00
* The TGS thing * Revert the 516 revert * Further segment the world/New() proc * Fixes an issue here
634 lines
28 KiB
Plaintext
634 lines
28 KiB
Plaintext
|
||
// Allows you to monitor messages that passes the server.
|
||
|
||
var/list/message_monitors = list()
|
||
|
||
|
||
/obj/machinery/computer/message_monitor
|
||
name = "Message Monitor Console"
|
||
desc = "Used to Monitor the crew's messages, that are sent via PDA. Can also be used to view Request Console messages."
|
||
icon = 'icons/obj/machines/telecomms.dmi'
|
||
icon_state = "message_monitor"
|
||
var/hack_icon = "message_monitor_hacked"
|
||
var/normal_icon = "message_monitor"
|
||
circuit = "/obj/item/weapon/circuitboard/message_monitor"
|
||
//Server linked to.
|
||
var/obj/machinery/message_server/linkedServer = null
|
||
//Messages - Saves me time if I want to change something.
|
||
var/noserver = "<span class='alert'>ALERT: No server detected.</span>"
|
||
var/incorrectkey = "<span class='warning'>ALERT: Incorrect decryption key!</span>"
|
||
var/defaultmsg = "<span class='notice'>Welcome. Please select an option.</span>"
|
||
var/rebootmsg = "<span class='warning'>%$&(<28>: Critical %$$@ Error // !RestArting! <lOadiNg backUp iNput ouTput> - ?pLeaSe wAit!</span>"
|
||
//Computer properties
|
||
var/screen = 0 // 0 = Main menu, 1 = Message Logs, 2 = Hacked screen, 3 = Custom Message
|
||
var/hacking = 0 // Is it being hacked into by the AI/Cyborg
|
||
var/message = "<span class='notice'>System bootup complete. Please select an option.</span>" // The message that shows on the main menu.
|
||
var/auth = 0 // Are they authenticated?
|
||
var/optioncount = 7
|
||
// Custom Message properties
|
||
var/customsender = "System Administrator"
|
||
var/obj/item/device/pda/customrecepient = null
|
||
var/customjob = "Admin"
|
||
var/custommessage = "This is a test, please ignore."
|
||
var/switchboard_columns = 5
|
||
var/switchboard_namelength = 5
|
||
var/obj/landline/linking = null
|
||
var/obj/item/telephone/switchboard/switchboard_headset = null
|
||
var/switchboard_sound = 'sound/items/cable_plug.mp3'
|
||
var/switchboard_sound2 = 'sound/items/cable_unplug.mp3'
|
||
|
||
light_color = LIGHT_COLOR_GREEN
|
||
|
||
|
||
/obj/machinery/computer/message_monitor/New()
|
||
..()
|
||
switchboard_headset = new /obj/item/telephone/switchboard (src)
|
||
message_monitors += src
|
||
|
||
/obj/machinery/computer/message_monitor/Destroy()
|
||
message_monitors -= src
|
||
if(switchboard_headset)
|
||
qdel(switchboard_headset)
|
||
..()
|
||
|
||
|
||
/obj/machinery/computer/message_monitor/attackby(obj/item/weapon/O as obj, mob/living/user as mob)
|
||
if(!istype(user))
|
||
return
|
||
if(O.is_screwdriver(user) && emagged)
|
||
//Stops people from just unscrewing the monitor and putting it back to get the console working again.
|
||
to_chat(user, "<span class='warning'>It is too hot to mess with!</span>")
|
||
return
|
||
..()
|
||
return
|
||
|
||
/obj/machinery/computer/message_monitor/emag_act(mob/user as mob)
|
||
// Will create sparks and print out the console's password. You will then have to wait a while for the console to be back online.
|
||
// It'll take more time if there's more characters in the password..
|
||
if(!emagged)
|
||
if(!isnull(src.linkedServer))
|
||
icon_state = hack_icon // An error screen I made in the computers.dmi
|
||
emagged = 1
|
||
screen = 2
|
||
spark(src, 5, FALSE)
|
||
var/obj/item/weapon/paper/monitorkey/MK = new/obj/item/weapon/paper/monitorkey
|
||
MK.forceMove(src.loc)
|
||
// Will help make emagging the console not so easy to get away with.
|
||
MK.info += "<br><br><font color='red'><3E>%@%(*$%&(<28>&?*(%&<26>/{}</font>"
|
||
spawn(100*length(src.linkedServer.decryptkey)) UnmagConsole()
|
||
message = rebootmsg
|
||
else
|
||
if(user)
|
||
to_chat(user, "<span class='notice'>A 'no server' error appears on the screen.</span>")
|
||
|
||
/obj/machinery/computer/message_monitor/update_icon()
|
||
..()
|
||
if(stat & (NOPOWER|BROKEN|FORCEDISABLE))
|
||
return
|
||
if(emagged || hacking)
|
||
icon_state = hack_icon
|
||
else
|
||
icon_state = normal_icon
|
||
|
||
/obj/machinery/computer/message_monitor/initialize()
|
||
//Is the server isn't linked to a server, and there's a server available, default it to the first one in the list.
|
||
if(!linkedServer)
|
||
if(message_servers && message_servers.len > 0)
|
||
linkedServer = message_servers[1]
|
||
return
|
||
|
||
/obj/machinery/computer/message_monitor/attack_hand(var/mob/living/user as mob)
|
||
if(stat & (NOPOWER|BROKEN|FORCEDISABLE))
|
||
return
|
||
if(!istype(user) && !isAdminGhost(user))
|
||
return
|
||
//If the computer is being hacked or is emagged, display the reboot message.
|
||
if(hacking || emagged)
|
||
message = rebootmsg
|
||
var/dat = "<head><title>Message Monitor Console</title></head><body>"
|
||
|
||
dat += {"<center><h2>Message Monitor Console</h2></center><hr>
|
||
<center><h4><font color='blue'[message]</h5></center>"}
|
||
if(auth)
|
||
|
||
dat += {"<h4><dd><A href='?src=\ref[src];auth=1'>	<font color='green'>\[Authenticated\]</font></a>	/
|
||
Server Power: <A href='?src=\ref[src];active=1'>[src.linkedServer && src.linkedServer.is_functioning() ? "<font color='green'>\[On\]</font>":"<font color='red'>\[Off\]</font>"]</a>"}
|
||
dat += {" Landline auto-routing: <A href='?src=\ref[src];toggleLandlines=1'>[src.linkedServer && src.linkedServer.landlines_functioning() ? "<font color='green'>\[On\]</font>":"<font color='red'>\[Off\]</font>"]</a></h4>"}
|
||
else
|
||
dat += {"<h4><dd><A href='?src=\ref[src];auth=1'>	<font color='red'>\[Unauthenticated\]</font></a>	/
|
||
Server Power: <u>[src.linkedServer && src.linkedServer.is_functioning() ? "<font color='green'>\[On\]</font>":"<font color='red'>\[Off\]</font>"]</u>"}
|
||
dat += {" Landline auto-routing: [src.linkedServer && src.linkedServer.landlines_functioning() ? "<font color='green'>\[On\]</font>":"<font color='red'>\[Off\]</font>"]</h4>"}
|
||
|
||
if(hacking || emagged)
|
||
screen = 2
|
||
if(!linkedServer || (linkedServer.stat & (NOPOWER|BROKEN|FORCEDISABLE)))
|
||
message = noserver
|
||
|
||
switch(screen)
|
||
//Main menu
|
||
if(0)
|
||
//	 = TAB
|
||
var/i = 0
|
||
dat += "<dd><A href='?src=\ref[src];find=1'>	[++i]. Link To A Server</a></dd>"
|
||
if(auth)
|
||
if(!linkedServer || (linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
dat += "<dd><A>	ERROR: Server not found!</A><br></dd>"
|
||
else
|
||
|
||
dat += {"<dd><A href='?src=\ref[src];view=1'>	[++i]. View Message Logs </a><br></dd>
|
||
<dd><A href='?src=\ref[src];viewr=1'>	[++i]. View Request Console Logs </a></br></dd>
|
||
<dd><A href='?src=\ref[src];clear=1'>	[++i]. Clear Message Logs</a><br></dd>
|
||
<dd><A href='?src=\ref[src];clearr=1'>	[++i]. Clear Request Console Logs</a><br></dd>
|
||
<dd><A href='?src=\ref[src];pass=1'>	[++i]. Set Custom Key</a><br></dd>
|
||
<dd><A href='?src=\ref[src];msg=1'>	[++i]. Send Admin Message</a><br></dd>"}
|
||
else
|
||
for(var/n = ++i; n <= optioncount; n++)
|
||
dat += "<dd><font color='blue'>	[n]. ---------------</font><br></dd>"
|
||
if((istype(user, /mob/living/silicon/ai) || istype(user, /mob/living/silicon/robot)) && user.mind.special_role)
|
||
//Malf/Traitor AIs can bruteforce into the system to gain the Key.
|
||
dat += "<dd><A href='?src=\ref[src];hack=1'><i><font color='Red'>*&@#. Bruteforce Key</font></i></font></a><br></dd>"
|
||
else
|
||
dat += "<br>"
|
||
dat += "<hr><A href='?src=\ref[src];switchboard=1'> Landline Switchboard</a><br>"
|
||
//TODO add exclamation marks here if someone's calling
|
||
|
||
//Bottom message
|
||
if(!auth)
|
||
dat += "<br><hr><dd><span class='notice'>Please authenticate with the server in order to show additional options.</span>"
|
||
else
|
||
dat += "<br><hr><dd><span class='warning'>Reg, #514 forbids sending messages to a Head of Staff containing Erotic Rendering properties.</span>"
|
||
|
||
//Message Logs
|
||
if(1)
|
||
var/index = 0
|
||
//var/recipient = "Unspecified" //name of the person
|
||
//var/sender = "Unspecified" //name of the sender
|
||
//var/message = "Blank" //transferred message
|
||
|
||
dat += {"<center><A href='?src=\ref[src];back=1'>Back</a> - <A href='?src=\ref[src];refresh=1'>Refresh</center><hr>
|
||
<table border='1' width='100%'><tr><th width = '5%'>X</th><th width='15%'>Sender</th><th width='15%'>Recipient</th><th width='300px' word-wrap: break-word>Message</th><th width='30%'>Photo</th></tr>"}
|
||
for(var/datum/data_pda_msg/pda in src.linkedServer.pda_msgs)
|
||
index++
|
||
if(index > 3000)
|
||
break
|
||
// Del - Sender - Recepient - Message - Photo
|
||
// X - Al Green - Your Mom - WHAT UP!? - [Photo]
|
||
var/imgdat = ""
|
||
if(pda.img_sent)
|
||
user << browse_rsc(pda.img_sent, "tmp_photo_[index].png")
|
||
imgdat = "<img src='tmp_photo_[index].png' width = '192' style='image-rendering: pixelated'>"
|
||
dat += "<tr><td width = '5%'><center><A href='?src=\ref[src];delete=\ref[pda]' style='color: rgb(255,0,0)'>X</a></center></td><td width='15%'>[pda.sender]</td><td width='15%'>[pda.recipient]</td><td width='300px'>[pda.message]</td><th width='30%'>[imgdat]</th></tr>"
|
||
dat += "</table>"
|
||
//Hacking screen.
|
||
if(2)
|
||
if(istype(user, /mob/living/silicon/ai) || istype(user, /mob/living/silicon/robot))
|
||
|
||
dat += {"Brute-forcing for server key.<br> It will take 20 seconds for every character that the password has.
|
||
In the meantime, this console can reveal your true intentions if you let someone access it. Make sure no humans enter the room during that time."}
|
||
else
|
||
//It's the same message as the one above but in binary. Because robots understand binary and humans don't... well I thought it was clever.
|
||
dat += {"01000010011100100111010101110100011001010010110<br>
|
||
10110011001101111011100100110001101101001011011100110011<br>
|
||
10010000001100110011011110111001000100000011100110110010<br>
|
||
10111001001110110011001010111001000100000011010110110010<br>
|
||
10111100100101110001000000100100101110100001000000111011<br>
|
||
10110100101101100011011000010000001110100011000010110101<br>
|
||
10110010100100000001100100011000000100000011100110110010<br>
|
||
10110001101101111011011100110010001110011001000000110011<br>
|
||
00110111101110010001000000110010101110110011001010111001<br>
|
||
00111100100100000011000110110100001100001011100100110000<br>
|
||
10110001101110100011001010111001000100000011101000110100<br>
|
||
00110000101110100001000000111010001101000011001010010000<br>
|
||
00111000001100001011100110111001101110111011011110111001<br>
|
||
00110010000100000011010000110000101110011001011100010000<br>
|
||
00100100101101110001000000111010001101000011001010010000<br>
|
||
00110110101100101011000010110111001110100011010010110110<br>
|
||
10110010100101100001000000111010001101000011010010111001<br>
|
||
10010000001100011011011110110111001110011011011110110110<br>
|
||
00110010100100000011000110110000101101110001000000111001<br>
|
||
00110010101110110011001010110000101101100001000000111100<br>
|
||
10110111101110101011100100010000001110100011100100111010<br>
|
||
10110010100100000011010010110111001110100011001010110111<br>
|
||
00111010001101001011011110110111001110011001000000110100<br>
|
||
10110011000100000011110010110111101110101001000000110110<br>
|
||
00110010101110100001000000111001101101111011011010110010<br>
|
||
10110111101101110011001010010000001100001011000110110001<br>
|
||
10110010101110011011100110010000001101001011101000010111<br>
|
||
00010000001001101011000010110101101100101001000000111001<br>
|
||
10111010101110010011001010010000001101110011011110010000<br>
|
||
00110100001110101011011010110000101101110011100110010000<br>
|
||
00110010101101110011101000110010101110010001000000111010<br>
|
||
00110100001100101001000000111001001101111011011110110110<br>
|
||
10010000001100100011101010111001001101001011011100110011<br>
|
||
10010000001110100011010000110000101110100001000000111010<br>
|
||
001101001011011010110010100101110"}
|
||
|
||
//Fake messages
|
||
if(3)
|
||
dat += "<center><A href='?src=\ref[src];back=1'>Back</a> - <A href='?src=\ref[src];Reset=1'>Reset</a></center><hr>"
|
||
|
||
dat += {"<table border='1' width='100%'>
|
||
<tr><td width='20%'><A href='?src=\ref[src];select=Sender'>Sender</a></td>
|
||
<td width='20%'><A href='?src=\ref[src];select=RecJob'>Sender's Job</a></td>
|
||
<td width='20%'><A href='?src=\ref[src];select=Recepient'>Recipient</a></td>
|
||
<td width='300px' word-wrap: break-word><A href='?src=\ref[src];select=Message'>Message</a></td></tr>"}
|
||
//Sender - Sender's Job - Recepient - Message
|
||
//Al Green- Your Dad - Your Mom - WHAT UP!?
|
||
|
||
dat += {"<tr><td width='20%'>[customsender]</td>
|
||
<td width='20%'>[customjob]</td>
|
||
<td width='20%'>[customrecepient ? customrecepient.owner : "NONE"]</td>
|
||
<td width='300px'>[custommessage]</td></tr>"}
|
||
dat += "</table><br><center><A href='?src=\ref[src];select=Send'>Send</a>"
|
||
|
||
//Request Console Logs
|
||
if(4)
|
||
|
||
var/index = 0
|
||
/* data_rc_msg
|
||
X - 5%
|
||
var/rec_dpt = "Unspecified" //name of the person - 15%
|
||
var/send_dpt = "Unspecified" //name of the sender- 15%
|
||
var/message = "Blank" //transferred message - 300px
|
||
var/stamp = "Unstamped" - 15%
|
||
var/id_auth = "Unauthenticated" - 15%
|
||
var/priority = "Normal" - 10%
|
||
*/
|
||
dat += "<center><A href='?src=\ref[src];back=1'>Back</a> - <A href='?src=\ref[src];refresh=1'>Refresh</center><hr>"
|
||
dat += {"<table border='1' width='100%'><tr><th width = '5%'>X</th><th width='15%'>Sending Dep.</th><th width='15%'>Receiving Dep.</th>
|
||
<th width='300px' word-wrap: break-word>Message</th><th width='15%'>Stamp</th><th width='15%'>ID Auth.</th><th width='15%'>Priority.</th></tr>"}
|
||
for(var/datum/data_rc_msg/rc in src.linkedServer.rc_msgs)
|
||
index++
|
||
if(index > 3000)
|
||
break
|
||
// Del - Sender - Recepient - Message
|
||
// X - Al Green - Your Mom - WHAT UP!?
|
||
dat += {"<tr><td width = '5%'><center><A href='?src=\ref[src];deleter=\ref[rc]' style='color: rgb(255,0,0)'>X</a></center></td><td width='15%'>[rc.send_dpt]</td>
|
||
<td width='15%'>[rc.rec_dpt]</td><td width='300px'>[rc.message]</td><td width='15%'>[rc.stamp]</td><td width='15%'>[rc.id_auth]</td><td width='15%'>[rc.priority]</td></tr>"}
|
||
dat += "</table>"
|
||
if(5) //manual switchboard
|
||
var/current_button_num = 1
|
||
dat += "<table>"
|
||
dat += "<tr>"
|
||
for(var/obj/machinery/requests_console/RC in requests_consoles)
|
||
var/shortname_end = RC.department_short ? RC.department_short : RC.department
|
||
shortname_end = copytext(shortname_end,1,switchboard_namelength-1)
|
||
var/shortname = RC.master_department_short + "-" + shortname_end
|
||
var/callconnector
|
||
if(RC.landline.calling)
|
||
callconnector = "<A href='?src=\ref[src];stopCall=\ref[RC.landline]'>x</A>"
|
||
else
|
||
if(linking && RC.landline != linking)
|
||
callconnector = "<A href='?src=\ref[src];manualCall=\ref[RC.landline]'>o</A>"
|
||
else
|
||
callconnector = "<A href='?src=\ref[src];setLink=\ref[RC.landline]'> </A>"
|
||
|
||
var/b = RC.landline.get_status()
|
||
if(b)
|
||
shortname = "<A href='?src=\ref[src];setCurrentLine=\ref[RC.landline]'><font color=[b]>[shortname]</font></A>"
|
||
dat += "<td align=\"right\"><tt>[shortname]\[[callconnector]\]</tt></td>" //thanks no. 455311247
|
||
current_button_num += 1
|
||
if(current_button_num > switchboard_columns)
|
||
dat += "</tr><tr>"
|
||
current_button_num = 1
|
||
dat += "</tr>"
|
||
dat += "</table>"
|
||
var/currentline = "null"
|
||
if(switchboard_headset && switchboard_headset.linked_landline)
|
||
var/obj/machinery/requests_console/RC = switchboard_headset.linked_landline.attached_to
|
||
if(RC)
|
||
currentline = RC.master_department_short + "-" + copytext(RC.department,1,switchboard_namelength-1)
|
||
currentline = "<A href='?src=\ref[src];clearCurrentLine=1'>[currentline]</a>"
|
||
dat += "<br>Currently plugged to line: [currentline]"
|
||
dat += "<hr><br><A href='?src=\ref[src];back=1'>Back</a>"
|
||
|
||
|
||
dat += "</body>"
|
||
message = defaultmsg
|
||
user << browse(HTML_SKELETON(dat), "window=message;size=700x700")
|
||
onclose(user, "message")
|
||
return
|
||
|
||
/obj/machinery/computer/message_monitor/proc/BruteForce(mob/user as mob)
|
||
if(isnull(linkedServer))
|
||
to_chat(user, "<span class='warning'>Could not complete brute-force: Linked Server Disconnected!</span>")
|
||
else
|
||
var/currentKey = src.linkedServer.decryptkey
|
||
to_chat(user, "<span class='warning'>Brute-force completed! The key is '[currentKey]'.</span>")
|
||
src.hacking = 0
|
||
src.icon_state = normal_icon
|
||
src.screen = 0 // Return the screen back to normal
|
||
|
||
/obj/machinery/computer/message_monitor/proc/UnmagConsole()
|
||
src.icon_state = normal_icon
|
||
src.emagged = 0
|
||
|
||
/obj/machinery/computer/message_monitor/proc/ResetMessage()
|
||
customsender = "System Administrator"
|
||
customrecepient = null
|
||
custommessage = "This is a test, please ignore."
|
||
customjob = "Admin"
|
||
|
||
/obj/machinery/computer/message_monitor/Topic(href, href_list)
|
||
if(..())
|
||
return 1
|
||
else
|
||
//Authenticate
|
||
if (href_list["auth"])
|
||
if(auth)
|
||
auth = 0
|
||
screen = 0
|
||
else
|
||
var/dkey = sanitize(trim(input(usr, "Please enter the decryption key.") as text|null))
|
||
if(dkey && dkey != "")
|
||
if(src.linkedServer.decryptkey == dkey)
|
||
auth = 1
|
||
else
|
||
message = incorrectkey
|
||
|
||
//Turn the server on/off.
|
||
if (href_list["active"])
|
||
if(auth)
|
||
linkedServer.disabled = !linkedServer.disabled
|
||
//toggle automatic landline connections
|
||
if (href_list["toggleLandlines"])
|
||
if(auth)
|
||
linkedServer.automatic_landlines = !linkedServer.automatic_landlines
|
||
//Find a server
|
||
if (href_list["find"])
|
||
if(message_servers && message_servers.len > 1)
|
||
src.linkedServer = input(usr,"Please select a server.", "Select a server.", null) as null|anything in message_servers
|
||
message = "<span class='alert'>NOTICE: Server selected.</span>"
|
||
else if(message_servers && message_servers.len > 0)
|
||
linkedServer = message_servers[1]
|
||
message = "<span class='notice'>NOTICE: Only Single Server Detected - Server selected.</span>"
|
||
else
|
||
message = noserver
|
||
|
||
//View the logs - KEY REQUIRED
|
||
if (href_list["view"])
|
||
if(src.linkedServer == null || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else
|
||
if(auth)
|
||
src.screen = 1
|
||
|
||
//Clears the logs - KEY REQUIRED
|
||
if (href_list["clear"])
|
||
if(!linkedServer || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else
|
||
if(auth)
|
||
src.linkedServer.pda_msgs = list()
|
||
message = "<span class='notice'>NOTICE: Logs cleared.</span>"
|
||
//Clears the request console logs - KEY REQUIRED
|
||
if (href_list["clearr"])
|
||
if(!linkedServer || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else
|
||
if(auth)
|
||
src.linkedServer.rc_msgs = list()
|
||
message = "<span class='notice'>NOTICE: Logs cleared.</span>"
|
||
//Change the password - KEY REQUIRED
|
||
if (href_list["pass"])
|
||
if(!linkedServer || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else
|
||
if(auth)
|
||
var/dkey = sanitize(trim(input(usr, "Please enter the decryption key.") as text|null))
|
||
if(dkey && dkey != "")
|
||
if(src.linkedServer.decryptkey == dkey)
|
||
var/newkey = sanitize(trim(input(usr,"Please enter the new key (3 - 16 characters max):")))
|
||
if(length(newkey) <= 3)
|
||
message = "<span class='notice'>NOTICE: Decryption key too short!</span>"
|
||
else if(length(newkey) > 16)
|
||
message = "<span class='notice'>NOTICE: Decryption key too long!</span>"
|
||
else if(newkey && newkey != "")
|
||
src.linkedServer.decryptkey = newkey
|
||
message = "<span class='notice'>NOTICE: Decryption key set.</span>"
|
||
else
|
||
message = incorrectkey
|
||
|
||
//Hack the Console to get the password
|
||
if (href_list["hack"])
|
||
if((istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/living/silicon/robot)) && usr.mind.special_role)
|
||
src.hacking = 1
|
||
src.screen = 2
|
||
src.icon_state = hack_icon
|
||
//Time it takes to bruteforce is dependant on the password length.
|
||
spawn(100*length(src.linkedServer.decryptkey))
|
||
if(src && src.linkedServer && usr)
|
||
BruteForce(usr)
|
||
//Delete the log.
|
||
if (href_list["delete"])
|
||
//Are they on the view logs screen?
|
||
if(screen == 1)
|
||
if(!linkedServer || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else //if(istype(href_list["delete"], /datum/data_pda_msg))
|
||
src.linkedServer.pda_msgs -= locate(href_list["delete"])
|
||
message = "<span class='notice'>NOTICE: Log Deleted!</span>"
|
||
//Delete the request console log.
|
||
if (href_list["deleter"])
|
||
//Are they on the view logs screen?
|
||
if(screen == 4)
|
||
if(!linkedServer || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else //if(istype(href_list["delete"], /datum/data_pda_msg))
|
||
src.linkedServer.rc_msgs -= locate(href_list["deleter"])
|
||
message = "<span class='notice'>NOTICE: Log Deleted!</span>"
|
||
//Create a custom message
|
||
if (href_list["msg"])
|
||
if(src.linkedServer == null || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else
|
||
if(auth)
|
||
src.screen = 3
|
||
//Fake messaging selection - KEY REQUIRED
|
||
if (href_list["select"])
|
||
if(src.linkedServer == null || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
screen = 0
|
||
else
|
||
switch(href_list["select"])
|
||
|
||
//Reset
|
||
if("Reset")
|
||
ResetMessage()
|
||
|
||
//Select Your Name
|
||
if("Sender")
|
||
customsender = input(usr, "Please enter the sender's name.") as text|null
|
||
customsender = copytext(sanitize(customsender), 1, MAX_NAME_LEN)
|
||
|
||
//Select Receiver
|
||
if("Recepient")
|
||
//Get out list of viable PDAs
|
||
var/list/obj/item/device/pda/sendPDAs = get_viewable_pdas()
|
||
if(PDAs && PDAs.len > 0)
|
||
customrecepient = input(usr, "Select a PDA from the list.") as null|anything in sortNames(sendPDAs)
|
||
else
|
||
customrecepient = null
|
||
|
||
//Enter custom job
|
||
if("RecJob")
|
||
customjob = input(usr, "Please enter the sender's job.") as text|null
|
||
customjob = copytext(sanitize(customjob), 1, MAX_NAME_LEN)
|
||
|
||
//Enter message
|
||
if("Message")
|
||
custommessage = input(usr, "Please enter your message.") as text|null
|
||
custommessage = copytext(sanitize(custommessage), 1, MAX_MESSAGE_LEN)
|
||
|
||
//Send message
|
||
if("Send")
|
||
|
||
if(isnull(customsender) || customsender == "")
|
||
customsender = "UNKNOWN"
|
||
|
||
if(isnull(customrecepient))
|
||
message = "<span class='notice'>NOTICE: No recepient selected!</span>"
|
||
return src.attack_hand(usr)
|
||
|
||
if(isnull(custommessage) || custommessage == "")
|
||
message = "<span class='notice'>NOTICE: No message entered!</span>"
|
||
return src.attack_hand(usr)
|
||
|
||
|
||
var/datum/pda_app/messenger/message_app = locate(/datum/pda_app/messenger) in customrecepient.applications
|
||
if(!message_app) //Shouldn't show up but just in case we need to explain it, also to prevent the below runtiming
|
||
message = "<span class='notice'>NOTICE: This PDA does not have a messenger, somehow.</span>"
|
||
return src.attack_hand(usr)
|
||
|
||
var/obj/item/device/pda/PDARec = null
|
||
for (var/obj/item/device/pda/P in get_viewable_pdas())
|
||
if(P.owner == customsender)
|
||
PDARec = P
|
||
//Sender isn't faking as someone who exists
|
||
if(isnull(PDARec))
|
||
src.linkedServer.send_pda_message("[customrecepient.owner]", "[customsender]","[custommessage]")
|
||
message_app.tnote += "<i><b>← From <a href='byond://?src=\ref[customrecepient];choice=Message;target=\ref[src]'>[customsender]</a> ([customjob]):</b></i><br>[custommessage]<br>"
|
||
if (!message_app.silent)
|
||
playsound(customrecepient.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||
for (var/mob/O in hearers(3, customrecepient.loc))
|
||
O.show_message(text("[bicon(customrecepient)] *[message_app.ttone]*"))
|
||
if( customrecepient.loc && ishuman(customrecepient.loc) )
|
||
var/mob/living/carbon/human/H = customrecepient.loc
|
||
to_chat(H, "[bicon(customrecepient)] <b>Message from [customsender] ([customjob]), </b>\"[custommessage]\" (<a href='byond://?src=\ref[src];choice=Message;skiprefresh=1;target=\ref[src]'>Reply</a>)")
|
||
|
||
log_pda("[key_name(usr)] (PDA: [customsender]) sent \"[custommessage]\" to [customrecepient.owner]")
|
||
customrecepient.overlays.len = 0
|
||
customrecepient.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||
//Sender is faking as someone who exists
|
||
else
|
||
src.linkedServer.send_pda_message("[customrecepient.owner]", "[PDARec.owner]","[custommessage]")
|
||
message_app.tnote += "<i><b>← From <a href='byond://?src=\ref[customrecepient];choice=Message;target=\ref[PDARec]'>[PDARec.owner]</a> ([customjob]):</b></i><br>[custommessage]<br>"
|
||
if (!message_app.silent)
|
||
playsound(customrecepient.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||
for (var/mob/O in hearers(3, customrecepient.loc))
|
||
O.show_message(text("[bicon(customrecepient)] *[message_app.ttone]*"))
|
||
if( customrecepient.loc && ishuman(customrecepient.loc) )
|
||
var/mob/living/carbon/human/H = customrecepient.loc
|
||
to_chat(H, "[bicon(customrecepient)] <b>Message from [PDARec.owner] ([customjob]), </b>\"[custommessage]\" (<a href='byond://?src=\ref[customrecepient];choice=Message;skiprefresh=1;target=\ref[PDARec]'>Reply</a>)")
|
||
|
||
log_pda("[key_name(usr)] (PDA: [PDARec.owner]) sent \"[custommessage]\" to [customrecepient.owner]")
|
||
customrecepient.overlays.len = 0
|
||
customrecepient.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||
//Finally..
|
||
ResetMessage()
|
||
|
||
//Request Console Logs - KEY REQUIRED
|
||
if(href_list["viewr"])
|
||
if(src.linkedServer == null || (src.linkedServer.stat & (FORCEDISABLE|NOPOWER|BROKEN)))
|
||
message = noserver
|
||
else
|
||
if(auth)
|
||
src.screen = 4
|
||
|
||
// to_chat(usr, href_list["select"])
|
||
if (href_list["switchboard"])
|
||
src.screen = 5
|
||
if (href_list["stopCall"])
|
||
var/obj/landline/L = locate(href_list["stopCall"])
|
||
if(L)
|
||
if(L.calling)
|
||
L.calling.last_call_log += text("call disconnected by operator<BR>")
|
||
L.calling.calling = null
|
||
if(L.calling.linked_phone)
|
||
playsound(L.calling.linked_phone, switchboard_sound2, 100, 1)
|
||
L.last_call_log += text("call disconnected by operator<BR>")
|
||
if(L.linked_phone)
|
||
playsound(L.linked_phone, switchboard_sound2, 100, 1)
|
||
L.calling = null
|
||
updateUsrDialog()
|
||
playsound(src, switchboard_sound2, 100, 1)
|
||
if (href_list["manualCall"])
|
||
var/obj/landline/L = locate(href_list["manualCall"])
|
||
if(L && linking && (L != linking))
|
||
if(L.calling || linking.calling)
|
||
return
|
||
L.calling = linking
|
||
linking.calling = L
|
||
L.ring_loop()
|
||
linking.ring_loop()
|
||
var/obj/machinery/requests_console/L_console = L.attached_to
|
||
var/obj/machinery/requests_console/linking_console = linking.attached_to
|
||
L.last_call_log += text("connected to [linking_console.department] by operator<BR>")
|
||
linking.last_call_log += text("connected to [L_console.department] by operator<BR>")
|
||
if(L.calling.linked_phone)
|
||
playsound(L.calling.linked_phone, switchboard_sound, 100, 1)
|
||
if(L.linked_phone)
|
||
playsound(L.linked_phone, switchboard_sound, 100, 1)
|
||
playsound(src, switchboard_sound, 100, 1)
|
||
linking = FALSE
|
||
if (href_list["setLink"])
|
||
var/obj/landline/L = locate(href_list["setLink"])
|
||
if(!L || linking)
|
||
return
|
||
linking = L
|
||
playsound(src, switchboard_sound, 100, 1)
|
||
updateUsrDialog()
|
||
if (href_list["back"])
|
||
src.screen = 0
|
||
if (href_list["clearCurrentLine"])
|
||
if(switchboard_headset && switchboard_headset.linked_landline)
|
||
var/obj/landline/LL = switchboard_headset.linked_landline
|
||
if(LL.linked_phone)
|
||
playsound(LL.linked_phone, switchboard_sound2, 100, 1)
|
||
if(LL.calling && LL.calling.linked_phone)
|
||
playsound(LL.calling.linked_phone, switchboard_sound2, 100, 1)
|
||
LL.listening_operators -= src.switchboard_headset
|
||
switchboard_headset.linked_landline = null
|
||
playsound(src, switchboard_sound2, 100, 1)
|
||
updateUsrDialog()
|
||
if (href_list["setCurrentLine"])
|
||
var/obj/landline/L = locate(href_list["setCurrentLine"])
|
||
if(L && switchboard_headset)
|
||
L.listening_operators += switchboard_headset
|
||
switchboard_headset.linked_landline = L
|
||
playsound(src, switchboard_sound, 100, 1)
|
||
if(L.linked_phone)
|
||
playsound(L.linked_phone, switchboard_sound, 100, 1)
|
||
if(L.calling && L.calling.linked_phone)
|
||
playsound(L.calling.linked_phone, switchboard_sound, 100, 1)
|
||
updateUsrDialog()
|
||
return src.attack_hand(usr)
|
||
|
||
|
||
/obj/item/weapon/paper/monitorkey
|
||
//..()
|
||
name = "Monitor Decryption Key"
|
||
var/obj/machinery/message_server/server = null
|
||
|
||
/obj/item/weapon/paper/monitorkey/New()
|
||
..()
|
||
spawn(10)
|
||
if(message_servers)
|
||
for(var/obj/machinery/message_server/server in message_servers)
|
||
if(!isnull(server))
|
||
if(!isnull(server.decryptkey))
|
||
info = "<center><h2>Daily Key Reset</h2></center><br>The new message monitor key is '[server.decryptkey]'.<br>Please keep this a secret and away from the clown.<br>If necessary, change the password to a more secure one."
|
||
info_links = info
|
||
overlays += image(icon = icon, icon_state = "paper_words")
|
||
break
|