Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various TG Chat message sorting fixes #25229

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions code/datums/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@
if(!ghost.client)
continue
if((ghost.client.prefs.toggles & PREFTOGGLE_CHAT_GHOSTSIGHT) && !(ghost in viewers(user_turf, null)))
ghost.show_message("<span class='emote'>[user] ([ghost_follow_link(user, ghost)]) [msg]</span>")
ghost.show_message("<span class='emote'>[user] ([ghost_follow_link(user, ghost)]) [msg]</span>", chat_message_type = MESSAGE_TYPE_LOCALCHAT)

if(isobserver(user))
for(var/mob/dead/observer/ghost in viewers(user))
ghost.show_message("<span class=deadsay>[displayed_msg]</span>", EMOTE_VISIBLE)
ghost.show_message("<span class=deadsay>[displayed_msg]</span>", EMOTE_VISIBLE, chat_message_type = MESSAGE_TYPE_LOCALCHAT)

else if((emote_type & EMOTE_AUDIBLE) && !user.mind?.miming)
user.audible_message(displayed_msg, deaf_message = "<span class='emote'>You see how <b>[user]</b> [msg]</span>")
Expand Down Expand Up @@ -283,10 +283,10 @@
for(var/mob/O as anything in can_see)
if(O.status_flags & PASSEMOTES)
for(var/obj/item/holder/H in O.contents)
H.show_message(text, EMOTE_VISIBLE)
H.show_message(text, EMOTE_VISIBLE, chat_message_type = MESSAGE_TYPE_LOCALCHAT)

for(var/mob/living/M in O.contents)
M.show_message(text, EMOTE_VISIBLE)
M.show_message(text, EMOTE_VISIBLE, chat_message_type = MESSAGE_TYPE_LOCALCHAT)

if(O.client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT)
O.create_chat_message(user, runechat_text, symbol = RUNECHAT_SYMBOL_EMOTE)
Expand Down Expand Up @@ -636,7 +636,7 @@
if(!ghost.client)
continue
if(ghost.client.prefs.toggles & PREFTOGGLE_CHAT_GHOSTSIGHT && !(ghost in viewers(origin_turf, null)))
ghost.show_message("[ghost_follow_link(src, ghost)] [ghost_text]")
ghost.show_message("[ghost_follow_link(src, ghost)] [ghost_text]", chat_message_type = MESSAGE_TYPE_LOCALCHAT)

visible_message(text)

Expand Down
4 changes: 2 additions & 2 deletions code/defines/procs/announcer_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ GLOBAL_DATUM_INIT(major_announcement, /datum/announcer, new(config_type = /datum

/datum/announcer/proc/Message(message, garbled_message, receivers, garbled_receivers)
for(var/mob/M in receivers)
to_chat(M, message)
to_chat(M, message, MESSAGE_TYPE_WARNING)
for(var/mob/M in garbled_receivers)
to_chat(M, garbled_message)
to_chat(M, garbled_message, MESSAGE_TYPE_WARNING)

/datum/announcer/proc/Format(message, title, subtitle = null)
var/formatted_message
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -585,15 +585,15 @@
else
return ..()

/mob/living/simple_animal/demon/pulse_demon/visible_message(message, self_message, blind_message)
/mob/living/simple_animal/demon/pulse_demon/visible_message(message, self_message, blind_message, chat_message_type)
// overriden because pulse demon is quite often in non-turf locs, and /mob/visible_message acts differently there
for(var/mob/M as anything in get_mobs_in_view(7, src))
if(M.see_invisible < invisibility)
continue //can't view the invisible
var/msg = message
if(self_message && M == src)
msg = self_message
M.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE)
M.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE, chat_message_type = MESSAGE_TYPE_LOCALCHAT)

/mob/living/simple_animal/demon/pulse_demon/has_internal_radio_channel_access(mob/user, list/req_one_accesses)
return has_access(list(), req_one_accesses, get_all_accesses())
Expand Down
2 changes: 1 addition & 1 deletion code/game/verbs/ooc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ GLOBAL_VAR_INIT(admin_ooc_colour, "#b82e00")
prefix = "(R)"

if(send)
to_chat(target, "<span class='ooc'><span class='looc'>LOOC<span class='prefix'>[prefix]: </span><EM>[display_name][admin_stuff]:</EM> <span class='message'>[msg]</span></span></span>")
to_chat(target, "<span class='ooc'><span class='looc'>LOOC<span class='prefix'>[prefix]: </span><em>[display_name][admin_stuff]:</em> <span class='message'>[msg]</span></span></span>", MESSAGE_TYPE_OOC)


