* Message piece combiner returns a list

* Emote formatter returns a list

* Port Runechat

* Various onamonapoea

* Suggested changes, small opts

* Fix chat message on different size mobs

* Couple more runefixes

* Enable encoding chat emphasis in runechat

* Remove extra asterisks from rune audible messages

* Fix runedefines
This commit is contained in:
Aronai Sieyes
2021-06-13 22:18:43 -09:00
committed by GitHub
parent c9873ff9ed
commit 1fd1d84deb
41 changed files with 1676 additions and 1238 deletions
+23 -9
View File
@@ -2,7 +2,9 @@
/mob/proc/combine_message(var/list/message_pieces, var/verb, var/mob/speaker, always_stars = FALSE, var/radio = FALSE)
var/iteration_count = 0
var/msg = "" // This is to make sure that the pieces have actually added something
. = "[verb], \""
var/raw_msg = ""
. = list("formatted" = "[verb], \"", "raw" = "")
for(var/datum/multilingual_say_piece/SP in message_pieces)
iteration_count++
var/piece = SP.message
@@ -11,9 +13,13 @@
if(SP.speaking && SP.speaking.flags & INNATE) // Snowflake for noise lang
if(radio)
return SP.speaking.format_message_radio(piece)
.["formatted"] = SP.speaking.format_message_radio(piece)
.["raw"] = piece
return
else
return SP.speaking.format_message(piece)
.["formatted"] = SP.speaking.format_message(piece)
.["raw"] = piece
return
if(iteration_count == 1)
piece = capitalize(piece)
@@ -27,6 +33,9 @@
if(istype(S.say_list) && length(S.say_list.speak))
piece = pick(S.say_list.speak)
raw_msg += (piece + " ")
//HTML formatting
if(!SP.speaking) // Catch the most generic case first
piece = "<span class='message body'>[piece]</span>"
else if(radio) // SP.speaking == TRUE enforced by previous !SP.speaking
@@ -38,10 +47,11 @@
if(msg == "")
// There is literally no content left in this message, we need to shut this shit down
. = "" // hear_say will suppress it
.["formatted"] = "" // hear_say will suppress it
else
. = trim(. + trim(msg))
. += "\""
.["formatted"] = trim(.["formatted"] + trim(msg))
.["formatted"] += "\""
.["raw"] = trim(raw_msg)
/mob/proc/saypiece_scramble(datum/multilingual_say_piece/SP)
if(SP.speaking)
@@ -76,7 +86,8 @@
var/mob/living/carbon/human/H = speaker
speaker_name = H.GetVoice()
var/message = combine_message(message_pieces, verb, speaker)
var/list/combined = combine_message(message_pieces, verb, speaker)
var/message = combined["formatted"]
if(message == "")
return
@@ -109,6 +120,7 @@
message_to_send = "<font size='3'><b>[message_to_send]</b></font>"
on_hear_say(message_to_send)
create_chat_message(speaker, combined["raw"], italics, list())
if(speech_sound && (get_dist(speaker, src) <= world.view && z == speaker.z))
var/turf/source = speaker ? get_turf(speaker) : get_turf(src)
@@ -164,7 +176,8 @@
if(!client)
return
var/message = combine_message(message_pieces, verb, speaker, always_stars = hard_to_hear, radio = TRUE)
var/list/combined = combine_message(message_pieces, verb, speaker, always_stars = hard_to_hear, radio = TRUE)
var/message = combined["formatted"]
if(sleeping || stat == UNCONSCIOUS) //If unconscious or sleeping
hear_sleep(message)
return
@@ -272,7 +285,8 @@
return
/mob/proc/hear_holopad_talk(list/message_pieces, var/verb = "says", var/mob/speaker = null)
var/message = combine_message(message_pieces, verb, speaker)
var/list/combined = combine_message(message_pieces, verb, speaker)
var/message = combined["formatted"]
var/name = speaker.name
if(!say_understands(speaker))
+57 -51
View File
@@ -1,55 +1,60 @@
var/list/department_radio_keys = list(
":r" = "right ear", ".r" = "right ear",
":l" = "left ear", ".l" = "left ear",
":i" = "intercom", ".i" = "intercom",
":h" = "department", ".h" = "department",
":+" = "special", ".+" = "special", //activate radio-specific special functions
":c" = "Command", ".c" = "Command",
":n" = "Science", ".n" = "Science",
":m" = "Medical", ".m" = "Medical",
":e" = "Engineering", ".e" = "Engineering",
":k" = "Response Team", ".k" = "Response Team",
":s" = "Security", ".s" = "Security",
":w" = "whisper", ".w" = "whisper",
":t" = "Mercenary", ".t" = "Mercenary",
":x" = "Raider", ".x" = "Raider",
":u" = "Supply", ".u" = "Supply",
":v" = "Service", ".v" = "Service",
":p" = "AI Private", ".p" = "AI Private",
":y" = "Explorer", ".y" = "Explorer",
":r" = "right ear", ".r" = "right ear",
":l" = "left ear", ".l" = "left ear",
":i" = "intercom", ".i" = "intercom",
":h" = "department", ".h" = "department",
":+" = "special", ".+" = "special", //activate radio-specific special functions
":c" = "Command", ".c" = "Command",
":n" = "Science", ".n" = "Science",
":m" = "Medical", ".m" = "Medical",
":e" = "Engineering", ".e" = "Engineering",
":k" = "Response Team", ".k" = "Response Team",
":s" = "Security", ".s" = "Security",
":w" = "whisper", ".w" = "whisper",
":t" = "Mercenary", ".t" = "Mercenary",
":x" = "Raider", ".x" = "Raider",
":u" = "Supply", ".u" = "Supply",
":v" = "Service", ".v" = "Service",
":p" = "AI Private", ".p" = "AI Private",
":y" = "Explorer", ".y" = "Explorer",
":R" = "right ear", ".R" = "right ear",
":L" = "left ear", ".L" = "left ear",
":I" = "intercom", ".I" = "intercom",
":H" = "department", ".H" = "department",
":C" = "Command", ".C" = "Command",
":N" = "Science", ".N" = "Science",
":M" = "Medical", ".M" = "Medical",
":E" = "Engineering", ".E" = "Engineering",
":k" = "Response Team", ".k" = "Response Team",
":S" = "Security", ".S" = "Security",
":W" = "whisper", ".W" = "whisper",
":T" = "Mercenary", ".T" = "Mercenary",
":X" = "Raider", ".X" = "Raider",
":U" = "Supply", ".U" = "Supply",
":V" = "Service", ".V" = "Service",
":P" = "AI Private", ".P" = "AI Private",
":Y" = "Explorer", ".Y" = "Explorer",
":R" = "right ear", ".R" = "right ear",
":L" = "left ear", ".L" = "left ear",
":I" = "intercom", ".I" = "intercom",
":H" = "department", ".H" = "department",
":C" = "Command", ".C" = "Command",
":N" = "Science", ".N" = "Science",
":M" = "Medical", ".M" = "Medical",
":E" = "Engineering", ".E" = "Engineering",
":k" = "Response Team", ".k" = "Response Team",
":S" = "Security", ".S" = "Security",
":W" = "whisper", ".W" = "whisper",
":T" = "Mercenary", ".T" = "Mercenary",
":X" = "Raider", ".X" = "Raider",
":U" = "Supply", ".U" = "Supply",
":V" = "Service", ".V" = "Service",
":P" = "AI Private", ".P" = "AI Private",
":Y" = "Explorer", ".Y" = "Explorer",
//kinda localization -- rastaf0
//same keys as above, but on russian keyboard layout. This file uses cp1251 as encoding.
":" = "right ear", "." = "right ear",
":" = "left ear", "." = "left ear",
":" = "intercom", "." = "intercom",
":" = "department", "." = "department",
":" = "Command", "." = "Command",
":" = "Science", "." = "Science",
":" = "Medical", "." = "Medical",
":" = "Engineering", "." = "Engineering",
":" = "Security", "." = "Security",
":" = "whisper", "." = "whisper",
":" = "Mercenary", "." = "Mercenary",
":" = "Supply", "." = "Supply",
// Cyrillic characters on the same keys on the Russian QWERTY (phonetic) layout
":к" = "right ear", ".к" = "right ear",
":д" = "left ear", ".д" = "left ear",
":ш" = "intercom", ".ш" = "intercom",
":р" = "department", ".р" = "department",
":+" = "special", ".+" = "special", //activate radio-specific special functions
":с" = "Command", ".с" = "Command",
":т" = "Science", ".т" = "Science",
":ь" = "Medical", ".ь" = "Medical",
":у" = "Engineering", ".у" = "Engineering",
":л" = "Response Team", ".л" = "Response Team",
":ы" = "Security", ".ы" = "Security",
":ц" = "whisper", ".ц" = "whisper",
":е" = "Mercenary", ".е" = "Mercenary",
":ч" = "Raider", ".ч" = "Raider",
":г" = "Supply", ".г" = "Supply",
":м" = "Service", ".м" = "Service",
":з" = "AI Private", ".з" = "AI Private",
":н" = "Explorer", ".н" = "Explorer"
)
@@ -324,16 +329,17 @@ proc/get_radio_key_from_channel(var/channel)
if(M && src) //If we still exist, when the spawn processes
var/dst = get_dist(get_turf(M),get_turf(src))
var/runechat_enabled = M.client?.is_preference_enabled(/datum/client_preference/runechat_mob)
if(dst <= message_range || (M.stat == DEAD && !forbid_seeing_deadchat)) //Inside normal message range, or dead with ears (handled in the view proc)
if(M.client)
if(M.client && !runechat_enabled)
var/image/I1 = listening[M] || speech_bubble
images_to_clients[I1] |= M.client
M << I1
M.hear_say(message_pieces, verb, italics, src, speech_sound, sound_vol)
if(whispering && !isobserver(M)) //Don't even bother with these unless whispering
if(dst > message_range && dst <= w_scramble_range) //Inside whisper scramble range
if(M.client)
if(M.client && !runechat_enabled)
var/image/I2 = listening[M] || speech_bubble
images_to_clients[I2] |= M.client
M << I2
File diff suppressed because it is too large Load Diff
+125 -125
View File
@@ -1,125 +1,125 @@
/mob/living/silicon/robot/handle_message_mode(message_mode, message, verb, speaking, used_radios)
..()
if(message_mode)
if(!is_component_functioning("radio"))
to_chat(src, "<span class='warning'>Your radio isn't functional at this time.</span>")
return 0
if(message_mode == "general")
message_mode = null
return radio.talk_into(src,message,message_mode,verb,speaking)
/mob/living/silicon/speech_bubble_appearance()
return "synthetic"
/mob/living/silicon/ai/handle_message_mode(message_mode, message, verb, speaking, used_radios)
..()
if(message_mode == "department")
return holopad_talk(message, verb, speaking)
else if(message_mode)
if (aiRadio.disabledAi || aiRestorePowerRoutine || stat)
to_chat(src, "<span class='danger'>System Error - Transceiver Disabled.</span>")
return 0
if(message_mode == "general")
message_mode = null
return aiRadio.talk_into(src,message,message_mode,verb,speaking)
/mob/living/silicon/pai/handle_message_mode(message_mode, message, verb, speaking, used_radios)
..()
if(message_mode)
if(message_mode == "general")
message_mode = null
return radio.talk_into(src,message,message_mode,verb,speaking)
/mob/living/silicon/say_quote(var/text)
var/ending = copytext(text, length(text))
if (ending == "?")
return speak_query
else if (ending == "!")
return speak_exclamation
return speak_statement
#define IS_AI 1
#define IS_ROBOT 2
#define IS_PAI 3
/mob/living/silicon/say_understands(var/other, var/datum/language/speaking = null)
//These only pertain to common. Languages are handled by mob/say_understands()
if(!speaking)
if(iscarbon(other))
return TRUE
if(issilicon(other))
return TRUE
if(isbrain(other))
return TRUE
return ..()
//For holopads only. Usable by AI.
/mob/living/silicon/ai/proc/holopad_talk(list/message_pieces, verb)
log_say("(HPAD) [multilingual_to_message(message_pieces)]",src)
var/obj/machinery/hologram/holopad/T = src.holo
if(T && T.masters[src])//If there is a hologram and its master is the user.
var/list/listeners = get_mobs_and_objs_in_view_fast(get_turf(T), world.view)
var/list/listening = listeners["mobs"]
var/list/listening_obj = listeners["objs"]
for(var/mob/M in listening)
M.hear_holopad_talk(message_pieces, verb, src)
for(var/obj/O in listening_obj)
if(O == T) //Don't recieve your own speech
continue
O.hear_talk(src, message_pieces, verb)
/*Radios "filter out" this conversation channel so we don't need to account for them.
This is another way of saying that we won't bother dealing with them.*/
to_chat(src, "<i><span class='game say'>Holopad transmitted, <span class='name'>[real_name]</span> [combine_message(message_pieces, verb, src)]</span></i>")
else
to_chat(src, "No holopad connected.")
return 0
return 1
/mob/living/silicon/ai/proc/holopad_emote(var/message) //This is called when the AI uses the 'me' verb while using a holopad.
message = trim(message)
if(!message)
return
var/obj/machinery/hologram/holopad/T = src.holo
if(T && T.masters[src])
var/rendered = "<span class='game say'><span class='name'>[name]</span> <span class='message'>[message]</span></span>"
to_chat(src, "<i><span class='game say'>Holopad action relayed, <span class='name'>[real_name]</span> <span class='message'>[message]</span></span></i>")
var/obj/effect/overlay/hologram = T.masters[src]
var/list/in_range = get_mobs_and_objs_in_view_fast(get_turf(hologram), world.view, 2) //Emotes are displayed from the hologram, not the pad
var/list/m_viewers = in_range["mobs"]
var/list/o_viewers = in_range["objs"]
for(var/mob/M in m_viewers)
spawn(0)
if(M)
M.show_message(rendered, 2)
for(var/obj/O in o_viewers)
if(O == T)
continue
spawn(0)
if(O)
O.see_emote(src, message)
log_emote("(HPAD) [message]", src)
else //This shouldn't occur, but better safe then sorry.
to_chat(src, "No holopad connected.")
return 0
return 1
/mob/living/silicon/ai/emote(var/act, var/m_type, var/message)
var/obj/machinery/hologram/holopad/T = holo
if(T && T.masters[src]) //Is the AI using a holopad?
. = holopad_emote(message)
else //Emote normally, then.
. = ..()
#undef IS_AI
#undef IS_ROBOT
#undef IS_PAI
/mob/living/silicon/robot/handle_message_mode(message_mode, message, verb, speaking, used_radios)
..()
if(message_mode)
if(!is_component_functioning("radio"))
to_chat(src, "<span class='warning'>Your radio isn't functional at this time.</span>")
return 0
if(message_mode == "general")
message_mode = null
return radio.talk_into(src,message,message_mode,verb,speaking)
/mob/living/silicon/speech_bubble_appearance()
return "synthetic"
/mob/living/silicon/ai/handle_message_mode(message_mode, message, verb, speaking, used_radios)
..()
if(message_mode == "department")
return holopad_talk(message, verb, speaking)
else if(message_mode)
if (aiRadio.disabledAi || aiRestorePowerRoutine || stat)
to_chat(src, "<span class='danger'>System Error - Transceiver Disabled.</span>")
return 0
if(message_mode == "general")
message_mode = null
return aiRadio.talk_into(src,message,message_mode,verb,speaking)
/mob/living/silicon/pai/handle_message_mode(message_mode, message, verb, speaking, used_radios)
..()
if(message_mode)
if(message_mode == "general")
message_mode = null
return radio.talk_into(src,message,message_mode,verb,speaking)
/mob/living/silicon/say_quote(var/text)
var/ending = copytext(text, length(text))
if (ending == "?")
return speak_query
else if (ending == "!")
return speak_exclamation
return speak_statement
#define IS_AI 1
#define IS_ROBOT 2
#define IS_PAI 3
/mob/living/silicon/say_understands(var/other, var/datum/language/speaking = null)
//These only pertain to common. Languages are handled by mob/say_understands()
if(!speaking)
if(iscarbon(other))
return TRUE
if(issilicon(other))
return TRUE
if(isbrain(other))
return TRUE
return ..()
//For holopads only. Usable by AI.
/mob/living/silicon/ai/proc/holopad_talk(list/message_pieces, verb)
log_say("(HPAD) [multilingual_to_message(message_pieces)]",src)
var/obj/machinery/hologram/holopad/T = src.holo
if(T && T.masters[src])//If there is a hologram and its master is the user.
var/list/listeners = get_mobs_and_objs_in_view_fast(get_turf(T), world.view)
var/list/listening = listeners["mobs"]
var/list/listening_obj = listeners["objs"]
for(var/mob/M in listening)
M.hear_holopad_talk(message_pieces, verb, src)
for(var/obj/O in listening_obj)
if(O == T) //Don't recieve your own speech
continue
O.hear_talk(src, message_pieces, verb)
/*Radios "filter out" this conversation channel so we don't need to account for them.
This is another way of saying that we won't bother dealing with them.*/
var/list/combined = combine_message(message_pieces, verb, src)
to_chat(src, "<i><span class='game say'>Holopad transmitted, <span class='name'>[real_name]</span> [combined["formatted"]]</span></i>")
else
to_chat(src, "No holopad connected.")
return 0
return 1
/mob/living/silicon/ai/proc/holopad_emote(var/message) //This is called when the AI uses the 'me' verb while using a holopad.
message = trim(message)
if(!message)
return
var/obj/machinery/hologram/holopad/T = src.holo
if(T && T.masters[src])
var/rendered = "<span class='game say'><span class='name'>[name]</span> <span class='message'>[message]</span></span>"
to_chat(src, "<i><span class='game say'>Holopad action relayed, <span class='name'>[real_name]</span> <span class='message'>[message]</span></span></i>")
var/obj/effect/overlay/hologram = T.masters[src]
var/list/in_range = get_mobs_and_objs_in_view_fast(get_turf(hologram), world.view, 2) //Emotes are displayed from the hologram, not the pad
var/list/m_viewers = in_range["mobs"]
var/list/o_viewers = in_range["objs"]
for(var/mob/M in m_viewers)
spawn(0)
if(M)
M.show_message(rendered, 2)
for(var/obj/O in o_viewers)
if(O == T)
continue
spawn(0)
if(O)
O.see_emote(src, message)
log_emote("(HPAD) [message]", src)
else //This shouldn't occur, but better safe then sorry.
to_chat(src, "No holopad connected.")
return 0
return 1
/mob/living/silicon/ai/emote(var/act, var/m_type, var/message)
var/obj/machinery/hologram/holopad/T = holo
if(T && T.masters[src]) //Is the AI using a holopad?
. = holopad_emote(message)
else //Emote normally, then.
. = ..()
#undef IS_AI
#undef IS_ROBOT
#undef IS_PAI
+10 -3
View File
@@ -76,7 +76,7 @@
// 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(var/message, var/self_message, var/blind_message, var/list/exclude_mobs = null, var/range = world.view)
/mob/visible_message(var/message, var/self_message, var/blind_message, var/list/exclude_mobs = null, var/range = world.view, var/runemessage)
if(self_message)
if(LAZYLEN(exclude_mobs))
exclude_mobs |= src
@@ -86,7 +86,9 @@
// Transfer messages about what we are doing to upstairs
if(shadow)
shadow.visible_message(message, self_message, blind_message, exclude_mobs, range)
. = ..(message, blind_message, exclude_mobs, range) // Really not ideal that atom/visible_message has different arg numbering :(
if(isnull(runemessage))
runemessage = -1
. = ..(message, blind_message, exclude_mobs, range, runemessage) // Really not ideal that atom/visible_message has different arg numbering :(
// Returns an amount of power drawn from the object (-1 if it's not viable).
// If drain_check is set it will not actually drain power, just return a value.
@@ -101,7 +103,7 @@
// self_message (optional) is what the src mob hears.
// deaf_message (optional) is what deaf people will see.
// hearing_distance (optional) is the range, how many tiles away the message can be heard.
/mob/audible_message(var/message, var/deaf_message, var/hearing_distance, var/self_message, var/radio_message)
/mob/audible_message(var/message, var/deaf_message, var/hearing_distance, var/self_message, var/radio_message, var/runemessage)
var/range = hearing_distance || world.view
var/list/hear = get_mobs_and_objs_in_view_fast(get_turf(src),range,remote_ghosts = FALSE)
@@ -109,6 +111,9 @@
var/list/hearing_mobs = hear["mobs"]
var/list/hearing_objs = hear["objs"]
if(isnull(runemessage))
runemessage = -1 // Symmetry with mob/audible_message, despite the fact this one doesn't call parent. Maybe it should!
if(radio_message)
for(var/obj in hearing_objs)
var/obj/O = obj
@@ -124,6 +129,8 @@
if(self_message && M==src)
msg = self_message
M.show_message(msg, AUDIBLE_MESSAGE, deaf_message, VISIBLE_MESSAGE)
if(runemessage != -1)
M.create_chat_message(src, "[runemessage || message]", FALSE, list("emote"), audible = FALSE)
/mob/proc/findname(msg)
for(var/mob/M in mob_list)