mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-07-17 10:42:20 +01:00
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:
@@ -1,6 +1,48 @@
|
||||
var/list/obj/machinery/faxmachine/allfaxes = list()
|
||||
var/list/alldepartments = list("Central Command")
|
||||
|
||||
/datum/fax_repository
|
||||
var/list/received_faxes = list()
|
||||
var/list/sent_faxes = list()
|
||||
|
||||
/datum/fax_repository/proc/add_fax(var/data, var/subject, var/sender, var/received = 1)
|
||||
if (!data || !subject || !sender)
|
||||
return
|
||||
|
||||
var/list/new_fax = list("data" = data, "subject" = subject, "sender" = sender)
|
||||
switch (received)
|
||||
if (1)
|
||||
received_faxes.Add(list(new_fax))
|
||||
return received_faxes.len
|
||||
if (0)
|
||||
sent_faxes.Add(list(new_fax))
|
||||
return sent_faxes.len
|
||||
|
||||
/datum/fax_repository/proc/get_fax(var/id, var/received = 1)
|
||||
if (!id)
|
||||
return
|
||||
|
||||
switch (received)
|
||||
if (1)
|
||||
return received_faxes[id]
|
||||
if (0)
|
||||
return sent_faxes[id]
|
||||
|
||||
/datum/fax_repository/proc/get_subjects(var/received = 1)
|
||||
var/list/target_list = null
|
||||
switch (received)
|
||||
if (1)
|
||||
target_list = received_faxes
|
||||
if (0)
|
||||
target_list = sent_faxes
|
||||
|
||||
var/list/return_list = list()
|
||||
for (var/i = 1, i <= target_list.len, i++)
|
||||
return_list.Add(target_list[i]["subject"])
|
||||
return_list[target_list[i]["subject"]] = i
|
||||
|
||||
return return_list
|
||||
|
||||
/obj/machinery/faxmachine
|
||||
name = "fax machine"
|
||||
icon = 'icons/obj/library.dmi'
|
||||
@@ -179,6 +221,11 @@ var/list/alldepartments = list("Central Command")
|
||||
|
||||
/proc/Centcomm_fax(var/sent, var/sentname, var/mob/Sender)
|
||||
|
||||
if (!ticker)
|
||||
return
|
||||
|
||||
var/fax_id = ticker.fax_repository.add_fax(sent, sentname, Sender.name)
|
||||
|
||||
for(var/client/C in admins)
|
||||
var/msg = "\blue <b><font color='orange'>CENTCOMM FAX: </font>"
|
||||
if(C.holder.rights & (R_ADMIN|R_FUN|R_MOD))
|
||||
@@ -186,12 +233,14 @@ var/list/alldepartments = list("Central Command")
|
||||
else
|
||||
msg += "[key_name(Sender,0,1,0)]"
|
||||
|
||||
msg += " (<a href='?_src_=holder;CentcommFaxReply=\ref[Sender]'>RPLY</a>)</b>: Receiving '[sentname]' via secure connection ... <a href='?_src_=holder;CentcommFaxView=\ref[sent]'>view message</a>"
|
||||
msg += " (<a href='?_src_=holder;CentcommFaxReply=1'>RPLY</a>)</b>: Receiving '[sentname]' via secure connection ... <a href='?_src_=holder;CentcommFaxView=[fax_id];CentcommFaxReceived=1'>view message</a>"
|
||||
|
||||
if(C.holder.rights & (R_ADMIN|R_DUTYOFF|R_FUN))
|
||||
C << msg
|
||||
|
||||
proc/SendFax(var/sent, var/sentname, var/mob/Sender, var/dpt)
|
||||
send_to_discord("cciaa_channel", "@everyone Received fax from [Sender]. Subject: [sentname].")
|
||||
|
||||
/proc/SendFax(var/sent, var/sentname, var/mob/Sender, var/dpt)
|
||||
|
||||
for(var/obj/machinery/faxmachine/F in allfaxes)
|
||||
if( F.department == dpt )
|
||||
@@ -249,4 +298,4 @@ proc/SendFax(var/sent, var/sentname, var/mob/Sender, var/dpt)
|
||||
L = get(PDA, /mob/living/silicon)
|
||||
|
||||
if(L)
|
||||
L << "\icon[PDA] <b>Message from [sender], </b>\"[message]\" (Unable to Reply)"
|
||||
L << "\icon[PDA] <b>Message from [sender], </b>\"[message]\" (Unable to Reply)"
|
||||
|
||||
Reference in New Issue
Block a user