From 0b23dab1f0a54b0805374ea8fa0f494a93e9d222 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 16 Jun 2019 20:54:09 +0200 Subject: [PATCH 1/9] Added the afk subsystem. Will automatically handle AFK players --- code/controllers/configuration.dm | 12 +++++++ code/controllers/subsystem/afk.dm | 59 +++++++++++++++++++++++++++++++ config/example/config.txt | 10 ++++++ paradise.dme | 1 + 4 files changed, 82 insertions(+) create mode 100644 code/controllers/subsystem/afk.dm diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 3f155fa8031..5792aff1725 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -72,6 +72,11 @@ var/assistantlimit = 0 //enables assistant limiting var/assistantratio = 2 //how many assistants to security members + // The AFK subsystem will not be activated if any of the below config values are equal or less than 0 + var/warn_afk_minimum = 0 // How long till you get a warning while being AFK + var/auto_cryo_afk = 0 // How long till you get put into cryo when you're AFK + var/auto_despawn_afk = 0 // How long till you actually despawn in cryo when you're AFK (Not ssd so not automatic) + var/auto_cryo_ssd_mins = 0 var/ssd_warning = 0 @@ -314,6 +319,13 @@ if("shadowling_max_age") config.shadowling_max_age = text2num(value) + if("warn_afk_minimum") + config.warn_afk_minimum = text2num(value) + if("auto_cryo_afk") + config.auto_cryo_afk = text2num(value) + if("auto_despawn_afk") + config.auto_despawn_afk = text2num(value) + if("auto_cryo_ssd_mins") config.auto_cryo_ssd_mins = text2num(value) if("ssd_warning") diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm new file mode 100644 index 00000000000..58562e344af --- /dev/null +++ b/code/controllers/subsystem/afk.dm @@ -0,0 +1,59 @@ +#define AFK_WARNED 1 +#define AFK_CRYOD 2 + +SUBSYSTEM_DEF(afk) + name = "AFK Watcher" + wait = 300 + flags = SS_BACKGROUND + var/list/afk_players = list() // Associative list. client as key and AFK state as value + + +/datum/controller/subsystem/afk/Initialize() + if(config.warn_afk_minimum <= 0 || config.auto_cryo_afk <= 0 || config.auto_despawn_afk <= 0) + flags |= SS_NO_FIRE + +/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) + continue + if(H.stat == DEAD && H.job) // No clientless or dead + if(afk_players[H.client]) + toRemove += H.client + continue + var/mins_afk = round(H.client.inactivity / 600) + if(mins_afk < config.warn_afk_minimum) + if(afk_players[H.client]) + toRemove += H.client + continue + if(!afk_players[H.client]) + 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 + + removeFromWatchList(toRemove) + +/datum/controller/subsystem/afk/proc/warn(mob/living/carbon/human/H, text) + to_chat(H, text) + SEND_SOUND(H, 'sound/effects/adminhelp.ogg') + if(H.client) + window_flash(H.client) + +/datum/controller/subsystem/afk/proc/removeFromWatchList(list/toRemove) + for(var/C in toRemove) + for(var/i in 1 to afk_players.len) + if(afk_players[i] == C) + afk_players.Cut(i, i + 1) + break + +#undef AFK_WARNED +#undef AFK_CRYOD \ No newline at end of file diff --git a/config/example/config.txt b/config/example/config.txt index 87ed0ce5cf1..89b8767feab 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -85,6 +85,16 @@ LOG_WORLD_OUTPUT ## log admin warning messages LOG_ADMINWARN + +## Amount of minutes that a person has to be AFK before he will be warned by the AFK subsystem. Leave this 0 to prevent the subsystem from activating +WARN_AFK_MINIMUM 0 + +## Amount of minutes that a person has to be AFK before he will be cryod by the AFK subsystem. Leave this 0 to prevent the subsystem from activating +AUTO_CRYO_AFK 0 + +## Amount of minutes that a person has to be AFK before he will be despawned by the AFK subsystem. Leave this 0 to prevent the subsystem from activating +AUTO_DESPAWN_AFK 0 + ## probablities for game modes chosen in "secret" and "random" modes ## ## default probablity is 1, increase to make that mode more likely to be picked diff --git a/paradise.dme b/paradise.dme index c49361b8e20..a060313e7eb 100644 --- a/paradise.dme +++ b/paradise.dme @@ -197,6 +197,7 @@ #include "code\controllers\master.dm" #include "code\controllers\subsystem.dm" #include "code\controllers\verbs.dm" +#include "code\controllers\subsystem\afk.dm" #include "code\controllers\subsystem\air.dm" #include "code\controllers\subsystem\alarm.dm" #include "code\controllers\subsystem\assets.dm" 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 2/9] 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]'"} ) From 8f4379925be8f42a9107594c9e6b592367e45348 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Mon, 17 Jun 2019 23:25:42 +0200 Subject: [PATCH 3/9] blacklist security, logging, Z level, antags blacklist, restrained/unconcious --- code/controllers/subsystem/afk.dm | 48 +++++++++++++++--------- code/game/area/Space Station 13 areas.dm | 2 + code/game/area/areas.dm | 1 + 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm index 1ce2c73290e..9ebcd733600 100644 --- a/code/controllers/subsystem/afk.dm +++ b/code/controllers/subsystem/afk.dm @@ -15,35 +15,45 @@ 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 || !H.client.prefs.afk_watch) // Only players and players with the AFK watch enabled + if(H.client == null || !H.client.prefs.afk_watch || !H.mind) // Only players and players with the AFK watch enabled continue - if(H.stat == DEAD || !H.job) // No dead or people without jobs + + var/turf/T = get_turf(H) + + if(H.stat || H.restrained() || !H.job || !is_station_level(T.z) || H.mind.special_role) // No dead, unconcious, restrained, people without jobs, people on other Z levels than the station or antags if(afk_players[H.client]) toRemove += H.client continue + var/mins_afk = round(H.client.inactivity / 600) if(mins_afk < config.warn_afk_minimum) if(afk_players[H.client]) toRemove += H.client continue + if(!afk_players[H.client]) 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) - 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() + else + var/area/A = T.loc // Turfs loc is the area + if(afk_players[H.client] == AFK_WARNED) + if(mins_afk >= config.auto_cryo_afk && A.can_get_auto_cryod) + 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.") + msg_admins(H, mins_afk, T, "forcefully despawned", "AFK in a fast despawn area") + force_cryo_human(H) + else if(cryo_ssd(H)) + afk_players[H.client] = AFK_CRYOD + msg_admins(H, mins_afk, T, "put into cryostorage") + 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 + msg_admins(H, mins_afk, T, "forcefully despawned") + warn(H, "You are have been despawned after being AFK for [mins_afk] minutes.") + toRemove += H.client + P.despawn_occupant() removeFromWatchList(toRemove) @@ -53,6 +63,10 @@ SUBSYSTEM_DEF(afk) if(H.client) window_flash(H.client) +/datum/controller/subsystem/afk/proc/msg_admins(mob/living/carbon/human/H, mins_afk, turf/location, action, info) + log_admin("[key_name(H)] has been [action] by the AFK Watcher subsystem after being AFK for [mins_afk] minutes.[info ? " Extra info:" + info : ""]") + message_admins("[key_name_admin(H)] at ([get_area(location).name] [ADMIN_JMP(location)]) has been [action] by the AFK Watcher subsystem after being AFK for [mins_afk] minutes.[info ? " Extra info:" + info : ""]") + /datum/controller/subsystem/afk/proc/removeFromWatchList(list/toRemove) for(var/C in toRemove) for(var/i in 1 to afk_players.len) diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 91af56437cf..681105aae01 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -1375,6 +1375,8 @@ var/list/ghostteleportlocs = list() icon_state = "medbay" //Security +/area/security + can_get_auto_cryod = FALSE /area/security/main name = "\improper Security Office" diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 638fe29ab6d..486dbdc8b55 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -64,6 +64,7 @@ 'sound/ambience/ambigen12.ogg','sound/ambience/ambigen14.ogg') var/fast_despawn = FALSE + var/can_get_auto_cryod = TRUE /area/Initialize(mapload) GLOB.all_areas += src From 6ea5b7c1a6b9108f8536446ce986faa38c7fa62f Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 23 Jun 2019 19:46:01 +0200 Subject: [PATCH 4/9] SQL definitions added. Small fixes --- SQL/paradise_schema.sql | 1 + SQL/paradise_schema_prefixed.sql | 1 + SQL/updates/5-6.sql | 3 +++ code/controllers/subsystem/afk.dm | 31 +++++++++++++++++-------------- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index e0f33226e8c..1ed8a81dcac 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -268,6 +268,7 @@ CREATE TABLE `player` ( `atklog` smallint(4) DEFAULT '0', `fuid` BIGINT(20) NULL DEFAULT NULL, `fupdate` SMALLINT(4) NULL DEFAULT 0, + `afk_watch` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) ) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1; diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index ecb28a867e4..e43cdab78cc 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -267,6 +267,7 @@ CREATE TABLE `SS13_player` ( `atklog` smallint(4) DEFAULT '0', `fuid` BIGINT(20) NULL DEFAULT NULL, `fupdate` SMALLINT(4) NULL DEFAULT 0, + `afk_watch` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) ) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1; diff --git a/SQL/updates/5-6.sql b/SQL/updates/5-6.sql index 91bf4328a2a..d5d17a51271 100644 --- a/SQL/updates/5-6.sql +++ b/SQL/updates/5-6.sql @@ -32,3 +32,6 @@ CREATE TABLE `oauth_tokens` ( #Drop the old 'discord' table that is not used anymore DROP TABLE `discord`; + +# Add afk_watch which gives users the option to make use of the AFK watcher subsystem +ALTER TABLE `player` ADD `afk_watch` tinyint(1) NOT NULL DEFAULT '0'; \ No newline at end of file diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm index 9ebcd733600..6a02a9f037f 100644 --- a/code/controllers/subsystem/afk.dm +++ b/code/controllers/subsystem/afk.dm @@ -15,36 +15,39 @@ 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 || !H.client.prefs.afk_watch || !H.mind) // Only players and players with the AFK watch enabled + if(!H.ckey) // Useless non ckey creatures continue - var/turf/T = get_turf(H) - - if(H.stat || H.restrained() || !H.job || !is_station_level(T.z) || H.mind.special_role) // No dead, unconcious, restrained, people without jobs, people on other Z levels than the station or antags - if(afk_players[H.client]) - toRemove += H.client + var/turf/T + // Only players and players with the AFK watch enabled + // No dead, unconcious, restrained, people without jobs, people on other Z levels than the station or antags + if(H.client == null || !H.client.prefs.afk_watch || !H.mind || \ + H.stat || H.restrained() || !H.job || H.mind.special_role || \ + !is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization + if(afk_players[H.ckey]) + toRemove += H.ckey continue var/mins_afk = round(H.client.inactivity / 600) if(mins_afk < config.warn_afk_minimum) - if(afk_players[H.client]) - toRemove += H.client + if(afk_players[H.ckey]) + toRemove += H.ckey continue - if(!afk_players[H.client]) - afk_players[H.client] = AFK_WARNED + if(!afk_players[H.ckey]) + afk_players[H.ckey] = 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 var/area/A = T.loc // Turfs loc is the area - if(afk_players[H.client] == AFK_WARNED) + if(afk_players[H.ckey] == AFK_WARNED) if(mins_afk >= config.auto_cryo_afk && A.can_get_auto_cryod) if(A.fast_despawn) - toRemove += H.client + toRemove += H.ckey 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.") msg_admins(H, mins_afk, T, "forcefully despawned", "AFK in a fast despawn area") force_cryo_human(H) else if(cryo_ssd(H)) - afk_players[H.client] = AFK_CRYOD + afk_players[H.ckey] = AFK_CRYOD msg_admins(H, mins_afk, T, "put into cryostorage") 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.") @@ -52,7 +55,7 @@ SUBSYSTEM_DEF(afk) var/obj/machinery/cryopod/P = H.loc msg_admins(H, mins_afk, T, "forcefully despawned") warn(H, "You are have been despawned after being AFK for [mins_afk] minutes.") - toRemove += H.client + toRemove += H.ckey P.despawn_occupant() removeFromWatchList(toRemove) From 579d2f995ffba6caea79464305b5b9a8d5796b0a Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 23 Jun 2019 19:47:46 +0200 Subject: [PATCH 5/9] ckey not client --- code/controllers/subsystem/afk.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm index 6a02a9f037f..f14eb72515e 100644 --- a/code/controllers/subsystem/afk.dm +++ b/code/controllers/subsystem/afk.dm @@ -5,7 +5,7 @@ SUBSYSTEM_DEF(afk) name = "AFK Watcher" wait = 300 flags = SS_BACKGROUND - var/list/afk_players = list() // Associative list. client as key and AFK state as value + var/list/afk_players = list() // Associative list. ckey as key and AFK state as value /datum/controller/subsystem/afk/Initialize() From f94fe59f1c1dc966c18fe9106f7eef9eeb3d82a3 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 23 Jun 2019 19:57:20 +0200 Subject: [PATCH 6/9] specify the rooms to be non cryo. Not brute force it --- code/game/area/Space Station 13 areas.dm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 681105aae01..7fe8696b325 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -1375,8 +1375,6 @@ var/list/ghostteleportlocs = list() icon_state = "medbay" //Security -/area/security - can_get_auto_cryod = FALSE /area/security/main name = "\improper Security Office" @@ -1402,10 +1400,12 @@ var/list/ghostteleportlocs = list() name = "\improper Prison Wing" icon_state = "sec_prison_perma" fast_despawn = TRUE + can_get_auto_cryod = FALSE /area/security/prison name = "\improper Prison Wing" icon_state = "sec_prison" + can_get_auto_cryod = FALSE /area/security/prison/prison_break() for(var/obj/structure/closet/secure_closet/brig/temp_closet in src) @@ -1434,14 +1434,17 @@ var/list/ghostteleportlocs = list() /area/security/execution name = "\improper Execution" icon_state = "execution" + can_get_auto_cryod = FALSE /area/security/processing name = "\improper Prisoner Processing" icon_state = "prisonerprocessing" + can_get_auto_cryod = FALSE /area/security/interrogation name = "\improper Interrogation" icon_state = "interrogation" + can_get_auto_cryod = FALSE /area/security/seceqstorage name = "\improper Security Equipment Storage" @@ -1458,6 +1461,7 @@ var/list/ghostteleportlocs = list() /area/security/interrogationobs name = "\improper Interrogation Observation" icon_state = "security" + can_get_auto_cryod = FALSE /area/security/evidence name = "\improper Evidence Room" @@ -1466,6 +1470,7 @@ var/list/ghostteleportlocs = list() /area/security/prisonlockers name = "\improper Prisoner Lockers" icon_state = "sec_prison_lockers" + can_get_auto_cryod = FALSE /area/security/medbay name = "\improper Security Medbay" @@ -1474,6 +1479,7 @@ var/list/ghostteleportlocs = list() /area/security/prisonershuttle name = "\improper Security Prisoner Shuttle" icon_state = "security" + can_get_auto_cryod = FALSE /area/security/warden name = "\improper Warden's Office" From 3de9216dafe213138f47d96f5b5d688f1a9f93ec Mon Sep 17 00:00:00 2001 From: farie82 Date: Sun, 30 Jun 2019 15:34:42 +0200 Subject: [PATCH 7/9] Update paradise.dme --- paradise.dme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paradise.dme b/paradise.dme index c67f02f8e91..adba2926d8d 100644 --- a/paradise.dme +++ b/paradise.dme @@ -2417,4 +2417,4 @@ #include "goon\code\datums\browserOutput.dm" #include "interface\interface.dm" #include "interface\skin.dmf" -// END_INCLUDE \ No newline at end of file +// END_INCLUDE From da047887f6264ea9cf0665578fa350098542192b Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Fri, 12 Jul 2019 16:41:04 +0200 Subject: [PATCH 8/9] DB update --- SQL/updates/5-6.sql | 3 --- SQL/updates/7-8.sql | 2 ++ config/example/dbconfig.txt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 SQL/updates/7-8.sql diff --git a/SQL/updates/5-6.sql b/SQL/updates/5-6.sql index d5d17a51271..91bf4328a2a 100644 --- a/SQL/updates/5-6.sql +++ b/SQL/updates/5-6.sql @@ -32,6 +32,3 @@ CREATE TABLE `oauth_tokens` ( #Drop the old 'discord' table that is not used anymore DROP TABLE `discord`; - -# Add afk_watch which gives users the option to make use of the AFK watcher subsystem -ALTER TABLE `player` ADD `afk_watch` tinyint(1) NOT NULL DEFAULT '0'; \ No newline at end of file diff --git a/SQL/updates/7-8.sql b/SQL/updates/7-8.sql new file mode 100644 index 00000000000..16bc90b7a50 --- /dev/null +++ b/SQL/updates/7-8.sql @@ -0,0 +1,2 @@ +# Add afk_watch which gives users the option to make use of the AFK watcher subsystem +ALTER TABLE `player` ADD `afk_watch` tinyint(1) NOT NULL DEFAULT '0'; diff --git a/config/example/dbconfig.txt b/config/example/dbconfig.txt index 8b411db15e1..2404119d52f 100644 --- a/config/example/dbconfig.txt +++ b/config/example/dbconfig.txt @@ -9,7 +9,7 @@ ## This value must be set to the version of the paradise schema in use. ## If this value does not match, the SQL database will not be loaded and an error will be generated. ## Roundstart will be delayed. -DB_VERSION 6 +DB_VERSION 8 ## Server the MySQL database can be found at. # Examples: localhost, 200.135.5.43, www.mysqldb.com, etc. From 6eb6c8ddba87c23fadf4fc00bd5dbd124c04695c Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 14 Jul 2019 13:05:59 +0200 Subject: [PATCH 9/9] SQL version change, coding semantic --- code/__DEFINES/misc.dm | 2 +- code/controllers/subsystem/afk.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 3418938d955..3610e6fb460 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -326,7 +326,7 @@ #define INVESTIGATE_BOMB "bombs" // The SQL version required by this version of the code -#define SQL_VERSION 6 +#define SQL_VERSION 8 // Vending machine stuff #define CAT_NORMAL 1 diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm index f14eb72515e..9f409fd35b4 100644 --- a/code/controllers/subsystem/afk.dm +++ b/code/controllers/subsystem/afk.dm @@ -21,7 +21,7 @@ SUBSYSTEM_DEF(afk) var/turf/T // Only players and players with the AFK watch enabled // No dead, unconcious, restrained, people without jobs, people on other Z levels than the station or antags - if(H.client == null || !H.client.prefs.afk_watch || !H.mind || \ + if(!H.client || !H.client.prefs.afk_watch || !H.mind || \ H.stat || H.restrained() || !H.job || H.mind.special_role || \ !is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization if(afk_players[H.ckey])