Merge pull request #10072 from NullSnapshot/adminfeatures

[Fast-track] Moderator tempban changes.
This commit is contained in:
Ccomp5950
2015-07-11 23:21:49 -04:00
6 changed files with 117 additions and 15 deletions
+24 -4
View File
@@ -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 = 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
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
+29 -3
View File
@@ -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
@@ -74,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))
@@ -89,17 +91,41 @@
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))
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)
mentmsg += "\t[C] is a [C.holder.rank]\n"
num_mentors_online++
if(config.admin_irc)
src << "<span class='info'>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.</span>"
msg = "<b>Current Admins ([num_admins_online]):</b>\n" + msg + "\n<b> Current [config.mods_are_mentors ? "Mentors" : "Moderators"]([num_mods_online]):</b>\n" + modmsg
msg = "<b>Current Admins ([num_admins_online]):</b>\n" + msg
if(config.show_mods)
msg += "\n<b> Current Moderators ([num_mods_online]):</b>\n" + modmsg
if(config.show_mentors)
msg += "\n<b> Current Mentors ([num_mentors_online]):</b>\n" + mentmsg
src << msg
+23 -3
View File
@@ -660,7 +660,13 @@
//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 << "<span class='warning'>You do not have the appropriate permissions to add job bans!</span>"
return
if(check_rights(R_MOD,0) && !check_rights(R_ADMIN,0) && !config.mods_can_job_tempban) // If mod and tempban disabled
usr << "<span class='warning'>Mod jobbanning is disabled!</span>"
return
var/mob/M = locate(href_list["jobban4"])
if(!ismob(M))
@@ -735,13 +741,18 @@
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))
usr << "<span class='warning'> You Cannot issue temporary job-bans!</span>"
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, 0) && mins > config.mod_job_tempban_max)
usr << "<span class='warning'> Moderators can only job tempban up to [config.mod_job_tempban_max] minutes!</span>"
return
var/reason = input(usr,"Reason?","Please State Reason","") as text|null
if(!reason)
return
@@ -850,7 +861,13 @@
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 << "<span class='warning'>You do not have the appropriate permissions to add bans!</span>"
return
if(check_rights(R_MOD,0) && !check_rights(R_ADMIN, 0) && !config.mods_can_job_tempban) // If mod and tempban disabled
usr << "<span class='warning'>Mod jobbanning is disabled!</span>"
return
var/mob/M = locate(href_list["newban"])
if(!ismob(M)) return
@@ -862,6 +879,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, 0) && mins > config.mod_tempban_max)
usr << "<span class='warning'>Moderators can only job tempban up to [config.mod_tempban_max] minutes!</span>"
return
if(mins >= 525600) mins = 525599
var/reason = input(usr,"Reason?","reason","Griefer") as text|null
if(!reason)
+21 -1
View File
@@ -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)
+17 -4
View File
@@ -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
+3
View File
@@ -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