[MIRROR] Feeds OOC messages back to client if blocked in validate_client() (#26779)

* Feeds OOC messages back to client if blocked in validate_client() (#81769)

## About The Pull Request

Basically, if your long and well-thought-out OOC message gets eaten due
to your client not being fully initialized, the server will feed back
the message to you so you can copy-paste and try again.

In order to facilitate this, I turned `validate_client` into a proc.
This didn't have the ubiquitous usage that we were hoping for (where it
could be dropped and placed anywhere) and I don't think I liked the
"always exit out of proc" stuff anyhow. Also adds some code niceties.

There's probably a way cooler way to do this with tgui_say and whatever
but I don't use tgui_say (byond command bar my beloved) so we'll cope
with this.
## Why It's Good For The Game

![image](https://github.com/tgstation/tgstation/assets/34697715/a96f7168-aad3-4772-9abe-7a6aa2b8779a)

Let me know if I should revert the `span_big()` stuff, I just added it
because I wanted it to be obvious to the player instead of look like a
generic error message.
## Changelog
🆑
qol: If your OOC message gets eaten due to some weird circumstance in
how your message is handled, it will feed the applicable message back to
you so you can copy-paste and try to send it again.
/🆑

* Feeds OOC messages back to client if blocked in validate_client()

---------

Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
SkyratBot
2024-03-06 22:27:03 -05:00
committed by GitHub
co-authored by san7890
parent 98cdd0e4fc
commit ea111b194e
3 changed files with 16 additions and 12 deletions
+7 -4
View File
@@ -10,12 +10,15 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
to_chat(usr, span_danger("Speech is currently admin-disabled."))
return
if(!mob)
var/client_initalized = VALIDATE_CLIENT_INITIALIZATION(src)
if(isnull(mob) || !client_initalized)
if(!client_initalized)
unvalidated_client_error() // we only want to throw this warning message when it's directly related to client failure.
to_chat(usr, span_warning("Failed to send your OOC message. You attempted to send the following message:\n[span_big(msg)]"))
return
VALIDATE_CLIENT(src)
if(!holder)
if(isnull(holder))
if(!GLOB.ooc_allowed)
to_chat(src, span_danger("OOC is globally muted."))
return