Files
+37 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

152 lines
4.9 KiB
Plaintext

/**
* Alters text when players are injured.
* Adds text, trims left and right side
*
* Arguments:
* payload - a string list containing entry & channel
* Returns:
* string - the altered entry
*/
/datum/tgui_say/proc/alter_entry(payload)
var/entry = payload["entry"]
var/list/phrases = alter_phrases || hurt_phrases
/// No OOC leaks
if(!entry || payload["channel"] == OOC_CHANNEL || payload["channel"] == ME_CHANNEL || payload["channel"] == LOOC_CHANNEL) // BUBBER EDIT - CHANGE - ORIGINAL: if(!entry || payload["channel"] == OOC_CHANNEL || payload["channel"] == ME_CHANNEL)
return pick(phrases)
/// Random trimming for larger sentences
if(length(entry) > 50)
entry = trim(entry, rand(40, 50))
else
/// Otherwise limit trim to just last letter
if(length(entry) > 1)
entry = trim(entry, length(entry))
return entry + "-" + pick(phrases)
/**
* Delegates the speech to the proper channel.
*
* Arguments:
* entry - the text to broadcast
* channel - the channel to broadcast in
* Returns:
* boolean - on success or failure
*/
/datum/tgui_say/proc/delegate_speech(entry, channel)
switch(channel)
if(SAY_CHANNEL)
client.mob.say_verb(entry)
return TRUE
if(RADIO_CHANNEL)
client.mob.say_verb(";" + entry)
return TRUE
if(ME_CHANNEL)
client.mob.me_verb(entry)
return TRUE
if(OOC_CHANNEL)
ASYNC
client.ooc(entry)
return TRUE
if(ADMIN_CHANNEL)
INVOKE_ASYNC(SSadmin_verbs, TYPE_PROC_REF(/datum/controller/subsystem/admin_verbs, dynamic_invoke_verb), client, /datum/admin_verb/cmd_admin_say, entry)
return TRUE
// BUBBER EDIT - ADDITION - START
if(LOOC_CHANNEL)
INVOKE_ASYNC(client, TYPE_PROC_REF(/client, looc_message), entry)
return TRUE
if(WHIS_CHANNEL)
client.mob.whisper_verb(entry)
return TRUE
// BUBBER EDIT - ADDITION - END
return FALSE
/**
* Force say handler.
* Sends a message to the say modal to send its current value.
* Arguments:
* alter_phrases - Optional list of alternate suffixes to blurt out
* immediate - If [TRUE], the say must be invoked inline due to side effects that may cause the mob to be unable to speak
*/
/datum/tgui_say/proc/force_say(list/alter_phrases = null, immediate = FALSE)
src.alter_phrases = alter_phrases
if(immediate)
if(!saved_text)
saved_text = ""
if(!saved_channel)
saved_channel = SAY_CHANNEL
handle_entry("force", list("type" = "force", "entry" = saved_text, "channel" = saved_channel))
window.send_message("close")
else
window.send_message("force")
stop_typing()
/**
* Exports whatever text is currently in the input box to this datum
*/
/datum/tgui_say/proc/save_text()
saved_text = null
window.send_message("save")
/**
* Makes the player force say what's in their current input box.
* Arguments:
* alter_phrases - Optional list of alternate suffixes to blurt out
* immediate - If [TRUE], the say must be invoked inline due to side effects that may cause the mob to be unable to speak
*/
/mob/living/carbon/human/proc/force_say(list/alter_phrases = null, immediate = FALSE)
if(stat != CONSCIOUS || !client?.tgui_say?.window_open)
return FALSE
client.tgui_say.force_say(alter_phrases, immediate)
if(client.typing_indicators)
log_speech_indicators("[key_name(client)] FORCED to stop typing, indicators enabled.")
else
log_speech_indicators("[key_name(client)] FORCED to stop typing, indicators DISABLED.")
SEND_SIGNAL(src, COMSIG_HUMAN_FORCESAY)
/**
* Gets whatever text is currently in this mob's say box and returns it.
*
* Note: Sleeps, due to waiting for say to respond.
*/
/mob/proc/get_typing_text()
if(!client?.tgui_say?.window_open)
return
client.tgui_say.save_text()
var/safety = world.time
UNTIL(istext(client?.tgui_say?.saved_text) || world.time - safety > 2 SECONDS)
return client?.tgui_say?.saved_text
/**
* Handles text entry and forced speech.
*
* Arguments:
* type - a string "entry" or "force" based on how this function is called
* payload - a string list containing entry & channel
* Returns:
* boolean - success or failure
*/
/datum/tgui_say/proc/handle_entry(type, payload)
if(!payload?["channel"] || !payload["entry"])
CRASH("[usr] entered in a null payload to the chat window.")
if(length(payload["entry"]) > max_length)
CRASH("[usr] has entered more characters than allowed into a TGUI-Say")
if(type == "entry")
delegate_speech(payload["entry"], payload["channel"])
return TRUE
if(type == "force")
var/target_channel = payload["channel"]
if(target_channel == ME_CHANNEL || target_channel == OOC_CHANNEL)
target_channel = SAY_CHANNEL // No ooc leaks
delegate_speech(alter_entry(payload), target_channel)
return TRUE
if(type == "save")
saved_text = "" // so we can differentiate null (nothing saved) and empty (nothing typed)
var/target_channel = payload["channel"]
if(target_channel == SAY_CHANNEL || target_channel == RADIO_CHANNEL)
saved_text = payload["entry"] // only save IC text
saved_channel = target_channel
return TRUE
return FALSE