diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 10b9a58b870..5f40de037f4 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -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 + diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 924eb3abe41..1d92bde9dfb 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -597,26 +597,10 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( if(credits) QDEL_LIST(credits) if(holder) - adminGreet(1) holder.owner = null GLOB.admins -= src - if (!GLOB.admins.len && SSticker.IsRoundInProgress()) //Only report this stuff if we are currently playing. - var/cheesy_message = pick( - "I have no admins online!",\ - "I'm all alone :(",\ - "I'm feeling lonely :(",\ - "I'm so lonely :(",\ - "Why does nobody love me? :(",\ - "I want a man :(",\ - "Where has everyone gone?",\ - "I need a hug :(",\ - "Someone come hold me :(",\ - "I need someone on me :(",\ - "What happened? Where has everyone gone?",\ - "Forever alone :("\ - ) + handle_admin_logout() - send2adminchat("Server", "[cheesy_message] (No admins online)") QDEL_LIST_ASSOC_VAL(char_render_holders) SSambience.remove_ambience_client(src) @@ -1272,6 +1256,36 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( screen -= object +/// Handles any "fluff" or supplementary procedures related to an admin logout event. Should not have anything critically related cleaning up an admin's logout. +/client/proc/handle_admin_logout() + adminGreet(logout = TRUE) + if(length(GLOB.admins) > 0 || !SSticker.IsRoundInProgress()) // We only want to report this stuff if we are currently playing. + return + + var/list/message_to_send = list() + var/static/list/cheesy_messages = null + + if (isnull(cheesy_messages)) + cheesy_messages = list( + "Forever alone :(", + "I have no admins online!", + "I need a hug :(", + "I need someone on me :(", + "I want a man :(", + "I'm all alone :(", + "I'm feeling lonely :(", + "I'm so lonely :(", + "Someone come hold me :(", + "What happened? Where has everyone gone?", + "Where has everyone gone?", + "Why does nobody love me? :(", + ) + + message_to_send += pick(cheesy_messages) + message_to_send += "(No admins online)" + + send2adminchat("Server", jointext(message_to_send, " ")) + #undef ADMINSWARNED_AT #undef CURRENT_MINUTE #undef CURRENT_SECOND