Files
Paradise/code/modules/tgui_input/say_modal/tgui_say_speech.dm
T
warriorstar-orionandGitHub 2a842644d5 port ADMIN_VERB and friends (#30646)
* port ADMIN_VERB and friends

* some renaming

* dumb

* one more rename

* never search and replace this codebase

* fix TM issues, more renaming

* add a static analysis to shore up user verbs

* fix double message on roundstart

* remove macro we're not using yet

* convert remaining playsounds verbs

* convert more verbs i missed somehow

* why is this a completely different signature than everything else

* fix ui_interact arg

* fix logging view and others

* buncha issues caught in TM

* fix mentor tickets ui

* fix bug report viewing

* moron
2025-12-12 19:18:22 +00:00

68 lines
2.0 KiB
Plaintext

/**
* 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((isliving(client.mob) ? ";" : "") + entry)
return TRUE
if(WHISPER_CHANNEL)
client.mob.whisper(entry)
return TRUE
if(ME_CHANNEL)
client.mob.me_verb(entry)
return TRUE
if(OOC_CHANNEL)
client.ooc(entry)
return TRUE
if(LOOC_CHANNEL)
client.looc(entry)
return TRUE
if(ADMIN_CHANNEL)
SSuser_verbs.invoke_verb(client, /datum/user_verb/admin_say, entry)
return TRUE
if(MENTOR_CHANNEL)
SSuser_verbs.invoke_verb(client, /datum/user_verb/mentor_say, entry)
return TRUE
if(DSAY_CHANNEL)
SSuser_verbs.invoke_verb(client, /datum/user_verb/dsay, entry)
return TRUE
if(DEV_CHANNEL)
SSuser_verbs.invoke_verb(client, /datum/user_verb/dev_say, entry)
return TRUE
if(STAFF_CHANNEL)
SSuser_verbs.invoke_verb(client, /datum/user_verb/staff_say, entry)
return TRUE
return FALSE
/**
* Handles text entry and forced speech.
*
* Arguments:
* payload - a string list containing entry & channel
* Returns:
* boolean - success or failure
*/
/datum/tgui_say/proc/handle_entry(payload)
if(!payload?["channel"] || !payload["entry"])
var/hacker_man_ckey = usr.client.ckey
qdel(usr.client)
message_admins("[hacker_man_ckey] was kicked for attemping to send a null message to TGUI-say.")
CRASH("[hacker_man_ckey] entered in a null payload to the chat window.")
if(length_char(payload["entry"]) > MAX_MESSAGE_LEN)
var/hacker_man_ckey = usr.client.ckey
qdel(usr.client)
message_admins("[hacker_man_ckey] was kicked for attemping to bypass TGUI-say character limits.")
CRASH("[hacker_man_ckey] has entered more characters than allowed into a TGUI-Say.")
delegate_speech(payload["entry"], payload["channel"])
return TRUE