From 3bbe06f3fecac78df5a6ed641b1525e7cdab54a1 Mon Sep 17 00:00:00 2001 From: Farie82 Date: Fri, 5 Nov 2021 10:18:53 +0100 Subject: [PATCH] Makes it possible to announce the ERT denial to the crew (#16842) * Makes it possible to announce the ERT denial to the crew * can deny ERT now when sender is KO or has no headset refactored the stuff around it * Apply suggestions from code review Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> * Sabre's review Message format for the input Early return Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> --- code/modules/admin/topic.dm | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index bc6e656fe9d..5b5c2425708 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2408,26 +2408,33 @@ if(!check_rights(R_ADMIN)) return - if(alert(src.owner, "Accept or Deny ERT request?", "CentComm Response", "Accept", "Deny") == "Deny") + if(alert(owner, "Accept or Deny ERT request?", "CentComm Response", "Accept", "Deny") == "Deny") var/mob/living/carbon/human/H = locateUID(href_list["ErtReply"]) if(!istype(H)) - to_chat(usr, "This can only be used on instances of type /mob/living/carbon/human") - return - if(H.stat != 0) - to_chat(usr, "The person you are trying to contact is not conscious.") - return - if(!istype(H.l_ear, /obj/item/radio/headset) && !istype(H.r_ear, /obj/item/radio/headset)) - to_chat(usr, "The person you are trying to contact is not wearing a headset") + to_chat(owner, "This can only be used on instances of type /mob/living/carbon/human") return - var/input = input(src.owner, "Please enter a reason for denying [key_name(H)]'s ERT request.","Outgoing message from CentComm", "") - if(!input) return + var/reason = input(owner, "Please enter a reason for denying [key_name(H)]'s ERT request.", "Outgoing message from CentComm") as null|message + if(!reason) + return + var/announce_to_crew = alert(owner, "Announce ERT request denial to crew or only to the sender [key_name(H)]?", "Send reason to who", "Crew", "Sender") == "Crew" GLOB.ert_request_answered = TRUE - to_chat(src.owner, "You sent [input] to [H] via a secure channel.") - log_admin("[src.owner] denied [key_name(H)]'s ERT request with the message [input].") - to_chat(H, "Incoming priority transmission from Central Command. Message as follows, Your ERT request has been denied for the following reasons: [input].") + log_admin("[owner] denied [key_name(H)]'s ERT request with the message [reason]. Announced to [announce_to_crew ? "the entire crew." : "only the sender"].") + + if(announce_to_crew) + GLOB.event_announcement.Announce("[station_name()], we are unfortunately unable to send you an Emergency Response Team at this time. Your ERT request has been denied for the following reasons:\n[reason]", "ERT Unavailable") + return + + if(H.stat != CONSCIOUS) + to_chat(owner, "The person you are trying to contact is not conscious. ERT denied but no message has been sent.") + return + if(!istype(H.l_ear, /obj/item/radio/headset) && !istype(H.r_ear, /obj/item/radio/headset)) + to_chat(owner, "The person you are trying to contact is not wearing a headset. ERT denied but no message has been sent.") + return + to_chat(owner, "You sent [reason] to [H] via a secure channel.") + to_chat(H, "Incoming priority transmission from Central Command. Message as follows, Your ERT request has been denied for the following reasons: [reason].") else - src.owner.response_team() + owner.response_team() else if(href_list["AdminFaxView"])