// Ported from /tg/, full credit to SpaceManiac and Timberpoes.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/misc_admin_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GLOBAL_VAR_INIT(nologevent, 0)
for(var/client/C in GLOB.admins)
if(R_ADMIN & C.holder.rights)
if(important || (C.prefs && !(C.prefs.toggles & PREFTOGGLE_CHAT_NO_TICKETLOGS)))
to_chat(C, msg, MESSAGE_TYPE_ADMINPM, confidential = TRUE)
to_chat(C, msg, MESSAGE_TYPE_ADMINCHAT, confidential = TRUE)
if(important)
if(C.prefs?.sound & SOUND_ADMINHELP)
SEND_SOUND(C, sound('sound/effects/adminhelp.ogg'))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/verbs/adminpm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@
if(X.key != key && X.key != C.key)
if(message_type == MESSAGE_TYPE_MENTORPM)
if(check_rights(R_ADMIN|R_MOD|R_MENTOR, 0, X.mob))
to_chat(X, third_party_message)
to_chat(X, third_party_message, MESSAGE_TYPE_ADMINPM)
else
if(check_rights(R_ADMIN|R_MOD, 0, X.mob))
to_chat(X, third_party_message)
to_chat(X, third_party_message, MESSAGE_TYPE_ADMINPM)

//Check if the mob being PM'd has any open tickets.
var/list/tickets = tickets_system.checkForTicket(C, ticket_id)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/pray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

for(var/client/X in GLOB.admins)
if(check_rights(R_EVENT,0,X.mob))
to_chat(X, msg)
to_chat(X, msg, MESSAGE_TYPE_ADMINPM)
if(X.prefs.sound & SOUND_PRAYERNOTIFY)
SEND_SOUND(X, sound('sound/items/PDA/ambicha4-short.ogg'))
to_chat(usr, "Your prayers have been received by the gods.")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/observer/observer_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/obj/machinery/cryopod/P = istype(loc, /obj/machinery/cryopod) && loc

if(frozen)
to_chat(src, "<span class='warning'>You cannot do this while admin frozen.</span>")
to_chat(src, "<span class='warning'>You cannot do this while admin frozen.</span>", MESSAGE_TYPE_WARNING)
message_admins("[key_name_admin(src)] tried to ghost while admin frozen")
return

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/silicon_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
to_chat(src, "<i><span class='game say'>Holopad action relayed, <span class='name'>[real_name]</span> <span class='message'>[message]</span></span></i>")

for(var/mob/M in viewers(T.loc))
M.show_message(rendered, EMOTE_VISIBLE)
M.show_message(rendered, EMOTE_VISIBLE, chat_message_type = MESSAGE_TYPE_LOCALCHAT)

log_emote("(HPAD) [message]", src)
else //This shouldn't occur, but better safe then sorry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ Difficulty: Medium
return FALSE
return ..()

/mob/living/simple_animal/hostile/megafauna/dragon/visible_message(message, self_message, blind_message)
/mob/living/simple_animal/hostile/megafauna/dragon/visible_message(message, self_message, blind_message, chat_message_type)
if(swooping & SWOOP_INVULNERABLE) //to suppress attack messages without overriding every single proc that could send a message saying we got hit
return
return ..()
Expand Down
40 changes: 20 additions & 20 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,39 @@

usr.show_message(t, EMOTE_VISIBLE)

/mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)

if(!client) return
/mob/proc/show_message(msg, type, alt, alt_type, chat_message_type) // Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
if(!client)
return

if(type)
if(type & EMOTE_VISIBLE && !has_vision(information_only=TRUE))//Vision related
if(type & EMOTE_VISIBLE && !has_vision(information_only = TRUE)) // Vision related
if(!alt)
return
else
msg = alt
type = alt_type
if(type & EMOTE_AUDIBLE && !can_hear())//Hearing related
msg = alt
type = alt_type

if(type & EMOTE_AUDIBLE && !can_hear()) // Hearing related
if(!alt)
return
else
msg = alt
type = alt_type
if(type & EMOTE_VISIBLE && !has_vision(information_only=TRUE))
return
msg = alt
type = alt_type
if(type & EMOTE_VISIBLE && !has_vision(information_only = TRUE))
return

