Cleans up some admin-related stuff in client Destroy() and adminGreet() (#83427)

## About The Pull Request

It made me really mad to see a huge list in the middle of client/Destroy
for something that doesn't even run for 95% of users so I split it out
into another proc so the fingerprint of the very important `Destroy()`
stuff could be as minimal as possible without a big `pick()` so the
server can send the "I need a man 🥺" message could be punted off to
where no-one would care for it. It was already doing the async TGS
operation so it doesn't matter anyways as far as proc overhead in my
books.

I also fixed up the code for `adminGreet()` as well because that was
being really weird with not having proper booleans and running `pick()`
on things with literally one value (as well as excess
stringification)... it wasn't good so I just cleaned all that up too.
Ideally this all means we take up a little less CPU time but the aim of
this PR is to just clean it all up for modern coding standards.
alphabetized lists and early returns galore.

## Why It's Good For The Game

Code is better to read and less idented, and better yet it's no longer
necessary to read all the softie messages in the middle of `Destroy()`

## Changelog

Irrelevant
This commit is contained in:
san7890
2024-05-25 19:00:12 -04:00
committed by SkyratBot
parent 628366743c
commit 5a6ff98e2a
2 changed files with 45 additions and 28 deletions
+14 -11
View File
@@ -286,14 +286,17 @@ ADMIN_VERB(create_or_modify_area, R_DEBUG, "Create Or Modify Area", "Create of m
return TRUE
/client/proc/adminGreet(logout)
if(SSticker.HasRoundStarted())
var/string
if(logout && CONFIG_GET(flag/announce_admin_logout))
string = pick(
"Admin logout: [key_name(src)]")
else if(!logout && CONFIG_GET(flag/announce_admin_login) && (prefs.toggles & ANNOUNCE_LOGIN))
string = pick(
"Admin login: [key_name(src)]")
if(string)
message_admins("[string]")
/// Sends a message to adminchat when anyone with a holder logs in or logs out.
/// Is dependent on admin preferences and configuration settings, which means that this proc can fire without sending a message.
/client/proc/adminGreet(logout = FALSE)
if(!SSticker.HasRoundStarted())
return
if(logout && CONFIG_GET(flag/announce_admin_logout))
message_admins("Admin logout: [key_name(src)]")
return
if(!logout && CONFIG_GET(flag/announce_admin_login) && (prefs.toggles & ANNOUNCE_LOGIN))
message_admins("Admin login: [key_name(src)]")
return