mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
* 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  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>
19 lines
887 B
Plaintext
19 lines
887 B
Plaintext
///Returns whether or not a player is a guest using their ckey as an input
|
|
/proc/is_guest_key(key)
|
|
if(findtext(key, "Guest-", 1, 7) != 1) //was findtextEx
|
|
return FALSE
|
|
|
|
var/i, ch, len = length(key)
|
|
|
|
for(i = 7, i <= len, ++i) //we know the first 6 chars are Guest-
|
|
ch = text2ascii(key, i)
|
|
if (ch < 48 || ch > 57) //0-9
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/// Proc that just logs whenever an uninitialized client tries to do something before they have fully gone through New().
|
|
/// Intended to be used in conjunction with the `VALIDATE_CLIENT_INITIALIZATION()` macro, but can be dropped anywhere when we look at the `fully_created` var on /client.
|
|
/proc/unvalidated_client_error(client/target)
|
|
to_chat(target, span_warning("You are not fully initialized yet! Please wait a moment."))
|
|
log_access("Client [key_name(target)] attempted to execute a verb before being fully initialized.")
|