// Added voice muffling for Issue 41.
if(stat == UNCONSCIOUS)
to_chat(src, "<I>... You can almost hear someone talking ...</I>")
else
to_chat(src, msg)
return
to_chat(src, "<i>... You can almost hear someone talking ...</i>", MESSAGE_TYPE_LOCALCHAT)
return

to_chat(src, msg, chat_message_type)

// Show a message to all mobs in sight of this one
// This would be for visible actions by the src mob
// message is the message output to anyone who can see e.g. "[src] does something!"
// self_message (optional) is what the src mob sees e.g. "You do something!"
// blind_message (optional) is what blind people will hear e.g. "You hear something!"

/mob/visible_message(message, self_message, blind_message)
/mob/visible_message(message, self_message, blind_message, chat_message_type)
if(!isturf(loc)) // mobs inside objects (such as lockers) shouldn't have their actions visible to those outside the object
for(var/mob/M as anything in get_mobs_in_view(3, src))
if(M.see_invisible < invisibility)
Expand All @@ -150,15 +150,15 @@
if(!blind_message) // for some reason VISIBLE action has blind_message param so if we are not in the same object but next to it, lets show it
continue
msg = blind_message
M.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE)
M.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE, chat_message_type)
return
for(var/mob/M as anything in get_mobs_in_view(7, src))
if(M.see_invisible < invisibility)
continue //can't view the invisible
var/msg = message
if(self_message && M == src)
msg = self_message
M.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE)
M.show_message(msg, EMOTE_VISIBLE, blind_message, EMOTE_AUDIBLE, chat_message_type)

// Show a message to all mobs in sight of this atom
// Use for objects performing visible actions
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/mob_holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
for(var/mob/M in src.contents)
M.attackby(W,user, params)

/obj/item/holder/proc/show_message(message, m_type)
/obj/item/holder/proc/show_message(message, m_type, chat_message_type)
for(var/mob/living/M in contents)
M.show_message(message,m_type)
M.show_message(message, m_type, chat_message_type)

