From a40ba70cd0fb415fa964a4e078ef07af312f1c05 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 16 Jun 2019 21:28:10 +0200 Subject: [PATCH] Added the preference option + smoll fix --- code/controllers/subsystem/afk.dm | 27 +++++++++++-------- code/modules/client/preference/preferences.dm | 5 ++++ .../client/preference/preferences_mysql.dm | 8 ++++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm index 58562e344af..1ce2c73290e 100644 --- a/code/controllers/subsystem/afk.dm +++ b/code/controllers/subsystem/afk.dm @@ -15,9 +15,9 @@ SUBSYSTEM_DEF(afk) /datum/controller/subsystem/afk/fire() var/list/toRemove = list() for(var/mob/living/carbon/human/H in GLOB.living_mob_list) - if(H.client == null) + if(H.client == null || !H.client.prefs.afk_watch) // Only players and players with the AFK watch enabled continue - if(H.stat == DEAD && H.job) // No clientless or dead + if(H.stat == DEAD || !H.job) // No dead or people without jobs if(afk_players[H.client]) toRemove += H.client continue @@ -30,15 +30,20 @@ SUBSYSTEM_DEF(afk) afk_players[H.client] = AFK_WARNED warn(H, "You are AFK for [mins_afk] minutes. You will be cryod after [config.auto_cryo_afk] total minutes and fully despawned after [config.auto_despawn_afk] total minutes. Please move or click in game if you want to avoid being despawned.") else if(afk_players[H.client] == AFK_WARNED) - if(mins_afk >= config.auto_cryo_afk && cryo_ssd(H)) - afk_players[H.client] = AFK_CRYOD - warn(H, "You are AFK for [mins_afk] minutes and have been moved to cryostorage. After being AFK for [config.auto_despawn_afk] total minutes you will be fully despawned. Please move out of cryostorage if you want to avoid being despawned.") - else - if(mins_afk >= config.auto_despawn_afk) - var/obj/machinery/cryopod/P = H.loc - warn(H, "You are have been despawned after being AFK for [mins_afk] minutes.") - P.despawn_occupant() - toRemove += H.client + var/area/A = get_area(H) + if(mins_afk >= config.auto_cryo_afk) + if(A.fast_despawn) + toRemove += H.client + warn(H, "You are have been despawned after being AFK for [mins_afk] minutes. You have been despawned instantly due to you being in a secure area.") + force_cryo_human(H) + else if(cryo_ssd(H)) + afk_players[H.client] = AFK_CRYOD + warn(H, "You are AFK for [mins_afk] minutes and have been moved to cryostorage. After being AFK for [config.auto_despawn_afk] total minutes you will be fully despawned. Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.") + else if(mins_afk >= config.auto_despawn_afk) + var/obj/machinery/cryopod/P = H.loc + warn(H, "You are have been despawned after being AFK for [mins_afk] minutes.") + toRemove += H.client + P.despawn_occupant() removeFromWatchList(toRemove) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 75e0f549a1d..6478f6b2c54 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -93,6 +93,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts var/clientfps = 0 var/atklog = ATKLOG_ALL var/fuid // forum userid + var/afk_watch = FALSE // If the player wants to be kept track of by the AFK system //ghostly preferences var/ghost_anonsay = 0 @@ -439,6 +440,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts dat += "

General Settings

" if(user.client.holder) dat += "Adminhelp sound: [(sound & SOUND_ADMINHELP)?"On":"Off"]
" + dat += "AFK Cryoing: [(afk_watch) ? "Yes" : "No"]
" dat += "Ambient Occlusion: [toggles & AMBIENT_OCCLUSION ? "Enabled" : "Disabled"]
" dat += "Attack Animations: [(show_ghostitem_attack) ? "Yes" : "No"]
" if(unlock_content) @@ -1976,6 +1978,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if("winflash") windowflashing = !windowflashing + if("afk_watch") + afk_watch = !afk_watch + if("UIcolor") var/UI_style_color_new = input(user, "Choose your UI color, dark colors are not recommended!", UI_style_color) as color|null if(!UI_style_color_new) return diff --git a/code/modules/client/preference/preferences_mysql.dm b/code/modules/client/preference/preferences_mysql.dm index 90a4bed6f14..235a806bcab 100644 --- a/code/modules/client/preference/preferences_mysql.dm +++ b/code/modules/client/preference/preferences_mysql.dm @@ -19,7 +19,8 @@ exp, clientfps, atklog, - fuid + fuid, + afk_watch FROM [format_table_name("player")] WHERE ckey='[C.ckey]'"} ) @@ -52,6 +53,7 @@ clientfps = text2num(query.item[17]) atklog = text2num(query.item[18]) fuid = text2num(query.item[19]) + afk_watch = text2num(query.item[20]) //Sanitize ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor)) @@ -72,6 +74,7 @@ clientfps = sanitize_integer(clientfps, 0, 1000, initial(clientfps)) atklog = sanitize_integer(atklog, 0, 100, initial(atklog)) fuid = sanitize_integer(fuid, 0, 10000000, initial(fuid)) + afk_watch = sanitize_integer(afk_watch, 0, 1, initial(afk_watch)) return 1 /datum/preferences/proc/save_preferences(client/C) @@ -101,7 +104,8 @@ windowflashing='[windowflashing]', ghost_anonsay='[ghost_anonsay]', clientfps='[clientfps]', - atklog='[atklog]' + atklog='[atklog]', + afk_watch='[afk_watch]' WHERE ckey='[C.ckey]'"} )