mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-17 02:54:44 +01:00
Merge branch 'master' of https://github.com/tgstation/tgstation into upstream-sync
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -65,6 +65,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.
|
||||
*/
|
||||
@@ -78,6 +85,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.
|
||||
*
|
||||
@@ -101,4 +121,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
|
||||
|
||||
Reference in New Issue
Block a user