/obj/item/holder/emp_act(intensity)
for(var/mob/living/M in contents)
Expand Down
15 changes: 10 additions & 5 deletions code/modules/surgery/bio_chip_removal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@
if(times_repeated >= max_times_to_check)
user.visible_message(
"<span class='notice'>[user] seems to have had enough and stops checking inside [target].</span>",
"<span class='notice'>There doesn't seem to be anything inside, you've checked enough times.</span>"
"<span class='notice'>There doesn't seem to be anything inside, you've checked enough times.</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_BEGINSTEP_SKIP

I = locate(/obj/item/bio_chip) in target
user.visible_message(
"[user] starts poking around inside [target]'s [affected.name] with \the [tool].",
"You start poking around inside [target]'s [affected.name] with \the [tool]."
"You start poking around inside [target]'s [affected.name] with \the [tool].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.custom_pain("The pain in your [affected.name] is living hell!")
return ..()
Expand All @@ -59,7 +61,8 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='warning'>[user] grips onto [target]'s [affected.name] by mistake, tearing it!</span>",
"<span class='warning'>You think you've found something, but you've grabbed onto [target]'s [affected.name] instead, damaging it!</span>"
"<span class='warning'>You think you've found something, but you've grabbed onto [target]'s [affected.name] instead, damaging it!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.receive_damage(10)
return SURGERY_STEP_RETRY
Expand All @@ -70,7 +73,8 @@
if(I && prob(80)) //implant removal only works on the chest.
user.visible_message(
"<span class='notice'>[user] takes something out of [target]'s [affected.name] with \the [tool].</span>",
"<span class='notice'>You take \an [I] out of [target]'s [affected.name]s with \the [tool].</span>"
"<span class='notice'>You take \an [I] out of [target]'s [affected.name]s with \the [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)

I.removed(target)
Expand All @@ -94,7 +98,8 @@
else
user.visible_message(
"<span class='notice'> [user] could not find anything inside [target]'s [affected.name], and pulls \the [tool] out.</span>",
"<span class='notice'>You could not find anything inside [target]'s [affected.name].</span>"
"<span class='notice'>You could not find anything inside [target]'s [affected.name].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_CONTINUE

Expand Down
36 changes: 24 additions & 12 deletions code/modules/surgery/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"[user] starts applying medication to the damaged bones in [target]'s [affected.name] with \the [tool].",
"You start applying medication to the damaged bones in [target]'s [affected.name] with \the [tool]."
"You start applying medication to the damaged bones in [target]'s [affected.name] with \the [tool].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.custom_pain("Something in your [affected.name] is causing you a lot of pain!")
return ..()
Expand All @@ -69,7 +70,8 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='notice'> [user] applies some [tool] to [target]'s bone in [affected.name].</span>",
"<span class='notice'> You apply some [tool] to [target]'s bone in [affected.name] with \the [tool].</span>"
"<span class='notice'> You apply some [tool] to [target]'s bone in [affected.name] with \the [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)

return SURGERY_STEP_CONTINUE
Expand All @@ -78,7 +80,8 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='warning'> [user]'s hand slips, smearing [tool] in the incision in [target]'s [affected.name]!</span>",
"<span class='warning'> Your hand slips, smearing [tool] in the incision in [target]'s [affected.name]!</span>"
"<span class='warning'> Your hand slips, smearing [tool] in the incision in [target]'s [affected.name]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_RETRY

Expand All @@ -96,7 +99,8 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"[user] is beginning to set the bone in [target]'s [affected.name] in place with \the [tool].",
"You are beginning to set the bone in [target]'s [affected.name] in place with \the [tool]."
"You are beginning to set the bone in [target]'s [affected.name] in place with \the [tool].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.custom_pain("The pain in your [affected.name] is going to make you pass out!")
return ..()
Expand All @@ -105,15 +109,17 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='notice'> [user] sets the bone in [target]'s [affected.name] in place with \the [tool].</span>",
"<span class='notice'> You set the bone in [target]'s [affected.name] in place with \the [tool].</span>"
"<span class='notice'> You set the bone in [target]'s [affected.name] in place with \the [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_CONTINUE

/datum/surgery_step/set_bone/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='warning'> [user]'s hand slips, damaging the bone in [target]'s [affected.name] with \the [tool]!</span>",
"<span class='warning'> Your hand slips, damaging the bone in [target]'s [affected.name] with \the [tool]!</span>"
"<span class='warning'> Your hand slips, damaging the bone in [target]'s [affected.name] with \the [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.receive_damage(5)
return SURGERY_STEP_RETRY
Expand All @@ -124,15 +130,17 @@
/datum/surgery_step/set_bone/mend_skull/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message(
"[user] is beginning piece together [target]'s skull with \the [tool].",
"You are beginning piece together [target]'s skull with \the [tool]."
"You are beginning piece together [target]'s skull with \the [tool].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return ..()

/datum/surgery_step/set_bone/mend_skull/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='notice'> [user] sets [target]'s [affected.encased] with \the [tool].</span>",
"<span class='notice'> You set [target]'s [affected.encased] with \the [tool].</span>"
"<span class='notice'> You set [target]'s [affected.encased] with \the [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)

return SURGERY_STEP_CONTINUE
Expand All @@ -141,7 +149,8 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='warning'>[user]'s hand slips, damaging [target]'s face with \the [tool]!</span>",
"<span class='warning'>Your hand slips, damaging [target]'s face with \the [tool]!</span>"
"<span class='warning'>Your hand slips, damaging [target]'s face with \the [tool]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
var/obj/item/organ/external/head/H = affected
H.receive_damage(10)
Expand All @@ -164,15 +173,17 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"[user] starts to finish mending the damaged bones in [target]'s [affected.name] with \the [tool].",
"You start to finish mending the damaged bones in [target]'s [affected.name] with \the [tool]."
"You start to finish mending the damaged bones in [target]'s [affected.name] with \the [tool].",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return ..()

/datum/surgery_step/finish_bone/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='notice'> [user] has mended the damaged bones in [target]'s [affected.name] with \the [tool].</span>",
"<span class='notice'> You have mended the damaged bones in [target]'s [affected.name] with \the [tool].</span>"
"<span class='notice'> You have mended the damaged bones in [target]'s [affected.name] with \the [tool].</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
affected.mend_fracture()
return SURGERY_STEP_CONTINUE
Expand All @@ -181,6 +192,7 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message(
"<span class='warning'> [user]'s hand slips, smearing [tool] in the incision in [target]'s [affected.name]!</span>",
"<span class='warning'> Your hand slips, smearing [tool] in the incision in [target]'s [affected.name]!</span>"
"<span class='warning'> Your hand slips, smearing [tool] in the incision in [target]'s [affected.name]!</span>",
chat_message_type = MESSAGE_TYPE_COMBAT
)
return SURGERY_STEP_RETRY
Loading