Files
Bubberstation/code/__HELPERS/logging/talk.dm
_0Steven edb85b2d0c Refactors say modes and custom say verbs. Extends custom say verbs to more situations, forwards more spans. (#92127)
## About The Pull Request

Oh man, so this entire pr started because of two things:
1. A kinda hacky fix to #92123 that got closed a good while ago.
2. A borg I know mentioning you can't do custom say verbs over robotic
talk.

Which subsequently led me down this rabbit hole of say modes and custom
say verbs.
So! The most wide-reaching thing this does is merge the custom say
verb/radio emote logic that used to be specialcased in
`compose_message(...)` into `say_quote(...)`, renaming this to
`generate_messagepart(...)` with its new functionality. This means
things that don't use the exact same chain as living things talking
normally can still generate custom say verbs if given that message
modifier.

Then, we split up say modes into a "can we do this" and "try to do this"
check to reduce conflicts (like #92123), and forward more of our data to
the latter. This allows us to then edit the say modes to actually make
use of that data, and with the previous addition of
`generate_messagepart(...)` allow for custom say verbs to be used.

In doing this I realized the logging was kind of awkward and all over
the place, so we create the new logging helper `log_sayverb_talk(...)`
which handles selecting how we should log things based on the given
message modifiers.

For better or worse I forgot about this pr for a few weeks, so I don't
perfectly remember all the details, but those are the big key parts.
## Why It's Good For The Game

Fixes #92123.

I think custom say verbs are some of the best flavour we have for
talking over radio, and any situation benefits from that being possible.
It's great to be able to tap your microphone, and it's hilarious for an
AI to be able to emote beaming an image directly into the heads of their
borgs over robotic talk.

The rest is mostly cleanup.
2025-08-19 22:35:54 -04:00

73 lines
3.6 KiB
Plaintext

/**
* Helper for logging chat messages that may or may not have a custom say verb,
* or be a pure radio emote outright.
*
* This proc reads the `message_mods` to determine
* in what ways the given message should be logged,
* and forwards it to other logging procs as such.
* Arguments:
* * message - The message being logged
* * message_mods - A list of message modifiers, i.e. whispering/singing.
* * tag - tag that indicates the type of text(announcement, telepathy, etc)
* * log_globally - boolean checking whether or not we write this log to the log file
* * forced_by - source that forced the dialogue if any
*/
/atom/proc/log_sayverb_talk(message, list/message_mods = list(), tag = null, log_globally = TRUE, forced_by = null)
// If it's just the custom say verb, log it to emotes.
if(message_mods[MODE_CUSTOM_SAY_ERASE_INPUT])
log_talk(message_mods[MODE_CUSTOM_SAY_EMOTE], LOG_RADIO_EMOTE, tag, log_globally, forced_by)
return
if(message_mods[WHISPER_MODE])
log_talk(message, LOG_WHISPER, tag, log_globally, forced_by, message_mods[MODE_CUSTOM_SAY_EMOTE])
else
log_talk(message, LOG_SAY, tag, log_globally, forced_by, message_mods[MODE_CUSTOM_SAY_EMOTE])
/**
* Helper for logging chat messages or other logs with arbitrary inputs (e.g. announcements)
*
* This proc compiles a log string by prefixing the tag to the message
* and suffixing what it was forced_by if anything
* if the message lacks a tag and suffix then it is logged on its own
* Arguments:
* * message - The message being logged
* * message_type - the type of log the message is(ATTACK, SAY, etc)
* * tag - tag that indicates the type of text(announcement, telepathy, etc)
* * log_globally - boolean checking whether or not we write this log to the log file
* * forced_by - source that forced the dialogue if any
*/
/atom/proc/log_talk(message, message_type, tag = null, log_globally = TRUE, forced_by = null, custom_say_emote = null)
var/prefix = tag ? "([tag]) " : ""
var/suffix = forced_by ? " FORCED by [forced_by]" : ""
log_message("[prefix][custom_say_emote ? "*[custom_say_emote]*, " : ""]\"[message]\"[suffix]", message_type, log_globally = log_globally)
// log_public_file(message) // BUBBER EDIT
/// Logging for generic spoken messages
/proc/log_say(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_GAME_SAY, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT
/// Logging for whispered messages
/proc/log_whisper(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_GAME_WHISPER, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT
/// Helper for logging of messages with only one sender and receiver (i.e. mind links)
/proc/log_directed_talk(atom/source, atom/target, message, message_type, tag)
if(!tag)
stack_trace("Unspecified tag for private message")
tag = "UNKNOWN"
source.log_talk(message, message_type, tag = "[tag] to [key_name(target)]")
if(source != target)
target.log_talk(message, LOG_VICTIM, tag = "[tag] from [key_name(source)]", log_globally = FALSE)
/// Logging for speech taking place over comms, as well as tcomms equipment
/proc/log_telecomms(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_TELECOMMS, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT
/// Logging for speech indicators.
/proc/log_speech_indicators(text, list/data, redacted_log_text) // BUBBER EDIT
logger.Log(LOG_CATEGORY_SPEECH_INDICATOR, text, data)
log_public_file(redacted_log_text, no_regex_needed = TRUE) // BUBBER EDIT