diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 727dfc58c61..6e2f9b1d4b4 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -65,7 +65,8 @@ var/list/admin_verbs_admin = list( /client/proc/global_man_up, /client/proc/delbook, /client/proc/event_manager_panel, - /client/proc/empty_ai_core_toggle_latejoin + /client/proc/empty_ai_core_toggle_latejoin, + /client/proc/fax_panel ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 04def53cc9f..0cb98be5ff9 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1561,11 +1561,11 @@ usr << "This can only be used on instances of type /mob/living" return - if(alert(src.owner, "Are you sure you wish to hit [key_name(M)] with Blue Space Artillery?", "Confirm Firing?" , "Yes" , "No") != "Yes") + if(alert(src.owner, "Are you sure you wish to hit [key_name(M)] with Bluespace Artillery?", "Confirm Firing?" , "Yes" , "No") != "Yes") return if(BSACooldown) - src.owner << "Standby! Reload cycle in progress! Gunnary crews ready in five seconds!" + src.owner << "Standby. Reload cycle in progress. Gunnery crews ready in five seconds!" return BSACooldown = 1 @@ -1597,6 +1597,9 @@ M.stuttering = 20 else if(href_list["CentcommReply"]) + if(!check_rights(R_ADMIN)) + return + var/mob/living/carbon/human/H = locate(href_list["CentcommReply"]) if(!istype(H)) usr << "This can only be used on instances of type /mob/living/carbon/human" @@ -1614,10 +1617,16 @@ H << "You hear something crackle in your headset for a moment before a voice speaks. \"Please stand by for a message from Central Command. Message as follows. [input]. Message ends.\"" else if(href_list["SyndicateReply"]) + if(!check_rights(R_ADMIN)) + return + var/mob/living/carbon/human/H = locate(href_list["SyndicateReply"]) if(!istype(H)) usr << "This can only be used on instances of type /mob/living/carbon/human" return + if(H.stat != 0) + usr << "The person you are trying to contact is not conscious." + return if(!istype(H.l_ear, /obj/item/device/radio/headset) && !istype(H.r_ear, /obj/item/device/radio/headset)) usr << "The person you are trying to contact is not wearing a headset" return @@ -1646,6 +1655,9 @@ H << "You hear something crackle in your headset for a moment before a voice speaks. \"Please stand by for a message from your HONKbrothers. Message as follows, HONK. [input]. Message ends, HONK.\"" else if(href_list["AdminFaxView"]) + if(!check_rights(R_ADMIN)) + return + var/obj/item/fax = locate(href_list["AdminFaxView"]) if (istype(fax, /obj/item/weapon/paper)) var/obj/item/weapon/paper/P = fax @@ -1668,6 +1680,9 @@ usr << "\red The faxed item is not viewable. This is probably a bug, and should be reported on the tracker: [fax.type]" else if (href_list["AdminFaxViewPage"]) + if(!check_rights(R_ADMIN)) + return + var/page = text2num(href_list["AdminFaxViewPage"]) var/obj/item/weapon/paper_bundle/bundle = locate(href_list["paper_bundle"]) @@ -1681,50 +1696,135 @@ H.show(src.owner) return - else if(href_list["CentcommFaxReply"]) - var/mob/sender = locate(href_list["CentcommFaxReply"]) + else if(href_list["AdminFaxCreate"]) + if(!check_rights(R_ADMIN)) + return + + var/mob/sender = locate(href_list["AdminFaxCreate"]) var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["originfax"]) + var/faxtype = href_list["faxtype"] + var/reply_to = locate(href_list["replyto"]) + var/destination + var/notify - var/input = input(src.owner, "Please enter a message to reply to [key_name(sender)] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use
for line breaks.", "Outgoing message from Centcomm", "") as message|null - if(!input) return + var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(null) //hopefully the null loc won't cause trouble for us + + if(!fax) + var/list/departmentoptions = alldepartments + "All Departments" + destination = input(usr, "To which department?", "Choose a department", "") as null|anything in departmentoptions + if(!destination) + del(P) + return - var/customname = input(src.owner, "Pick a title for the report", "Title") as text|null + for(var/obj/machinery/photocopier/faxmachine/F in allfaxes) + if(destination != "All Departments" && F.department == destination) + fax = F + + var/input = input(src.owner, "Please enter a message to send a fax via secure connection. Use
for line breaks. Both pencode and HTML work.", "Outgoing message from Centcomm", "") as message|null + if(!input) + del(P) + return + input = P.parsepencode(input) // Encode everything from pencode to html + + var/customname = input(src.owner, "Pick a title for the fax.", "Fax Title") as text|null + + var/stamptype + var/stampvalue + var/sendername + switch(faxtype) + if("Central Command") + stamptype = "icon" + stampvalue = "cent" + sendername = command_name() + if("Syndicate") + sendername = "UNKNOWN" + if("Administrator") + stamptype = input(src.owner, "Pick a stamp type.", "Stamp Type") as null|anything in list("icon","text","none") + if(stamptype == "icon") + stampvalue = input(src.owner, "Pick a stamp icon.", "Stamp Icon") as null|anything in list("cent","ok","deny","clown") + else if(stamptype == "text") + stampvalue = input(src.owner, "What should the stamp say?.", "Stamp Text") as text|null + else + stamptype = "" + sendername = input(src.owner, "What organization does the fax come from? This determines the prefix of the paper (i.e. CentCom- Title).", "Stamp Organization") as text|null + + if(sender) + notify = alert(src.owner, "Would you like to inform the original sender that a fax has arrived?","Notify Sender","Yes","No") // Create the reply message - var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( null ) //hopefully the null loc won't cause trouble for us - P.name = "[command_name()]- [customname]" + + P.name = "[sendername]- [customname]" P.info = input P.update_icon() - P.stamps += "
" - var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') P.x = rand(-2, 0) P.y = rand(-1, 2) P.offset_x += P.x P.offset_y += P.y - stampoverlay.pixel_x = P.x - stampoverlay.pixel_y = P.y + + if(stamptype) + var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') + stampoverlay.pixel_x = P.x + stampoverlay.pixel_y = P.y - if(!P.ico) - P.ico = new - P.ico += "paper_stamp-cent" - stampoverlay.icon_state = "paper_stamp-cent" - - // Stamps - if(!P.stamped) - P.stamped = new - P.stamped += /obj/item/weapon/stamp/centcom - P.overlays += stampoverlay + if(!P.ico) + P.ico = new + P.ico += "paper_stamp-cent" + stampoverlay.icon_state = "paper_stamp-cent" - if(fax.recievefax(P)) - src.owner << "\blue Message reply to transmitted successfully." - log_admin("[key_name(src.owner)] replied to a fax message from [key_name(sender)]: [input]") - message_admins("[key_name_admin(src.owner)] replied to a fax message from [key_name_admin(sender)]", 1) + if(stamptype == "icon") + if(!P.stamped) + P.stamped = new + P.stamped += /obj/item/weapon/stamp/centcom + P.overlays += stampoverlay + P.stamps += "
" + + else if(stamptype == "text") + if(!P.stamped) + P.stamped = new + P.stamped += /obj/item/weapon/stamp + P.overlays += stampoverlay + P.stamps += "
[stampvalue]" + + if(destination != "All Departments") + if(!fax.receivefax(P)) + src.owner << "\red Message transmittion failed." + return else - src.owner << "\red Message reply failed." - - spawn(100) - del(P) + for(var/obj/machinery/photocopier/faxmachine/F in allfaxes) + if(F.z == 1) + if(!F.receivefax(P)) + src.owner << "\red Message transmission to [F.department] failed." + + var/datum/fax/admin/A = new /datum/fax/admin() + A.name = P.name + A.from_department = faxtype + if(destination != "All Departments") + A.to_department = fax.department + else + A.to_department = "All Departments" + A.origin = "Administrator" + A.message = P + A.reply_to = reply_to + A.sent_by = usr + + src.owner << "\blue Message transmitted successfully." + if(notify == "Yes") + var/mob/living/carbon/human/H = sender + if(istype(H) && H.stat == 1 && (istype(H.l_ear, /obj/item/device/radio/headset) || istype(H.r_ear, /obj/item/device/radio/headset))) + sender << "Your headset pings, notifying you that a reply to your fax has arrived." + if(sender) + log_admin("[key_name(src.owner)] replied to a fax message from [key_name(sender)]: [input]") + message_admins("[key_name_admin(src.owner)] replied to a fax message from [key_name_admin(sender)] (VIEW).", 1) + else + log_admin("[key_name(src.owner)] sent a fax message to [destination]: [input]") + message_admins("[key_name_admin(src.owner)] sent a fax message to [destination] (VIEW).", 1) return + + else if(href_list["refreshfaxpanel"]) + if(!check_rights(R_ADMIN)) + return + + fax_panel(usr) else if(href_list["jumpto"]) if(!check_rights(R_ADMIN)) return diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index 0494cfab89d..caab5c8b258 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -62,7 +62,7 @@ /proc/Syndicate_announce(var/text , var/mob/Sender) var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN) - msg = "\blue SYNDICATE:[key_name(Sender, 1)] (PP) (VV) (SM) (JMP) (CA) (BSA) (RPLY): [msg]" + msg = "\blue SYNDICATE: [key_name(Sender, 1)] (PP) (VV) (SM) (JMP) (CA) (BSA) (REPLY): [msg]" var/list/eventholders = list() var/list/banholders = list() diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm new file mode 100644 index 00000000000..6969db88604 --- /dev/null +++ b/code/modules/paperwork/fax.dm @@ -0,0 +1,85 @@ +// Fax datum - holds all faxes sent during the round +var/list/faxes = list() +var/list/adminfaxes = list() + +/datum/fax + var/name = "fax" + var/from_department = null + var/to_department = null + var/origin = null + var/message = null + var/sent_by = null + +/datum/fax/New() + faxes += src + +/datum/fax/admin + var/list/reply_to = null + +/datum/fax/admin/New() + adminfaxes += src + +// Fax panel - lets admins check all faxes sent during the round +/client/proc/fax_panel() + set name = "Fax Panel" + set category = "Admin" + if(holder) + holder.fax_panel(usr) + feedback_add_details("admin_verb","FXP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + return + +/datum/admins/proc/fax_panel(var/mob/living/user) + var/html = "Refresh" + html += "Create Fax" + + html += "
" + html += "

Admin Faxes

" + html += "" + html += "" + for(var/datum/fax/admin/A in adminfaxes) + html += "" + html += "" + html += "" + html += "" + if(A.sent_by) + var/mob/living/S = A.sent_by + html += "" + else + html += "" + html += "" + if(!A.reply_to) + if(A.from_department == "Administrator") + html += "" + else + html += "" + html += "" + else + html += "" + html += "" + html += "" + html += "
NameFrom DepartmentTo DepartmentSent ByViewReplyOriginal
[A.name][A.from_department][A.to_department][S.name]UnknownViewN/AReplyN/AN/AOriginal
" + html += "
" + + html += "
" + html += "

Departmental Faxes

" + html += "" + html += "" + for(var/datum/fax/F in faxes) + html += "" + html += "" + html += "" + html += "" + if(F.sent_by) + var/mob/living/S = F.sent_by + html += "" + else + html += "" + html += "" + html += "" + html += "
NameFrom DepartmentTo DepartmentSent ByView
[F.name][F.from_department][F.to_department][S.name]UnknownView
" + html += "
" + + var/datum/browser/popup = new(user, "fax_panel", "Fax Panel", 900, 450) + popup.set_content(html) + popup.open() + \ No newline at end of file diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index 7638cc2ea93..6c7b0e30314 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -1,9 +1,8 @@ var/list/obj/machinery/photocopier/faxmachine/allfaxes = list() var/list/admin_departments = list("Central Command") +var/list/hidden_admin_departments = list("Syndicate") var/list/alldepartments = list() -var/list/adminfaxes = list() //cache for faxes that have been sent to admins - /obj/machinery/photocopier/faxmachine name = "fax machine" icon = 'icons/obj/library.dmi' @@ -43,6 +42,13 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins nanomanager.update_uis(src) else return ..() + +/obj/machinery/photocopier/faxmachine/emag_act(user as mob) + if(!emagged) + emagged = 1 + user << "The transmitters realign to an unknown source!" + else + user << "You swipe the card through [src], but nothing happens." /obj/machinery/photocopier/faxmachine/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) if(scan) @@ -55,7 +61,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins else if(!emagged) data["network"] = "Central Command Quantum Entanglement Network" else - data["network"] = "ERR?*!!*" + data["network"] = "ERR*?*%!*" if(copyitem) data["paper"] = copyitem.name data["paperinserted"] = 1 @@ -64,6 +70,10 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins data["paperinserted"] = 0 data["destination"] = destination data["cooldown"] = sendcooldown + if((destination in admin_departments) || (destination in hidden_admin_departments)) + data["respectcooldown"] = 1 + else + data["respectcooldown"] = 0 ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) @@ -77,10 +87,10 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins if(href_list["send"]) if(copyitem && authenticated) - if (destination in admin_departments) + if ((destination in admin_departments) || (destination in hidden_admin_departments)) send_admin_fax(usr, destination) else - sendfax(destination) + sendfax(destination,usr) if (sendcooldown) spawn(sendcooldown) // cooldown time @@ -108,7 +118,10 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins if(href_list["dept"]) if(authenticated) var/lastdestination = destination - destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments) + var/list/combineddepartments = alldepartments + admin_departments + if(emagged) + combineddepartments += hidden_admin_departments + destination = input(usr, "To which department?", "Choose a department", "") as null|anything in combineddepartments if(!destination) destination = lastdestination @@ -135,7 +148,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins nanomanager.update_uis(src) /obj/machinery/photocopier/faxmachine/proc/scan(var/obj/item/weapon/card/id/card = null) - if (scan) // Card is in machine + if(scan) // Card is in machine if(ishuman(usr)) scan.loc = usr.loc if(!usr.get_active_hand()) @@ -158,7 +171,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins scan = card nanomanager.update_uis(src) -/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination) +/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination,var/mob/sender) if(stat & (BROKEN|NOPOWER)) return @@ -167,15 +180,23 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins var/success = 0 for(var/obj/machinery/photocopier/faxmachine/F in allfaxes) if( F.department == destination ) - success = F.recievefax(copyitem) + success = F.receivefax(copyitem) if (success) + var/datum/fax/F = new /datum/fax() + F.name = copyitem.name + F.from_department = department + F.to_department = destination + F.origin = src + F.message = copyitem + F.sent_by = sender + visible_message("[src] beeps, \"Message transmitted successfully.\"") //sendcooldown = 600 else visible_message("[src] beeps, \"Error transmitting message.\"") -/obj/machinery/photocopier/faxmachine/proc/recievefax(var/obj/item/incoming) +/obj/machinery/photocopier/faxmachine/proc/receivefax(var/obj/item/incoming) if(stat & (BROKEN|NOPOWER)) return 0 @@ -218,20 +239,28 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins return rcvdcopy.loc = null //hopefully this shouldn't cause trouble - adminfaxes += rcvdcopy + + var/datum/fax/admin/A = new /datum/fax/admin() + A.name = rcvdcopy.name + A.from_department = department + A.to_department = destination + A.origin = src + A.message = rcvdcopy + A.sent_by = sender //message badmins that a fax has arrived switch(destination) if ("Central Command") - message_admins(sender, "CENTCOMM FAX", rcvdcopy, "CentcommFaxReply", "#006100") - + message_admins(sender, "CENTCOM FAX", destination, rcvdcopy, "#006100") + if ("Syndicate") + message_admins(sender, "SYNDICATE FAX", destination, rcvdcopy, "#DC143C") sendcooldown = 1800 sleep(50) visible_message("[src] beeps, \"Message transmitted successfully.\"") -/obj/machinery/photocopier/faxmachine/proc/message_admins(var/mob/sender, var/faxname, var/obj/item/sent, var/reply_type, font_colour="#006100") - var/msg = "\blue [faxname]: [key_name(sender, 1)] (PP) (VV) (SM) (JMP) (CA) (REPLY): Receiving '[sent.name]' via secure connection ... view message" +/obj/machinery/photocopier/faxmachine/proc/message_admins(var/mob/sender, var/faxname, var/faxtype, var/obj/item/sent, font_colour="#006100") + var/msg = "\blue [faxname]: [key_name(sender, 1)] (PP) (VV) (SM) (JMP) (CA) (BSA) (REPLY): Receiving '[sent.name]' via secure connection... view message" for(var/client/C in admins) if(R_ADMIN & C.holder.rights) diff --git a/nano/templates/faxmachine.tmpl b/nano/templates/faxmachine.tmpl index 1e00c559b28..9dd7b910fda 100644 --- a/nano/templates/faxmachine.tmpl +++ b/nano/templates/faxmachine.tmpl @@ -59,9 +59,9 @@ Used In File(s): \code\modules\paperwork\faxmachine.dm
{{if data.authenticated}} - {{:helper.link(data.cooldown ? "Realigning" : "Send", data.cooldown ? 'clock' : "mail-closed", {'send' : 1}, data.cooldown ? 'disabled' : "")}} + {{:helper.link(data.cooldown && data.respectcooldown ? "Realigning" : "Send", data.cooldown && data.respectcooldown ? 'clock' : "mail-closed", {'send' : 1}, data.cooldown && data.respectcooldown ? 'disabled' : "")}} {{else}} - {{:helper.link(data.cooldown ? "Realigning" : "Send", data.cooldown ? 'clock' : "mail-closed", null, !data.authenticated ? 'disabled' : "")}} + {{:helper.link(data.cooldown && data.respectcooldown ? "Realigning" : "Send", data.cooldown && data.respectcooldown ? 'clock' : "mail-closed", null, !data.authenticated ? 'disabled' : "")}} {{/if}}
\ No newline at end of file diff --git a/paradise.dme b/paradise.dme index 9339ab8b631..8b128080271 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1390,6 +1390,7 @@ #include "code\modules\organs\wound.dm" #include "code\modules\paperwork\carbonpaper.dm" #include "code\modules\paperwork\clipboard.dm" +#include "code\modules\paperwork\fax.dm" #include "code\modules\paperwork\faxmachine.dm" #include "code\modules\paperwork\filingcabinet.dm" #include "code\modules\paperwork\folders.dm"