diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index 4162607d7c4..316330eca41 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -270,6 +270,7 @@ CREATE TABLE `player` ( `fupdate` smallint(4) NULL DEFAULT '0', `AFK_WATCH_warn_minutes` tinyint(2) NOT NULL DEFAULT '0', `AFK_WATCH_cryo_minutes` tinyint(1) NOT NULL DEFAULT '0', + 'AFK_WATCH_antag' tinyint(1) NOT NULL DEFAULT '0', `parallax` tinyint(1) DEFAULT '8', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index af36f520cd9..94d34935d99 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -269,6 +269,7 @@ CREATE TABLE `SS13_player` ( `fupdate` smallint(4) NULL DEFAULT '0', `AFK_WATCH_warn_minutes` tinyint(2) NOT NULL DEFAULT '0', `AFK_WATCH_cryo_minutes` tinyint(1) NOT NULL DEFAULT '0', + 'AFK_WATCH_antag' tinyint(1) NOT NULL DEFAULT '0', `parallax` tinyint(1) DEFAULT '8', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) diff --git a/SQL/updates/9-10.sql b/SQL/updates/9-10.sql index cb2c9c79279..88e3ebda2b5 100644 --- a/SQL/updates/9-10.sql +++ b/SQL/updates/9-10.sql @@ -1,6 +1,7 @@ -# Change afk_watch to AFK_WATCH_warn_minutes and AFK_WATCH_cryo_minutes which gives users the option to make use of the AFK watcher subsystem +# Change afk_watch to AFK_WATCH_warn_minutes, AFK_WATCH_cryo_minutes and AFK_WATCH_antag which gives users the option to make use of the AFK watcher subsystem ALTER TABLE `player` ADD `AFK_WATCH_warn_minutes` tinyint(1) NOT NULL DEFAULT '0' AFTER `afk_watch`; UPDATE `player` SET `AFK_WATCH_warn_minutes` = 5 WHERE `afk_watch` = 1; ALTER TABLE `player` ADD `AFK_WATCH_cryo_minutes` tinyint(1) NOT NULL DEFAULT '0' AFTER `AFK_WATCH_warn_minutes`; UPDATE `player` SET `AFK_WATCH_cryo_minutes` = 2 WHERE `afk_watch` = 1; +ALTER TABLE `player` ADD `AFK_WATCH_antag` tinyint(1) NOT NULL DEFAULT '0' AFTER `AFK_WATCH_cryo_minutes`; ALTER TABLE `player` DROP COLUMN `afk_watch`; \ No newline at end of file diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 497bcefd4f4..4a60f8d7438 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -72,7 +72,7 @@ var/assistantlimit = 0 //enables assistant limiting var/assistantratio = 2 //how many assistants to security members - // The AFK subsystem will not be activated if the below config values are equal or less than 0 + // The AFK subsystem will not be activated if the below config value is equal or less than 0 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 diff --git a/code/controllers/subsystem/afk.dm b/code/controllers/subsystem/afk.dm index 4a092f3fed4..94e2de34b2a 100644 --- a/code/controllers/subsystem/afk.dm +++ b/code/controllers/subsystem/afk.dm @@ -21,9 +21,9 @@ SUBSYSTEM_DEF(afk) var/turf/T var/afk_warn_min // 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 + // No dead, unconcious, restrained, people without jobs, people on other Z levels than the station or antags (if they have the preference option off) if(!H.client || !(afk_warn_min = H.client.prefs.AFK_WATCH_warn_minutes) || !H.mind || \ - H.stat || H.restrained() || !H.job || H.mind.special_role || \ + H.stat || H.restrained() || !H.job || (H.mind.special_role && !H.client.prefs.AFK_WATCH_antag) || \ !is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization if(afk_players[H.ckey]) toRemove += H.ckey diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 0eb93a7404b..6559a808c41 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -95,6 +95,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts var/fuid // forum userid var/AFK_WATCH_warn_minutes = 0 // Number of minutes after which the player gets warned var/AFK_WATCH_cryo_minutes = 0 // Number of minutes after (after the warning) which the player gets cryod + var/AFK_WATCH_antag = FALSE // If you will cryo when you have a special role //ghostly preferences var/ghost_anonsay = 0 @@ -443,7 +444,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_warn_minutes) ? "On ([AFK_WATCH_warn_minutes], [AFK_WATCH_cryo_minutes])" : "Off"]
" + dat += "AFK Cryoing: [(AFK_WATCH_warn_minutes) ? "On ([AFK_WATCH_warn_minutes], [AFK_WATCH_cryo_minutes], [AFK_WATCH_antag ? "Y" : "N"])" : "Off"]
" dat += "Ambient Occlusion: [toggles & AMBIENT_OCCLUSION ? "Enabled" : "Disabled"]
" dat += "Attack Animations: [(show_ghostitem_attack) ? "Yes" : "No"]
" @@ -2007,14 +2008,17 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts // deactivate the system AFK_WATCH_warn_minutes = 0 AFK_WATCH_cryo_minutes = 0 + AFK_WATCH_antag = FALSE else if(!afk_new | !(afk_new <= 10 && afk_new >= 1)) return AFK_WATCH_warn_minutes = afk_new afk_new = input(user, "Select a new amount of minutes after which you get cryod for being AFK, between 1 and 5", UI_style_alpha) as num if(!afk_new | !(afk_new <= 5 && afk_new >= 1)) AFK_WATCH_cryo_minutes = AFK_WATCH_cryo_minutes ? AFK_WATCH_cryo_minutes : 2 // Return to prior value or default to 2 + AFK_WATCH_antag = AFK_WATCH_antag ? AFK_WATCH_antag : FALSE else AFK_WATCH_cryo_minutes = afk_new + AFK_WATCH_antag = alert(user, "Do you want to activate the AFK system when you have a special status? (Think of antag, mindslaved, ERT etc)", "Antag activation", "Yes", "No") == "Yes" if("UIcolor") var/UI_style_color_new = input(user, "Choose your UI color, dark colors are not recommended!", UI_style_color) as color|null diff --git a/code/modules/client/preference/preferences_mysql.dm b/code/modules/client/preference/preferences_mysql.dm index 20fe3514c8d..14055980620 100644 --- a/code/modules/client/preference/preferences_mysql.dm +++ b/code/modules/client/preference/preferences_mysql.dm @@ -22,6 +22,7 @@ fuid, AFK_WATCH_warn_minutes, AFK_WATCH_cryo_minutes, + AFK_WATCH_antag, parallax FROM [format_table_name("player")] WHERE ckey='[C.ckey]'"} @@ -57,7 +58,8 @@ fuid = text2num(query.item[19]) AFK_WATCH_warn_minutes = text2num(query.item[20]) AFK_WATCH_cryo_minutes = text2num(query.item[21]) - parallax = text2num(query.item[22]) + AFK_WATCH_antag = text2num(query.item[22]) + parallax = text2num(query.item[23]) //Sanitize ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor)) @@ -80,6 +82,7 @@ fuid = sanitize_integer(fuid, 0, 10000000, initial(fuid)) AFK_WATCH_warn_minutes = sanitize_integer(AFK_WATCH_warn_minutes, 0, 10, initial(AFK_WATCH_warn_minutes)) AFK_WATCH_cryo_minutes = sanitize_integer(AFK_WATCH_cryo_minutes, 0, 5, initial(AFK_WATCH_cryo_minutes)) + AFK_WATCH_antag = sanitize_integer(AFK_WATCH_antag, 0, 1, initial(AFK_WATCH_antag)) parallax = sanitize_integer(parallax, 0, 16, initial(parallax)) return 1 @@ -113,6 +116,7 @@ atklog='[atklog]', AFK_WATCH_warn_minutes='[AFK_WATCH_warn_minutes]', AFK_WATCH_cryo_minutes='[AFK_WATCH_cryo_minutes]', + AFK_WATCH_antag='[AFK_WATCH_antag]', parallax='[parallax]' WHERE ckey='[C.ckey]'"} )