diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 989d52052d1..0adc4ab8ac3 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -300,7 +300,7 @@ var/global/datum/controller/gameticker/ticker if(!delay_end) sleep(restart_timeout) - kick_clients_in_lobby("\red The round came to an end with you in the lobby.") + kick_clients_in_lobby("\red The round came to an end with you in the lobby.", 1) //second parameter ensures only afk clients are kicked world.Reboot() else world << "\blue An admin has delayed the round end" diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index 2e63e3ad9a0..6573b732c30 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -221,7 +221,7 @@ var/bomb_set blackbox.save_all_data_to_sql() sleep(300) log_game("Rebooting due to nuclear detonation") - kick_clients_in_lobby("\red The round came to an end with you in the lobby.") + kick_clients_in_lobby("\red The round came to an end with you in the lobby.", 1) //second parameter ensures only afk clients are kicked world.Reboot() return return diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index fa2296f84b2..d2d469670ae 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -842,10 +842,17 @@ proc/move_ferry() else ferry_location = 1 - -proc/kick_clients_in_lobby(var/message) +//Kicks all the clients currently in the lobby. The second parameter (kick_only_afk) determins if an is_afk() check is ran, or if all clients are kicked +//defaults to kicking everyone (afk + non afk clients in the lobby) +//returns a list of ckeys of the kicked clients +proc/kick_clients_in_lobby(var/message, var/kick_only_afk = 0) + var/list/kicked_client_names = list() for(var/client/C in clients) if(istype(C.mob, /mob/new_player)) + if(kick_only_afk && !C.is_afk()) //Ignore clients who are not afk + continue if(message) C << message - del(C) \ No newline at end of file + kicked_client_names.Add("[C.ckey]") + del(C) + return kicked_client_names \ No newline at end of file diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 20cacf25400..78f2c1d9ee0 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -194,7 +194,7 @@ Player panel
- Hover over a line to see more information - Check antagonists - Kick everyone in lobby + Hover over a line to see more information - Check antagonists - Kick everyone/AFKers in lobby

diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index a24e3473fd2..660b4b685b5 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2063,9 +2063,16 @@ check_antagonists() if("kick_all_from_lobby") if(ticker && ticker.current_state == GAME_STATE_PLAYING) - message_admins("[key_name_admin(usr)] has kicked all clients from the lobby.", 1) - log_admin("[key_name(usr)] has kicked all clients from the lobby.") - kick_clients_in_lobby("\red The admin [usr.ckey] issued a 'kick all clients from lobby' command.") + var/afkonly = text2num(href_list["afkonly"]) + if(alert("Are you sure you want to kick all [afkonly ? "AFK" : ""] clients from the lobby??","Message","Yes","Cancel") != "Yes") + usr << "Kick clients from lobby aborted" + return + var/list/listkicked = kick_clients_in_lobby("\red The admin [usr.ckey] issued a 'kick all clients from lobby' command.", afkonly) + var/strkicked = "" + for(var/name in listkicked) + strkicked += "[name], " + message_admins("[key_name_admin(usr)] has kicked [afkonly ? "all AFK" : "all"] clients from the lobby. [length(listkicked)] clients kicked: [strkicked ? strkicked : "--"]", 1) + log_admin("[key_name_admin(usr)] has kicked [afkonly ? "all AFK" : "all"] clients from the lobby. [length(listkicked)] clients kicked: [strkicked ? strkicked : "--"]") else usr << "You may only use this when the game is running" if("showailaws")