From a28d3cd9d164170c5db82ad1438b913982281248 Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Thu, 9 Jul 2015 12:10:18 -0700 Subject: [PATCH 1/8] Added new config variables for toggling moderator tempban permissions and maximum duration for bans. --- code/controllers/configuration.dm | 28 ++++++++++++++++++++++++---- code/game/verbs/who.dm | 28 +++++++++++++++++++++++++++- code/world.dm | 22 +++++++++++++++++++++- config/example/config.txt | 21 +++++++++++++++++---- config/example/mentors.txt | 0 5 files changed, 89 insertions(+), 10 deletions(-) create mode 100644 config/example/mentors.txt diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 215e816f76e..28474518c35 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -60,8 +60,13 @@ var/respawn = 1 var/guest_jobban = 1 var/usewhitelist = 0 - var/mods_are_mentors = 0 var/kick_inactive = 0 //force disconnect for inactive players + var/show_mods + var/show_mentors + var/mods_can_tempban + var/mods_can_job_tempban + var/mod_tempban_max = 1440 + var/mod_job_tempban_max = 1440 var/load_jobs_from_txt = 0 var/ToRban = 0 var/automute_on = 0 //enables automuting/spam prevention @@ -301,9 +306,6 @@ if ("log_runtime") config.log_runtime = 1 - if ("mentors") - config.mods_are_mentors = 1 - if("allow_admin_ooccolor") config.allow_admin_ooccolor = 1 @@ -451,6 +453,24 @@ if("kick_inactive") config.kick_inactive = 1 + if("show_mods") + config.show_mods = 1 + + if("show_mentors") + config.show_mentors = 1 + + if("mods_can_tempban") + config.mods_can_tempban = 1 + + if("mods_can_job_tempban") + config.mods_can_job_tempban = 1 + + if("mod_tempban_max") + config.mod_tempban_max = text2num(value) + + if("mod_job_tempban_max") + config.mod_job_tempban_max = text2num(value) + if("load_jobs_from_txt") load_jobs_from_txt = 1 diff --git a/code/game/verbs/who.dm b/code/game/verbs/who.dm index d877001fad3..69b31733c07 100644 --- a/code/game/verbs/who.dm +++ b/code/game/verbs/who.dm @@ -48,8 +48,10 @@ var/msg = "" var/modmsg = "" + var/mentmsg = "" var/num_mods_online = 0 var/num_admins_online = 0 + var/num_mentors_online = 0 if(holder) for(var/client/C in admins) if(R_ADMIN & C.holder.rights || (!R_MOD & C.holder.rights && !R_MENTOR & C.holder.rights)) //Used to determine who shows up in admin rows @@ -89,6 +91,20 @@ modmsg += "\n" num_mods_online++ + else if(R_MENTOR & C.holder.rights) + mentmsg += "\t[C] is a [C.holder.rank]" + if(isobserver(C.mob)) + mentmsg += " - Observing" + else if(istype(C.mob,/mob/new_player)) + mentmsg += " - Lobby" + else + mentmsg += " - Playing" + + if(C.is_afk()) + mentmsg += " (AFK)" + mentmsg += "\n" + num_mentors_online++ + else for(var/client/C in admins) if(R_ADMIN & C.holder.rights || (!R_MOD & C.holder.rights && !R_MENTOR & C.holder.rights)) @@ -98,8 +114,18 @@ else if (R_MOD & C.holder.rights || R_MENTOR & C.holder.rights) modmsg += "\t[C] is a [C.holder.rank]\n" num_mods_online++ + else if (R_MENTOR & C.holder.rights) + mentmsg += "\t[C] is a [C.holder.rank]\n" + num_mentors_online++ + if(config.admin_irc) src << "Adminhelps are also sent to IRC. If no admins are available in game try anyway and an admin on IRC may see it and respond." - msg = "Current Admins ([num_admins_online]):\n" + msg + "\n Current [config.mods_are_mentors ? "Mentors" : "Moderators"]([num_mods_online]):\n" + modmsg + msg = "Current Admins ([num_admins_online]):\n" + msg + + if(config.show_mods) + msg += "\n Current Moderators ([num_mods_online]):\n" + modmsg + + if(config.show_mentors) + msg += "\n Current Mentors ([num_mentors_online]):\n" + mentmsg src << msg diff --git a/code/world.dm b/code/world.dm index f67d6711ac7..8737f69b0dc 100644 --- a/code/world.dm +++ b/code/world.dm @@ -284,6 +284,7 @@ var/world_topic_spam_protect_time = world.timeofday /hook/startup/proc/loadMods() world.load_mods() + world.load_mentors() // no need to write another hook. return 1 /world/proc/load_mods() @@ -301,7 +302,26 @@ var/world_topic_spam_protect_time = world.timeofday continue var/title = "Moderator" - if(config.mods_are_mentors) title = "Mentor" + var/rights = admin_ranks[title] + + var/ckey = copytext(line, 1, length(line)+1) + var/datum/admins/D = new /datum/admins(title, rights, ckey) + D.associate(directory[ckey]) + +/world/proc/load_mentors() + if(config.admin_legacy_system) + var/text = file2text("config/mentors.txt") + if (!text) + error("Failed to load config/mentors.txt") + else + var/list/lines = text2list(text, "\n") + for(var/line in lines) + if (!line) + continue + if (copytext(line, 1, 2) == ";") + continue + + var/title = "Mentor" var/rights = admin_ranks[title] var/ckey = copytext(line, 1, length(line)+1) diff --git a/config/example/config.txt b/config/example/config.txt index 364f4fc6643..382dab74ac0 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -73,10 +73,23 @@ LOG_PDA ## disconnect players who did nothing during 10 minutes # KICK_INACTIVE -## Use Mentors instead of Moderators. Mentors are designed with the idea that -###they help in pushing new people to be better at roleplay. If you uncomment -###this it will reduce the rights that your mods have. -#MENTORS +##Show mods on staffwho +SHOW_MODS + +##Show mentors on staffwho +SHOW_MENTORS + +## Chooses whether mods have the ability to tempban or not +MODS_CAN_TEMPBAN + +## Chooses whether mods have the ability to issue tempbans for jobs or not +MODS_CAN_JOB_TEMPBAN + +## Maximum mod tempban duration (in minutes) +MOD_TEMPBAN_MAX 1440 + +## Maximum mod job tempban duration (in minutes) +MOD_JOB_TEMPBAN_MAX 1440 ## probablities for game modes chosen in "secret" and "random" modes diff --git a/config/example/mentors.txt b/config/example/mentors.txt new file mode 100644 index 00000000000..e69de29bb2d From 909798a8efd5543765ba53dd4305fc38109bb732 Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Thu, 9 Jul 2015 12:11:27 -0700 Subject: [PATCH 2/8] Actual implementation of mod_can_(job_)tempban and mod_(job_)tempban_max --- code/modules/admin/topic.dm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 564188ac18c..bbc7339715c 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -662,6 +662,10 @@ else if(href_list["jobban3"]) if(!check_rights(R_MOD,0) && !check_rights(R_ADMIN)) return + if(check_rights(R_MOD,0) && !check_rights(R_ADMIN) && !config.mods_can_job_tempban) // If mod and tempban disabled + usr << "\red mod jobbanning is disabled!" + return + var/mob/M = locate(href_list["jobban4"]) if(!ismob(M)) usr << "This can only be used on instances of type /mob" @@ -742,6 +746,8 @@ var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null if(!mins) return + if(check_rights(R_MOD, 0) && !check_rights(R_BAN) && mins > config.mod_job_tempban_max) + usr << "\red Moderators can only job tempban up to [config.mod_job_tempban_max] minutes!" var/reason = input(usr,"Reason?","Please State Reason","") as text|null if(!reason) return @@ -862,6 +868,9 @@ var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null if(!mins) return + if(check_rights(R_MOD, 0) && !check_rights(R_BAN) && mins > config.mod_tempban_max) + usr << "\red Moderators can only job tempban up to [config.mod_tempban_max] minutes!" + return if(mins >= 525600) mins = 525599 var/reason = input(usr,"Reason?","reason","Griefer") as text|null if(!reason) From 55ef56e36eea38394750a012583d672e7c340626 Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Thu, 9 Jul 2015 12:13:40 -0700 Subject: [PATCH 3/8] mentors.txt needed instructions. --- config/example/mentors.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/example/mentors.txt b/config/example/mentors.txt index e69de29bb2d..afc3e8c920d 100644 --- a/config/example/mentors.txt +++ b/config/example/mentors.txt @@ -0,0 +1,3 @@ +; just add the ckey (lowercase) of every mentor on a separate line +; lines starting with ; are comments and will be ignored + From dcaa8289a10075ca098d8ebe2407939ebc3a0f1c Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Thu, 9 Jul 2015 12:26:11 -0700 Subject: [PATCH 4/8] Fix for missed if(A | B) else if (b) check. --- code/game/verbs/who.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/verbs/who.dm b/code/game/verbs/who.dm index 69b31733c07..e5655caaeab 100644 --- a/code/game/verbs/who.dm +++ b/code/game/verbs/who.dm @@ -76,7 +76,7 @@ msg += "\n" num_admins_online++ - else if(R_MOD & C.holder.rights || R_MENTOR & C.holder.rights) //Who shows up in mod/mentor rows. + else if(R_MOD & C.holder.rights) //Who shows up in mod/mentor rows. modmsg += "\t[C] is a [C.holder.rank]" if(isobserver(C.mob)) @@ -111,7 +111,7 @@ if(!C.holder.fakekey) msg += "\t[C] is a [C.holder.rank]\n" num_admins_online++ - else if (R_MOD & C.holder.rights || R_MENTOR & C.holder.rights) + else if (R_MOD & C.holder.rights) modmsg += "\t[C] is a [C.holder.rank]\n" num_mods_online++ else if (R_MENTOR & C.holder.rights) From 87c8be10dd38ea127200441f490150197fe8f15a Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Thu, 9 Jul 2015 12:26:32 -0700 Subject: [PATCH 5/8] spans and grammar for topic.dm --- code/modules/admin/topic.dm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index bbc7339715c..52792aa926a 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -663,7 +663,7 @@ if(!check_rights(R_MOD,0) && !check_rights(R_ADMIN)) return if(check_rights(R_MOD,0) && !check_rights(R_ADMIN) && !config.mods_can_job_tempban) // If mod and tempban disabled - usr << "\red mod jobbanning is disabled!" + usr << "Mod jobbanning is disabled!" return var/mob/M = locate(href_list["jobban4"]) @@ -747,7 +747,7 @@ if(!mins) return if(check_rights(R_MOD, 0) && !check_rights(R_BAN) && mins > config.mod_job_tempban_max) - usr << "\red Moderators can only job tempban up to [config.mod_job_tempban_max] minutes!" + usr << " Moderators can only job tempban up to [config.mod_job_tempban_max] minutes!" var/reason = input(usr,"Reason?","Please State Reason","") as text|null if(!reason) return @@ -858,6 +858,10 @@ else if(href_list["newban"]) if(!check_rights(R_MOD,0) && !check_rights(R_BAN)) return + if(check_rights(R_MOD,0) && !check_rights(R_ADMIN) && !config.mods_can_job_tempban) // If mod and tempban disabled + usr << "Mod jobbanning is disabled!" + return + var/mob/M = locate(href_list["newban"]) if(!ismob(M)) return @@ -869,7 +873,7 @@ if(!mins) return if(check_rights(R_MOD, 0) && !check_rights(R_BAN) && mins > config.mod_tempban_max) - usr << "\red Moderators can only job tempban up to [config.mod_tempban_max] minutes!" + usr << "Moderators can only job tempban up to [config.mod_tempban_max] minutes!" return if(mins >= 525600) mins = 525599 var/reason = input(usr,"Reason?","reason","Griefer") as text|null From 49ea79d0b37989c67bc3332ce6a60c419f48c91d Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Thu, 9 Jul 2015 14:40:30 -0700 Subject: [PATCH 6/8] Added missing return. --- code/modules/admin/topic.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 52792aa926a..e3004d7b41d 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -748,6 +748,7 @@ return if(check_rights(R_MOD, 0) && !check_rights(R_BAN) && mins > config.mod_job_tempban_max) usr << " Moderators can only job tempban up to [config.mod_job_tempban_max] minutes!" + return var/reason = input(usr,"Reason?","Please State Reason","") as text|null if(!reason) return From 168f823c356f1c09b5bc97ee154696158e2980f7 Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Thu, 9 Jul 2015 22:19:05 -0700 Subject: [PATCH 7/8] Fixed up the things pointed out by Ccomp5950. --- code/controllers/configuration.dm | 8 ++++---- code/modules/admin/topic.dm | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 28474518c35..d08823475b0 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -61,10 +61,10 @@ var/guest_jobban = 1 var/usewhitelist = 0 var/kick_inactive = 0 //force disconnect for inactive players - var/show_mods - var/show_mentors - var/mods_can_tempban - var/mods_can_job_tempban + var/show_mods = 0 + var/show_mentors = 0 + var/mods_can_tempban = 0 + var/mods_can_job_tempban = 0 var/mod_tempban_max = 1440 var/mod_job_tempban_max = 1440 var/load_jobs_from_txt = 0 diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index e3004d7b41d..19894adf353 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -660,9 +660,11 @@ //JOBBAN'S INNARDS else if(href_list["jobban3"]) - if(!check_rights(R_MOD,0) && !check_rights(R_ADMIN)) return + if(!check_rights(R_MOD,0) && !check_rights(R_ADMIN,0)) + usr << "You do not have the appropriate permissions to add job bans!" + return - if(check_rights(R_MOD,0) && !check_rights(R_ADMIN) && !config.mods_can_job_tempban) // If mod and tempban disabled + if(check_rights(R_MOD,0) && !check_rights(R_ADMIN,0) && !config.mods_can_job_tempban) // If mod and tempban disabled usr << "Mod jobbanning is disabled!" return @@ -739,14 +741,14 @@ if(notbannedlist.len) //at least 1 unbanned job exists in joblist so we have stuff to ban. switch(alert("Temporary Ban?",,"Yes","No", "Cancel")) if("Yes") - if(!check_rights(R_MOD,0) && !check_rights(R_BAN)) return + if(!check_rights(R_MOD,0) && !check_rights(R_BAN, 0)) return if(config.ban_legacy_system) usr << "\red Your server is using the legacy banning system, which does not support temporary job bans. Consider upgrading. Aborting ban." return var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null if(!mins) return - if(check_rights(R_MOD, 0) && !check_rights(R_BAN) && mins > config.mod_job_tempban_max) + if(check_rights(R_MOD, 0) && !check_rights(R_BAN, 0) && mins > config.mod_job_tempban_max) usr << " Moderators can only job tempban up to [config.mod_job_tempban_max] minutes!" return var/reason = input(usr,"Reason?","Please State Reason","") as text|null @@ -857,9 +859,11 @@ DB_ban_unban(ckey(key), BANTYPE_JOB_PERMA, job) else if(href_list["newban"]) - if(!check_rights(R_MOD,0) && !check_rights(R_BAN)) return + if(!check_rights(R_MOD,0) && !check_rights(R_BAN, 0)) + usr << "You do not have the appropriate permissions to add bans!" + return - if(check_rights(R_MOD,0) && !check_rights(R_ADMIN) && !config.mods_can_job_tempban) // If mod and tempban disabled + if(check_rights(R_MOD,0) && !check_rights(R_ADMIN, 0) && !config.mods_can_job_tempban) // If mod and tempban disabled usr << "Mod jobbanning is disabled!" return @@ -873,7 +877,7 @@ var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null if(!mins) return - if(check_rights(R_MOD, 0) && !check_rights(R_BAN) && mins > config.mod_tempban_max) + if(check_rights(R_MOD, 0) && !check_rights(R_BAN, 0) && mins > config.mod_tempban_max) usr << "Moderators can only job tempban up to [config.mod_tempban_max] minutes!" return if(mins >= 525600) mins = 525599 From 5b30703d306570c86ddb6e8025a1625ebb7db258 Mon Sep 17 00:00:00 2001 From: Null Snapshot Date: Sat, 11 Jul 2015 04:22:36 -0700 Subject: [PATCH 8/8] Should be the last fixes needed. --- code/modules/admin/topic.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 19894adf353..3b701b27da4 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -741,7 +741,9 @@ if(notbannedlist.len) //at least 1 unbanned job exists in joblist so we have stuff to ban. switch(alert("Temporary Ban?",,"Yes","No", "Cancel")) if("Yes") - if(!check_rights(R_MOD,0) && !check_rights(R_BAN, 0)) return + if(!check_rights(R_MOD,0) && !check_rights(R_BAN, 0)) + usr << " You Cannot issue temporary job-bans!" + return if(config.ban_legacy_system) usr << "\red Your server is using the legacy banning system, which does not support temporary job bans. Consider upgrading. Aborting ban." return @@ -861,7 +863,7 @@ else if(href_list["newban"]) if(!check_rights(R_MOD,0) && !check_rights(R_BAN, 0)) usr << "You do not have the appropriate permissions to add bans!" - return + return if(check_rights(R_MOD,0) && !check_rights(R_ADMIN, 0) && !config.mods_can_job_tempban) // If mod and tempban disabled usr << "Mod jobbanning is disabled!"