Mind readers can read what people are typing (#93059)

## About The Pull Request

When a Mind Reader examines someone who is typing, it will show them
what they are actively typing

<img width="518" height="97" alt="image"
src="https://github.com/user-attachments/assets/8d54aa56-85fc-4e03-b0a3-bfb8e475beff"
/>

No, it won't read OOC messages.

## Why It's Good For The Game

Your next line is, "This sounds really funny for gimmicks like security
interrogations or fortune telling, or for getting the jump on someone as
they try to get the jump on you, or just to be a badass by finishing
people sentences"

## Changelog

🆑 Melbert
add: When a mind reader examines a mob, they'll get a glimpse into what
that mob is currently typing, before they even send the message.
qol: Mind Reader now groups up all the information it gives you in a box
admin: Mind Reader now logs everything the reader gleamed from the
read-ee
/🆑
This commit is contained in:
MrMelbert
2025-10-03 18:29:31 -05:00
committed by GitHub
parent ee20fa4a1c
commit ce50179f7c
5 changed files with 107 additions and 9 deletions
+4 -2
View File
@@ -24,13 +24,15 @@
/// The user who opened the window
var/client/client
/// Injury phrases to blurt out
var/list/hurt_phrases = list("GACK!", "GLORF!", "OOF!", "AUGH!", "OW!", "URGH!", "HRNK!")
var/static/list/hurt_phrases = list("GACK!", "GLORF!", "OOF!", "AUGH!", "OW!", "URGH!", "HRNK!")
/// Max message length
var/max_length = MAX_MESSAGE_LEN
/// The modal window
var/datum/tgui_window/window
/// Boolean for whether the tgui_say was opened by the user.
var/window_open
/// What text was present in the say box the last time save_text was called
var/saved_text = ""
/** Creates the new input window to exist in the background. */
/datum/tgui_say/New(client/client, id)
@@ -128,7 +130,7 @@
if (type == "typing")
start_typing()
return TRUE
if (type == "entry" || type == "force")
if (type == "entry" || type == "force" || type == "save")
handle_entry(type, payload)
return TRUE
return FALSE
@@ -57,6 +57,13 @@
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.
*/
@@ -70,6 +77,19 @@
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.
*
@@ -93,4 +113,10 @@
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
return TRUE
return FALSE