diff --git a/code/datums/configuration.dm b/code/datums/configuration.dm index 6ad707b32f9..a2236f93cb0 100644 --- a/code/datums/configuration.dm +++ b/code/datums/configuration.dm @@ -35,6 +35,7 @@ var/hostedby = null var/respawn = 1 var/guest_jobban = 1 + var/usewhitelist = 0 var/kick_inactive = 0 //force disconnect for inactive players var/server @@ -178,6 +179,9 @@ if ("guest_jobban") config.guest_jobban = text2num(value) + if ("usewhitelist") + config.usewhitelist = 1 + if ("dont_del_newmob") config.del_new_on_log = 0 diff --git a/code/game/cellautomata.dm b/code/game/cellautomata.dm index 6a56e220fe7..08a3b1fecfc 100644 --- a/code/game/cellautomata.dm +++ b/code/game/cellautomata.dm @@ -80,7 +80,8 @@ src.load_motd() src.load_rules() src.load_admins() - + if (config.usewhitelist) + load_whitelist() src.update_status() makepowernets() diff --git a/code/game/jobs/jobs.dm b/code/game/jobs/jobs.dm index e39486a7fbc..5907bfc97b8 100644 --- a/code/game/jobs/jobs.dm +++ b/code/game/jobs/jobs.dm @@ -31,3 +31,15 @@ var/list/occupations = list( var/list/assistant_occupations = list( "Assistant") + +var/list/head_positions = list( + "Captain", + "Head of Personnel", + "Head of Security", + "Chief Engineer", + "Research Director", + "Chief Medical Officer", +) + +/proc/is_important_job(var/job) + return (job in head_positions) || (job in list("AI", "Cyborg", "Warden", "Detective")) diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm new file mode 100644 index 00000000000..e81d925bb0c --- /dev/null +++ b/code/game/jobs/whitelist.dm @@ -0,0 +1,16 @@ +var/list/whitelist + +#define WHITELISTFILE "data/whitelist.txt" +/proc/load_whitelist() + var/text = file2text(WHITELISTFILE) + if (!text) + diary << "Failed to [WHITELISTFILE]\n" + else + whitelist = dd_text2list(text, "\n") + +/proc/check_whitelist(mob/M /*, var/rank*/) + if(!whitelist) + return 0 + return ("[M.ckey]" in whitelist) + +#undef WHITELISTFILE \ No newline at end of file diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index cb4db232b73..cee59c8893e 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -9,8 +9,10 @@ var /proc/jobban_isbanned(mob/M, rank) if(M) - if (rank == "Captain" || rank == "AI" || rank == "Head of Personnel" || rank == "Head of Security" || rank == "Chief Engineer" || rank == "Research Director" || rank == "Warden" || rank == "Detective" || rank == "Chief Medical Officer") - if(IsGuestKey(M.key)/* && config.guest_jobban*/) + if (is_important_job(rank)) + if(config.guest_jobban && IsGuestKey(M.key)) + return 1 + if(config.usewhitelist && check_whitelist(M)) return 1 if (jobban_keylist.Find(text("[M.ckey] - [rank]"))) return 1 diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index da7df7ee24a..8f9ad4c9732 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -1,5 +1,7 @@ /mob/Logout() log_access("Logout: [key_name(src)]") + if (admins[src.ckey]) + message_admins("Admin logout: [key_name(src)]") src.logged_in = 0 ..() diff --git a/config/config.txt b/config/config.txt index f290dfd7fc4..28f9b089fd5 100644 --- a/config/config.txt +++ b/config/config.txt @@ -1,35 +1,35 @@ -# log OOC channel +## log OOC channel LOG_OOC -# log client Say +## log client Say LOG_SAY -# log admin actions +## log admin actions LOG_ADMIN -# log client access (logon/logoff) +## log client access (logon/logoff) LOG_ACCESS -# log game actions (start of round, results, etc.) +## log game actions (start of round, results, etc.) LOG_GAME -# log player votes +## log player votes LOG_VOTE -# log client Whisper +## log client Whisper LOG_WHISPER -# sql switching +## sql switching # SQL_ENABLED -#disconnect players who did nothing during 10 minutes +## disconnect players who did nothing during 10 minutes # KICK_INACTIVE -# probablities for game modes chosen in "secret" and "random" modes -# -# default probablity is 1, increase to make that mode more likely to be picked -# set to 0 to disable that mode -# Cult mode is in alpha test, enable at your own risk +## probablities for game modes chosen in "secret" and "random" modes +## +## default probablity is 1, increase to make that mode more likely to be picked +## set to 0 to disable that mode +## Cult mode is in alpha test, enable at your own risk PROBABILITY EXTENDED 0 PROBABILITY TRAITOR 8 PROBABILITY METEOR 0 @@ -44,53 +44,56 @@ PROBABILITY CHANGELING 2 PROBABILITY CULT 0 PROBABILITY MONKEY 0 -# if amount of traitors scales or not +## if amount of traitors scales or not #TRAITOR_SCALING -# allow players to initiate a restart vote +## allow players to initiate a restart vote ALLOW_VOTE_RESTART -# allow players to initate a mode-change start +## allow players to initate a mode-change start ALLOW_VOTE_MODE -# min delay (seconds) between voting sessions (default 10 minutes) +## min delay (seconds) between voting sessions (default 10 minutes) VOTE_DELAY 600 -# time period (seconds) which voting session will last (default 1 minute) +## time period (seconds) which voting session will last (default 1 minute) VOTE_PERIOD 60 -# prevents dead players from voting or starting votes +## prevents dead players from voting or starting votes # NO_DEAD_VOTE -# players' votes default to "No vote" (otherwise, default to "No change") +## players' votes default to "No vote" (otherwise, default to "No change") # DEFAULT_NO_VOTE -# allow AI job +## allow AI job ALLOW_AI -# goon authentication +## goon authentication #AUTHENTICATION -# disable abandon mob +## disable abandon mob NORESPAWN -#disables calling del(src) on newmobs if they logout before spawnin in -#DONT_DEL_NEWMOB +## disables calling del(src) on newmobs if they logout before spawnin in +# DONT_DEL_NEWMOB -# set a hosted by name for unix platforms +## set a hosted by name for unix platforms HOSTEDBY Yournamehere -# Set to jobban "Guest-" accounts from Captain, HoS, HoP, CE, RD, CMO, Warden, Security, Detective, and AI positions. -# Set to 1 to jobban them from those positions, set to 0 to allow them. +## Set to jobban "Guest-" accounts from Captain, HoS, HoP, CE, RD, CMO, Warden, Security, Detective, and AI positions. +## Set to 1 to jobban them from those positions, set to 0 to allow them. GUEST_JOBBAN 1 -# set a server location for world reboot. Don't include the byond://, just give the address and port. +## Set to jobban everyone who's key is not listed in data/whitelist.txt from Captain, HoS, HoP, CE, RD, CMO, Warden, Security, Detective, and AI positions. +## Uncomment to 1 to jobban, leave commented out to allow these positions for everyone (but see GUEST_JOBBAN above and regular jobbans) +# USEWHITELIST + +## set a server location for world reboot. Don't include the byond://, just give the address and port. # SERVER ss13.example.com:2506 -#Ban appeals URL - usually for a forum or wherever people should go to contact your admins. -#BANAPPEALS http://justanotherday.example.com - -#In-game features -#spawns a spellbook which gives object-type spells instead of verb-type spells for the wizard -#FEATURE_OBJECT_SPELL_SYSTEM +## Ban appeals URL - usually for a forum or wherever people should go to contact your admins. +# BANAPPEALS http://justanotherday.example.com +## In-game features +## spawns a spellbook which gives object-type spells instead of verb-type spells for the wizard +# FEATURE_OBJECT_SPELL_SYSTEM diff --git a/tgstation.dme b/tgstation.dme index 10031b31dd3..2f784f9d69f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -347,6 +347,7 @@ #include "code\game\jobs\access.dm" #include "code\game\jobs\jobprocs.dm" #include "code\game\jobs\jobs.dm" +#include "code\game\jobs\whitelist.dm" #include "code\game\machinery\ai_slipper.dm" #include "code\game\machinery\airlock_control.dm" #include "code\game\machinery\alarm.dm"