Files
Bubberstation/code/datums/saymode.dm
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

176 lines
4.9 KiB
Plaintext

/datum/saymode
/// The symbol key used to enable this say mode.
var/key
/// The corresponding say mode string.
var/mode
/// Whether this say mode works with custom say emotes.
var/allows_custom_say_emotes = FALSE
/// Checks whether this saymode can be used by the given user. May send feedback.
/datum/saymode/proc/can_be_used_by(mob/living/user)
return TRUE
/**
* Handles actually modifying or forwarding our message.
* Returns `SAYMODE_[X]` flags.
*
* user - The living speaking using this say mode.
* message - The message to be said.
* spans - A list of spans to attach to the message.
* language - The language the message was said in.
* message_mods - A list of message modifiers, i.e. whispering/singing.
*/
/datum/saymode/proc/handle_message(
mob/living/user,
message,
list/spans = list(),
datum/language/language,
list/message_mods = list()
)
return NONE
/datum/saymode/changeling
key = MODE_KEY_CHANGELING
mode = MODE_CHANGELING
/datum/saymode/changeling/can_be_used_by(mob/living/user)
if(user.mind?.has_antag_datum(/datum/antagonist/fallen_changeling))
// special message for you
to_chat(user, span_changeling("<b>We're cut off from the hivemind! We've lost everything! EVERYTHING!!</b>"))
return FALSE
if(!HAS_TRAIT(user, TRAIT_CHANGELING_HIVEMIND))
return FALSE
if(is_muted(user))
to_chat(user, span_warning("The poison in the air hinders our ability to interact with the hivemind."))
return FALSE
return TRUE
/datum/saymode/changeling/proc/is_muted(mob/living/user)
return user.reagents?.has_reagent(/datum/reagent/bz_metabolites, needs_metabolizing = TRUE)
/datum/saymode/changeling/proc/get_lings()
. = list()
for(var/mob/ling_mob as anything in GLOB.mob_list)
//removes types that override the presence of being changeling (for example, borged lings still can't hivemind chat)
if(!HAS_TRAIT(ling_mob, TRAIT_CHANGELING_HIVEMIND) || issilicon(ling_mob) || isbrain(ling_mob) )
continue
// can't receive messages on the hivemind right now
if(is_muted(ling_mob))
continue
. += ling_mob
/datum/saymode/changeling/handle_message(
mob/living/user,
message,
list/spans = list(),
datum/language/language,
list/message_mods = list()
)
var/datum/antagonist/changeling/ling_sender = IS_CHANGELING(user)
var/id = ling_sender?.changelingID || user.real_name
user.log_talk(message, LOG_SAY, tag = "[id]")
var/msg = span_changeling("<b>[id]:</b> [message]")
// Send the message to our other changelings.
for(var/mob/ling_mob as anything in get_lings())
to_chat(ling_mob, msg, type = MESSAGE_TYPE_RADIO, avoid_highlighting = ling_mob == user)
for(var/mob/dead/ghost as anything in GLOB.dead_mob_list)
to_chat(ghost, "[FOLLOW_LINK(ghost, user)] [msg]", type = MESSAGE_TYPE_RADIO)
return SAYMODE_MESSAGE_HANDLED
/datum/saymode/xeno
key = MODE_KEY_ALIEN
mode = MODE_ALIEN
allows_custom_say_emotes = TRUE
/datum/saymode/xeno/can_be_used_by(mob/living/user)
if(!user.hivecheck())
return FALSE
return TRUE
/datum/saymode/xeno/handle_message/handle_message(
mob/living/user,
message,
list/spans = list(),
datum/language/language,
list/message_mods = list()
)
user.alien_talk(message, spans, message_mods)
return SAYMODE_MESSAGE_HANDLED
/datum/saymode/vocalcords
key = MODE_KEY_VOCALCORDS
mode = MODE_VOCALCORDS
/datum/saymode/vocalcords/can_be_used_by(mob/living/user)
if(!iscarbon(user))
return FALSE
return TRUE
/datum/saymode/vocalcords/handle_message/handle_message(
mob/living/user,
message,
list/spans = list(),
datum/language/language,
list/message_mods = list()
)
var/mob/living/carbon/carbon_user = user
var/obj/item/organ/vocal_cords/our_vocal_cords = carbon_user.get_organ_slot(ORGAN_SLOT_VOICE)
if(our_vocal_cords?.can_speak_with())
our_vocal_cords.handle_speech(message) //message
our_vocal_cords.speak_with(message) //action
return SAYMODE_MESSAGE_HANDLED
/datum/saymode/binary //everything that uses .b (silicons, drones)
key = MODE_KEY_BINARY
mode = MODE_BINARY
allows_custom_say_emotes = TRUE
/datum/saymode/binary/can_be_used_by(mob/living/user)
if(!isdrone(user) && !user.binarycheck())
return FALSE
return TRUE
/datum/saymode/binary/handle_message/handle_message(
mob/living/user,
message,
list/spans = list(),
datum/language/language,
list/message_mods = list()
)
if(isdrone(user))
var/mob/living/basic/drone/drone_user = user
drone_user.drone_chat(message, spans, message_mods)
else if(user.binarycheck())
user.robot_talk(message, spans, message_mods)
return SAYMODE_MESSAGE_HANDLED
/datum/saymode/holopad
key = MODE_KEY_HOLOPAD
mode = MODE_HOLOPAD
allows_custom_say_emotes = TRUE
/datum/saymode/holopad/can_be_used_by(mob/living/user)
if(!isAI(user))
return FALSE
return TRUE
/datum/saymode/holopad/handle_message/handle_message(
mob/living/user,
message,
list/spans = list(),
datum/language/language,
list/message_mods = list()
)
var/mob/living/silicon/ai/ai_user = user
ai_user.holopad_talk(message, spans, language, message_mods)
return SAYMODE_MESSAGE_HANDLED