From 1f7f3b17515ed27a076d0e2f5504d264f64d978b Mon Sep 17 00:00:00 2001 From: skull132 Date: Fri, 5 Feb 2016 18:24:55 +0200 Subject: [PATCH] CCIAA - Send_admin_fax() -> create_admin_fax() & Fixes The proc create_admin_fax() now works fully, under all scenarios tested. --- code/modules/admin/admin_verbs.dm | 7 +++--- code/modules/admin/topic.dm | 33 ++----------------------- code/modules/cciaa/cciaa.dm | 37 ++++++++++++++++------------ code/modules/paperwork/faxmachine.dm | 2 +- 4 files changed, 28 insertions(+), 51 deletions(-) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index bd4ce2fe742..c33134fa4fd 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -92,8 +92,9 @@ var/list/admin_verbs_admin = list( /client/proc/change_security_level, /client/proc/view_chemical_reaction_logs, /client/proc/makePAI, - /datum/admins/proc/paralyze_mob -// /datum/admins/proc/send_admin_fax + /datum/admins/proc/paralyze_mob, + /datum/admins/proc/create_admin_fax, + /client/proc/check_fax_history ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, @@ -310,7 +311,7 @@ var/list/admin_verbs_cciaa = list( /client/proc/cmd_cciaa_say, /client/proc/returntobody, // /client/proc/view_duty_log, -// /datum/admins/proc/send_admin_fax, + /datum/admins/proc/create_admin_fax, /client/proc/check_fax_history ) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 4f78f830b58..3b1f49538ed 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1397,39 +1397,10 @@ return else if(href_list["CentcommFaxReply"]) - var/mob/sender = locate(href_list["CentcommFaxReply"]) - var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["originfax"]) + var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["CentcommFaxReply"]) - //todo: sanitize - 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 + create_admin_fax(fax.department) - var/customname = input(src.owner, "Pick a title for the report", "Title") as text|null - - // 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.info = input - P.update_icon() - - // 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 += "
This paper has been stamped by the Central Command Quantum Relay." - - 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) - else - src.owner << "\red Message reply failed." - - spawn(100) - qdel(P) return else if(href_list["SolGovFaxReply"]) diff --git a/code/modules/cciaa/cciaa.dm b/code/modules/cciaa/cciaa.dm index cee2524f0d4..582b0e8b158 100644 --- a/code/modules/cciaa/cciaa.dm +++ b/code/modules/cciaa/cciaa.dm @@ -1,7 +1,7 @@ /client/proc/spawn_duty_officer() set category = "Special Verbs" set name = "Spawn CCIA Agent" - set desc = "Spawns a CCIA Agent to... IA Agent?" + set desc = "Spawns a CCIA Agent to agent around." if(!check_rights(R_CCIAA)) return @@ -241,32 +241,37 @@ job_master.FreeRole(oldjob) return -/datum/admins/proc/send_admin_fax(var/mob/sender = null, var/obj/machinery/photocopier/faxmachine/fax = null) +/datum/admins/proc/create_admin_fax(var/department in alldepartments) set name = "Send admin fax" set desc = "Send a fax from Central Command" set category = "Special Verbs" if (!check_rights(R_ADMIN|R_CCIAA|R_FUN)) - src.owner << "\red You do not have enough powers to do this." + usr << "\red You do not have enough powers to do this." return - var/target_department = null - if (!fax) - var/list/all_fax_machines = list() - for (var/obj/machinery/photocopier/faxmachine/F in world) - all_fax_machines += F - target_department = input(src.owner, "Please select a department to send this fax to.", "Target Fax Department", null) as null|anything in all_fax_machines + if (!department) + usr << "\red No target department specified!" + return + + var/obj/machinery/photocopier/faxmachine/fax = null + + for (var/obj/machinery/photocopier/faxmachine/F in allfaxes) + if (F.department == department) + fax = F + break if (!fax) - src.owner << "\red Couldn't find the desired fax machine! Sending cancelled!" + usr << "\red Couldn't find a fax machine to send this to!" + return //todo: sanitize - var/input = input(src.owner, "Please enter a message to reply to [sender ? key_name(sender) : "a fax"] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use
for line breaks.", "Outgoing message from Centcomm", "") as message|null + var/input = input(usr, "Please enter a message to reply to 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) - src.owner << "\red Cancelled." + usr << "\red Cancelled." return - var/customname = input(src.owner, "Pick a title for the report", "Title") as text|null + var/customname = input(usr, "Pick a title for the report", "Title") as text|null // 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 @@ -284,10 +289,10 @@ P.stamps += "
This paper has been stamped by the Central Command Quantum Relay." if(fax.recievefax(P)) - src.owner << "\blue Message reply to transmitted successfully." - log_and_message_admins("sent a fax message to the station.") + usr << "\blue Message transmitted successfully." + log_and_message_admins("sent a fax message to the [department] fax machine. (JMP)") else - src.owner << "\red Message reply failed." + usr << "\red Message reply failed." spawn(100) qdel(P) diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index f5a48a5b9bb..3790123b462 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -212,7 +212,7 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins /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" + var/msg = "\blue [faxname]: [key_name(sender, 1)] (PP) (VV) (SM) (JMP) (CA) (REPLY): Receiving '[sent.name]' via secure connection ... view message" for(var/client/C in admins) if(R_ADMIN & C.holder.rights)