Fax rewrite and Discord linking

Technically this should have its own branch, but eh.
Rewrites faxes to be less dependant on the original piece of paper, and the trail of procs normally generated when one is sent. Logs all faxes to a datum, makes them accessible through the check-fax-history proc, and makes it possible to send a fax without any prompts through the send-admin-fax proc.

Also alerts DOs on Discord if faxes arrive.
This commit is contained in:
skull132
2016-01-23 16:49:34 +02:00
parent 5a2dbcb789
commit 9fababfd35
5 changed files with 170 additions and 45 deletions
@@ -89,7 +89,9 @@ var/list/admin_verbs_admin = list(
/client/proc/toggle_view_range, /*changes how far we can see*/
/client/proc/toggle_visibily,
/client/proc/secrets,
/client/proc/set_ooc
/client/proc/set_ooc,
/client/proc/send_admin_fax,
/client/proc/check_fax_history
)
var/list/admin_verbs_ban = list(
@@ -145,7 +147,9 @@ var/list/admin_verbs_fun = list(
/client/proc/player_panel,
/client/proc/secrets,
/client/proc/send_space_ninja,
/client/proc/toggle_view_range
/client/proc/toggle_view_range,
/client/proc/send_admin_fax,
/client/proc/check_fax_history
)
var/list/admin_verbs_dev = list(
@@ -403,7 +407,9 @@ var/list/admin_verbs_duty = list(
/client/proc/cmd_admin_create_centcom_report,
/client/proc/cmd_duty_say,
/client/proc/returntobody,
/client/proc/view_duty_log
/client/proc/view_duty_log,
/client/proc/send_admin_fax,
/client/proc/check_fax_history
)
/client/proc/add_admin_verbs()
+8 -39
View File
@@ -1531,49 +1531,18 @@
H << "An encripted connection was made and a file was uploaded to your systems. \"Please stand by for a message from Central Command. Message as follows. <b>\"[input]\"</b> Message ends.\""
else if(href_list["CentcommFaxView"])
var/info = locate(href_list["CentcommFaxView"])
if (!href_list["CentcommFaxReceived"] || !ticker)
return
usr << browse("<HTML><HEAD><TITLE>Centcomm Fax Message</TITLE></HEAD><BODY>[info]</BODY></HTML>", "window=Centcomm Fax Message")
var/list/fax = ticker.fax_repository.get_fax(text2num(href_list["CentcommFaxView"]), text2num(href_list["CentcommFaxReceived"]))
usr << browse("<HTML><HEAD><TITLE>Centcomm Fax Message</TITLE></HEAD><BODY>[fax["data"]]</BODY></HTML>", "window=Centcomm Fax Message")
else if(href_list["CentcommFaxReply"])
var/mob/living/carbon/human/H = locate(href_list["CentcommFaxReply"])
var/input = input(src.owner, "Please enter a message to reply to [key_name(H)] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use <br> for line breaks.", "Outgoing message from Centcomm", "") as message|null
if(!input) return
var/customname = input(src.owner, "Pick a title for the report", "Title") as text|null
//so that we alert people with certain cartidges with a PDA message.
alertFaxes()
for(var/obj/machinery/faxmachine/F in machines)
if(! (F.stat & (BROKEN|NOPOWER) ) )
// animate! it's alive!
flick("faxreceive", F)
// give the sprite some time to flick
spawn(20)
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( F.loc )
P.name = "[command_name()]- [customname]"
P.info = input
P.update_icon()
playsound(F.loc, "sound/items/polaroid1.ogg", 50, 1)
// Stamps
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
stampoverlay.icon_state = "paper_stamp-cent"
if(!P.stamped)
P.stamped = new
P.stamped += /obj/item/weapon/stamp
P.overlays += stampoverlay
P.stamps += "<HR><i>This paper has been stamped by the Central Command Quantum Relay.</i>"
src.owner << "Message reply to transmitted successfully."
log_admin("[key_name(src.owner)] replied to a fax message from [key_name(H)]: [input]")
message_admins("[key_name_admin(src.owner)] replied to a fax message from [key_name_admin(H)] <a href='?_src_=holder;CentcommFaxView=\ref[input]'>view message</a>", 1)
usr.client.send_admin_fax()
else if (href_list["CentcommFaxHistory"])
usr.client.check_fax_history(text2num(href_list["CentcommFaxHistory"]))
else if(href_list["jumpto"])
if(!check_rights(R_ADMIN|R_FUN)) return
@@ -246,3 +246,99 @@
var/oldjob = M.mind.assigned_role
job_master.FreeRole(oldjob)
return
/client/proc/send_admin_fax()
set name = "Send admin fax"
set desc = "Send a fax from Central Command"
set category = "Special Verbs"
if (!check_rights(R_ADMIN|R_DUTYOFF|R_FUN))
usr << "\red You do not have enough powers to do this."
return
if (!ticker)
usr << "\red No ticker! Bad!"
return
if (ticker.current_state < GAME_STATE_PLAYING)
usr << "\red The game hasn't started yet!"
return
var/input = input(usr, "Please enter a message to send to [station_name()] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use <br> for line breaks.", "Outgoing message from Centcomm", "") as message|null
if (!input)
usr << "\red Cancelled."
return
var/customsender = input(usr, "Pick a Duty Officer name to use", "Name") as text|null
if (!customsender)
usr << "\red Name required! Cancelled."
return
var/customname = input(usr, "Pick a title for the report", "Title") as text|null
//so that we alert people with certain cartidges with a PDA message.
alertFaxes()
for (var/obj/machinery/faxmachine/F in machines)
if (!(F.stat & (BROKEN|NOPOWER)))
// animate! it's alive!
flick("faxreceive", F)
// give the sprite some time to flick
spawn(20)
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(F.loc)
P.name = "[command_name()]- [customname]"
P.info = input
P.update_icon()
playsound(F.loc, "sound/items/polaroid1.ogg", 50, 1)
// Stamps
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
stampoverlay.icon_state = "paper_stamp-cent"
if (!P.stamped)
P.stamped = new
P.stamped += /obj/item/weapon/stamp
P.overlays += stampoverlay
P.stamps += "<HR><i>This paper has been stamped by the Central Command Quantum Relay.</i>"
var/fax_id = ticker.fax_repository.add_fax(input, customname, customsender, 0)
usr << "Message reply to transmitted successfully."
log_admin("[key_name(usr)] sent a Central Command fax message: [input]")
message_admins("[key_name_admin(usr)] sent a Central Command fax message: <a href='?_src_=holder;CentcommFaxView=[fax_id];CentcommFaxReceived=0'>view message</a>", 1)
/client/proc/check_fax_history()
set name = "Check fax history"
set desc = "Look up the faxes sent this round."
set category = "Special Verbs"
if (!check_rights(R_ADMIN|R_DUTYOFF|R_FUN))
usr << "\red You do not have enough powers to do this."
return
if (!ticker)
usr << "\red No ticker! Bad!"
return
if (ticker.current_state < GAME_STATE_PLAYING)
usr << "\red The game hasn't started yet!"
return
var/data = "<center><a href='?_src_=holder;CentcommFaxReply=1'>Send New Fax</a></center>"
data += "<hr>"
data += "<center><b>Received Faxes:</b></center><br>"
var/list/faxes = ticker.fax_repository.get_subjects(1)
for (var/i in faxes)
data += "<a href='?_src_=holder;CentcommFaxView=[faxes[i]];CentcommFaxReceived=1'>[i]</a><br>"
faxes = ticker.fax_repository.get_subjects(0)
data += "<hr><center><b>Sent Faxes:</b></center><br>"
for (var/i in faxes)
data += "<a href='?_src_=holder;CentcommFaxView=[faxes[i]];CentcommFaxReceived=0'>[i]</a><br>"
usr << browse("<HTML><HEAD><TITLE>Centcomm Fax History</TITLE></HEAD><BODY>[data]</BODY></HTML>", "window=Centcomm Fax History")