diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index d37dc31f8d5..2bb9526117d 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -434,6 +434,8 @@ proc/display_roundstart_logout_report() if(L.stat) if(L.suiciding) //Suicider msg += "[L.name] ([L.ckey]), the [L.job] (Suicide)\n" + job_master.FreeRole(L.job) + message_admins("[L.name] ([L.ckey]), the [L.job] has been freed due to (Early Round Suicide)\n") continue //Disconnected client if(L.stat == UNCONSCIOUS) msg += "[L.name] ([L.ckey]), the [L.job] (Dying)\n" @@ -458,6 +460,8 @@ proc/display_roundstart_logout_report() continue //Lolwhat else msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Ghosted)\n" + job_master.FreeRole(L.job) + message_admins("[L.name] ([L.ckey]), the [L.job] has been freed due to (Early Round Ghosted While Alive)\n") continue //Ghosted while alive diff --git a/code/world.dm b/code/world.dm index 9195876959a..5e928391f1b 100644 --- a/code/world.dm +++ b/code/world.dm @@ -183,6 +183,31 @@ del(C) #undef INACTIVITY_KICK +#define DISCONNECTED_DELETE 3000 //5 minutes in ticks (approx) +/world/proc/KickDisconnectedClients() + spawn(-1) + set background = 1 + while(1) + sleep(DISCONNECTED_DELETE) + for(var/mob/living/L in mob_list) + if(iscarbon(L) && !ismonkey(L) && !isslime(L)) + var/mob/living/carbon/C = L + if(!C.client && C.stat != DEAD && C.brain_op_stage!=4.0) + sleep(600) + if(!C.client && C.stat != DEAD && C.brain_op_stage!=4.0) + job_master.FreeRole(C.job) + message_admins("[C.name] ([C.ckey]), the [C.job] has been freed due to (Client disconnect for 5 minutes)\n") + for(var/obj/item/W in C) + C.drop_from_inventory(W) + del(C) + else if(!C.key && C.stat != DEAD && C.brain_op_stage!=4.0) + job_master.FreeRole(C.job) + message_admins("[C.name] ([C.ckey]), the [C.job] has been freed due to (Client quit BYOND)\n") + for(var/obj/item/W in C) + C.drop_from_inventory(W) + del(C) +#undef DISCONNECTED_DELETE + /world/proc/load_mode() var/list/Lines = file2list("data/mode.txt")