Runescape chat fix

This commit is contained in:
quotefox
2022-09-20 08:04:00 +01:00
parent 1c2f134e2d
commit 979decc7f2
10 changed files with 84 additions and 29 deletions
+17 -15
View File
@@ -55,15 +55,6 @@
message = null
return ..()
/**
* Calls qdel on the chatmessage when its parent is deleted, used to register qdel signal
*/
/datum/chatmessage/proc/on_parent_qdel()
UnregisterSignal(src, COMSIG_PARENT_QDELETING)
qdel(src)
/**
* Generates a chat message image representation
*
@@ -107,10 +98,10 @@
// Append radio icon if from a virtual speaker
if (extra_classes.Find("virtual-speaker"))
var/image/r_icon = image('icons/UI_Icons/chat/chat_icons.dmi', icon_state = "radio")
text = "\icon[r_icon] " + text
text = "\icon[r_icon] [text]"
else if (extra_classes.Find("emote"))
var/image/r_icon = image('icons/ui_icons/chat/chat_icons.dmi', icon_state = "emote")
text = "\icon[r_icon] " + text
var/image/r_icon = image('icons/UI_Icons/chat/chat_icons.dmi', icon_state = "emote")
text = "\icon[r_icon] [text]"
// We dim italicized text to make it more distinguishable from regular text
var/tgt_color = extra_classes.Find("italics") ? target.chat_color_darkened : target.chat_color
@@ -120,7 +111,7 @@
// BYOND Bug #2563917
// Construct text
var/static/regex/html_metachars = new(@"&[A-Za-z]{1,7};", "g")
var/complete_text = "<span class='center maptext [extra_classes.Join(" ")]' style='color: [tgt_color]'>[owner.say_emphasis(text)]</span>"
var/complete_text = "<span class='center maptext [extra_classes.Join(" ")]' style='color: [tgt_color]'>[text]</span>"
var/mheight = WXH_TO_HEIGHT(owned_by.MeasureText(replacetext(complete_text, html_metachars, "m"), null, CHAT_MESSAGE_WIDTH))
approx_lines = max(1, mheight / CHAT_MESSAGE_APPROX_LHEIGHT)
@@ -176,7 +167,7 @@
* * spans - Additional classes to be added to the message
* * message_mode - Bitflags relating to the mode of the message
*/
/mob/proc/create_chat_message(atom/movable/speaker, datum/language/message_language, raw_message, list/spans, message_mode)
/mob/proc/create_chat_message(atom/movable/speaker, datum/language/message_language, raw_message, list/spans, runechat_flags = NONE)
// Ensure the list we are using, if present, is a copy so we don't modify the list provided to us
spans = spans ? spans.Copy() : list()
@@ -192,7 +183,10 @@
return
// Display visual above source
new /datum/chatmessage(lang_treat(speaker, message_language, raw_message, spans, null, TRUE), speaker, src, spans)
if(runechat_flags & EMOTE_MESSAGE)
new /datum/chatmessage(raw_message, speaker, src, list("emote", "italics"))
else
new /datum/chatmessage(lang_treat(speaker, message_language, raw_message, spans, null, TRUE), speaker, src, spans)
// Tweak these defines to change the available color ranges
@@ -246,3 +240,11 @@
return "#[num2hex(x, 2)][num2hex(m, 2)][num2hex(c, 2)]"
if(5)
return "#[num2hex(c, 2)][num2hex(m, 2)][num2hex(x, 2)]"
/**
* Calls qdel on the chatmessage when its parent is deleted, used to register qdel signal
*/
/datum/chatmessage/proc/on_parent_qdel()
qdel(src)
+4 -4
View File
@@ -58,19 +58,19 @@
return
user.log_message(msg, LOG_EMOTE)
msg = "<b>[user]</b> " + msg
var/dchatmsg = "<b>[user]</b> [msg]"
for(var/mob/M in GLOB.dead_mob_list)
if(!M.client || isnewplayer(M))
continue
var/T = get_turf(user)
if(M.stat == DEAD && M.client && (M.client.prefs.chat_toggles & CHAT_GHOSTSIGHT) && !(M in viewers(T, null)) && (user.client)) //SKYRAT CHANGE - only user controlled mobs show their emotes to all-seeing ghosts, to reduce chat spam
M.show_message(msg)
M.show_message("[FOLLOW_LINK(M, user)] [dchatmsg]")
if(emote_type == EMOTE_AUDIBLE)
user.audible_message(msg)
user.audible_message(msg, audible_message_flags = EMOTE_MESSAGE)
else
user.visible_message(msg)
user.visible_message(msg, visible_message_flags = EMOTE_MESSAGE)
/datum/emote/proc/replace_pronoun(mob/user, message)
if(findtext(message, "their"))