Various TG Chat message sorting fixes (#25229)

* Fixes unsorted emotes, announcements, votes, surgery, prayers, ahelp responses

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
S34N
2024-04-29 03:07:25 +01:00
committed by GitHub
parent 4add53d6c1
commit 2e4089dc15
28 changed files with 368 additions and 209 deletions
+58 -34
View File
@@ -244,13 +244,15 @@
if(!I.is_robotic() && !istype(tool, /obj/item/stack/nanopaste))
user.visible_message(
"<span class='notice'> [user] treats damage to [target]'s [I.name] with [tool_name].</span>",
"<span class='notice'> You treat damage to [target]'s [I.name] with [tool_name].</span>"
"<span class='notice'> You treat damage to [target]'s [I.name] with [tool_name].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
I.damage = 0
else if(I.is_robotic() && istype (tool, /obj/item/stack/nanopaste))
user.visible_message(
"<span class='notice'> [user] treats damage to [target]'s [I.name] with [tool_name].</span>",
"<span class='notice'> You treat damage to [target]'s [I.name] with [tool_name].</span>"
"<span class='notice'> You treat damage to [target]'s [I.name] with [tool_name].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
I.damage = 0
return SURGERY_STEP_CONTINUE
@@ -263,7 +265,8 @@
user.visible_message(
"<span class='warning'> [user]'s hand slips, getting messy and tearing the inside of [target]'s [parse_zone(target_zone)] with [tool]!</span>",
"<span class='warning'> Your hand slips, getting messy and tearing the inside of [target]'s [parse_zone(target_zone)] with [tool]!</span>"
"<span class='warning'> Your hand slips, getting messy and tearing the inside of [target]'s [parse_zone(target_zone)] with [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
var/dam_amt = 2
@@ -314,7 +317,8 @@
return SURGERY_BEGINSTEP_SKIP
user.visible_message(
"[user] starts to separate [target]'s [I] with [tool].",
"You start to separate [target]'s [I] with [tool] for removal."
"You start to separate [target]'s [I] with [tool] for removal.",
chat_message_type = MESSAGE_TYPE_COMBAT
)
var/mob/living/carbon/human/H = target
var/obj/item/organ/affected = H.get_organ(user.zone_selected)
@@ -329,13 +333,15 @@
if(!extracting || extracting.owner != target)
user.visible_message(
"<span class='notice'>[user] can't seem to extract anything from [target]'s [parse_zone(target_zone)]!</span>",
"<span class='notice'>You can't extract anything from [target]'s [parse_zone(target_zone)]!</span>"
"<span class='notice'>You can't extract anything from [target]'s [parse_zone(target_zone)]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_CONTINUE
user.visible_message(
"<span class='notice'> [user] has separated and extracts [target]'s [extracting] with [tool].</span>",
"<span class='notice'> You have separated and extracted [target]'s [extracting] with [tool].</span>"
"<span class='notice'> You have separated and extracted [target]'s [extracting] with [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
add_attack_logs(user, target, "Surgically removed [extracting.name]. INTENT: [uppertext(user.a_intent)]")
@@ -357,19 +363,22 @@
if(affected)
user.visible_message(
"<span class='warning'> [user]'s hand slips, damaging [target]'s [affected.name] with [tool]!</span>",
"<span class='warning'> Your hand slips, damaging [target]'s [affected.name] with [tool]!</span>"
"<span class='warning'> Your hand slips, damaging [target]'s [affected.name] with [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.receive_damage(20)
else
user.visible_message(
"<span class='warning'> [user]'s hand slips, damaging [target]'s [parse_zone(target_zone)] with [tool]!</span>",
"<span class='warning'> Your hand slips, damaging [target]'s [parse_zone(target_zone)] with [tool]!</span>"
"<span class='warning'> Your hand slips, damaging [target]'s [parse_zone(target_zone)] with [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_RETRY
else
user.visible_message(
"[user] can't seem to extract anything from [target]'s [parse_zone(target_zone)]!",
"<span class='notice'>You can't extract anything from [target]'s [parse_zone(target_zone)]!</span>"
"<span class='notice'>You can't extract anything from [target]'s [parse_zone(target_zone)]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_CONTINUE
@@ -415,13 +424,15 @@
if(affected)
user.visible_message(
"[user] starts transplanting [tool] into [target]'s [affected.name].",
"You start transplanting [tool] into [target]'s [affected.name]."
"You start transplanting [tool] into [target]'s [affected.name].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.custom_pain("Someone's rooting around in your [affected.name]!")
else
user.visible_message(
"[user] starts transplanting [tool] into [target]'s [parse_zone(target_zone)].",
"You start transplanting [tool] into [target]'s [parse_zone(target_zone)]."
"You start transplanting [tool] into [target]'s [parse_zone(target_zone)].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return ..()
@@ -444,17 +455,20 @@
if(affected)
user.visible_message("<span class='notice'> [user] has transplanted [tool] into [target]'s [affected.name].</span>",
"<span class='notice'> You have transplanted [tool] into [target]'s [affected.name].</span>")
"<span class='notice'> You have transplanted [tool] into [target]'s [affected.name].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT)
else
user.visible_message("<span class='notice'> [user] has transplanted [tool] into [target]'s [parse_zone(target_zone)].</span>",
"<span class='notice'> You have transplanted [tool] into [target]'s [parse_zone(target_zone)].</span>")
"<span class='notice'> You have transplanted [tool] into [target]'s [parse_zone(target_zone)].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT)
return SURGERY_STEP_CONTINUE
/datum/surgery_step/internal/manipulate_organs/implant/fail_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message(
"<span class='warning'>[user]'s hand slips, damaging [tool]!</span>",
"<span class='warning'>Your hand slips, damaging [tool]!</span>"
"<span class='warning'>Your hand slips, damaging [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
var/obj/item/organ/internal/I = tool
if(istype(I) && !I.tough)
@@ -565,12 +579,14 @@
if(istype(C, /obj/item/reagent_containers/syringe))
user.visible_message(
"<span class='notice'> [user] has injected [tool] into [target]'s [I.name].</span>",
"<span class='notice'> You have injected [tool] into [target]'s [I.name].</span>"
"<span class='notice'> You have injected [tool] into [target]'s [I.name].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
else
user.visible_message(
"<span class='notice'> [user] has poured some of [tool] over [target]'s [I.name].</span>",
"<span class='notice'> You have poured some of [tool] over [target]'s [I.name].</span>"
"<span class='notice'> You have poured some of [tool] over [target]'s [I.name].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
R.reaction(target, REAGENT_INGEST, R.total_volume / C.amount_per_transfer_from_this)
@@ -611,7 +627,8 @@
user.visible_message(
"<span class='warning'> [user]'s hand slips, splashing the contents of [tool] all over [target][affected ? "'s [affected.name]" : ""] incision!</span>",
"<span class='warning'> Your hand slips, splashing the contents of [tool] all over [target][affected ? "'s [affected.name]" : ""] incision!</span>"
"<span class='warning'> Your hand slips, splashing the contents of [tool] all over [target][affected ? "'s [affected.name]" : ""] incision!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
// continue here since we want to keep moving in the surgery
return SURGERY_STEP_CONTINUE
@@ -628,14 +645,15 @@
/datum/surgery_step/internal/manipulate_organs/finish/begin_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/mob/living/carbon/human/H = target
var/obj/item/organ/external/affected = target.get_organ(target_zone)
var/msg
var/self_msg
if(affected && affected.encased)
var/msg = "[user] starts bending [target]'s [affected.encased] back into place with [tool]."
var/self_msg = "You start bending [target]'s [affected.encased] back into place with [tool]."
user.visible_message(msg, self_msg)
msg = "[user] starts bending [target]'s [affected.encased] back into place with [tool]."
self_msg = "You start bending [target]'s [affected.encased] back into place with [tool]."
else
var/msg = "[user] starts pulling [target]'s skin back into place with [tool]."
var/self_msg = "You start pulling [target]'s skin back into place with [tool]."
user.visible_message(msg, self_msg)
msg = "[user] starts pulling [target]'s skin back into place with [tool]."
self_msg = "You start pulling [target]'s skin back into place with [tool]."
user.visible_message(msg, self_msg, chat_message_type = MESSAGE_TYPE_COMBAT)
if(H && affected)
affected.custom_pain("Something hurts horribly in your [affected.name]!")
@@ -654,7 +672,7 @@
msg = "<span class='notice'>[user] pulls [target]'s flesh back into place with [tool].</span>"
self_msg = "<span class='notice'>You pull [target]'s flesh back into place with [tool].</span>"
user.visible_message(msg, self_msg)
user.visible_message(msg, self_msg, chat_message_type = MESSAGE_TYPE_COMBAT)
return SURGERY_STEP_CONTINUE
/datum/surgery_step/internal/manipulate_organs/finish/fail_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
@@ -670,7 +688,7 @@
self_msg = "<span class='warning'> Your hand slips, tearing skin!</span>"
if(affected)
affected.receive_damage(20)
user.visible_message(msg, self_msg)
user.visible_message(msg, self_msg, chat_message_type = MESSAGE_TYPE_COMBAT)
return SURGERY_STEP_RETRY
//////////////////////////////////////////////////////////////////
@@ -730,14 +748,16 @@
/datum/surgery_step/cut_carapace/begin_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] starts the incision on [target]'s [target_zone] with [tool].", \
"You start the incision on [target]'s [target_zone] with [tool].")
"You start the incision on [target]'s [target_zone] with [tool].",
chat_message_type = MESSAGE_TYPE_COMBAT)
return ..()
/datum/surgery_step/cut_carapace/end_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message(
"<span class='notice'> [user] has made an incision on [target]'s [target_zone] with [tool].</span>",
"<span class='notice'> You have made an incision on [target]'s [target_zone] with [tool].</span>"
"<span class='notice'> You have made an incision on [target]'s [target_zone] with [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_CONTINUE
@@ -745,7 +765,8 @@
user.visible_message(
"<span class='warning'>[user]'s hand slips, slicing open [target]'s [target_zone] in a wrong spot with [tool]!</span>",
"<span class='warning'>Your hand slips, slicing open [target]'s [target_zone] in a wrong spot with [tool]!</span>"
"<span class='warning'>Your hand slips, slicing open [target]'s [target_zone] in a wrong spot with [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_RETRY
@@ -770,7 +791,7 @@
if(target_zone == BODY_ZONE_PRECISE_GROIN)
msg = "[user] starts to pry open the incision and rearrange the organs in [target]'s lower abdomen with [tool]."
self_msg = "You start to pry open the incision and rearrange the organs in [target]'s lower abdomen with [tool]."
user.visible_message(msg, self_msg)
user.visible_message(msg, self_msg, chat_message_type = MESSAGE_TYPE_COMBAT)
return ..()
/datum/surgery_step/retract_carapace/end_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
@@ -782,7 +803,7 @@
if(target_zone == BODY_ZONE_PRECISE_GROIN)
msg = "<span class='notice'> [user] keeps the incision open on [target]'s lower abdomen with [tool].</span>"
self_msg = "<span class='notice'> You keep the incision open on [target]'s lower abdomen with [tool].</span>"
user.visible_message(msg, self_msg)
user.visible_message(msg, self_msg, chat_message_type = MESSAGE_TYPE_COMBAT)
return SURGERY_STEP_CONTINUE
/datum/surgery_step/generic/retract_carapace/fail_step(mob/living/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
@@ -794,7 +815,7 @@
if(target_zone == BODY_ZONE_PRECISE_GROIN)
msg = "<span class='warning'> [user]'s hand slips, damaging several organs in [target]'s lower abdomen with [tool]</span>"
self_msg = "<span class='warning'> Your hand slips, damaging several organs in [target]'s lower abdomen with [tool]!</span>"
user.visible_message(msg, self_msg)
user.visible_message(msg, self_msg, chat_message_type = MESSAGE_TYPE_COMBAT)
return SURGERY_STEP_RETRY
// redefine cauterize for every step because of course it relies on get_organ()
@@ -825,7 +846,8 @@
var/zone = zone_name(target_zone)
user.visible_message(
"[user] is beginning to cauterize the incision on [target]'s [zone] with \the [tool].",
"You are beginning to cauterize the incision on [target]'s [zone] with \the [tool]."
"You are beginning to cauterize the incision on [target]'s [zone] with \the [tool].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
to_chat(user, "<span class='userdanger'>Your [zone] is being burned!</span>") // No custom pain because xenos are special
return ..()
@@ -834,7 +856,8 @@
var/zone = zone_name(target_zone)
user.visible_message(
"<span class='notice'>[user] cauterizes the incision on [target]'s [zone] with \the [tool].</span>",
"<span class='notice'>You cauterize the incision on [target]'s [zone] with \the [tool].</span>"
"<span class='notice'>You cauterize the incision on [target]'s [zone] with \the [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_CONTINUE
@@ -842,7 +865,8 @@
var/zone = zone_name(target_zone)
user.visible_message(
"<span class='warning'>[user]'s hand slips, leaving a small burn on [target]'s [zone] with \the [tool]!</span>",
"<span class='warning'>Your hand slips, leaving a small burn on [target]'s [zone] with \the [tool]!</span>"
"<span class='warning'>Your hand slips, leaving a small burn on [target]'s [zone] with \the [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
target.apply_damage(3, BURN, target_zone)
return SURGERY_STEP_RETRY