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>
This commit is contained in:
Farie82
2021-11-05 10:18:53 +01:00
committed by GitHub
parent d94210031b
commit 3bbe06f3fe
+21 -14
View File
@@ -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, "<span class='warning'>This can only be used on instances of type /mob/living/carbon/human</span>")
return
if(H.stat != 0)
to_chat(usr, "<span class='warning'>The person you are trying to contact is not conscious.</span>")
return
if(!istype(H.l_ear, /obj/item/radio/headset) && !istype(H.r_ear, /obj/item/radio/headset))
to_chat(usr, "<span class='warning'>The person you are trying to contact is not wearing a headset</span>")
to_chat(owner, "<span class='warning'>This can only be used on instances of type /mob/living/carbon/human</span>")
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, "<span class='specialnoticebold'>Incoming priority transmission from Central Command. Message as follows,</span><span class='specialnotice'> Your ERT request has been denied for the following reasons: [input].</span>")
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, "<span class='warning'>The person you are trying to contact is not conscious. ERT denied but no message has been sent.</span>")
return
if(!istype(H.l_ear, /obj/item/radio/headset) && !istype(H.r_ear, /obj/item/radio/headset))
to_chat(owner, "<span class='warning'>The person you are trying to contact is not wearing a headset. ERT denied but no message has been sent.</span>")
return
to_chat(owner, "<span class='notice'>You sent [reason] to [H] via a secure channel.</span>")
to_chat(H, "<span class='specialnoticebold'>Incoming priority transmission from Central Command. Message as follows,</span><span class='specialnotice'> Your ERT request has been denied for the following reasons: [reason].</span>")
else
src.owner.response_team()
owner.response_team()
else if(href_list["AdminFaxView"])