From 096a9cf56308193065a609f2ae426a3c487e8f4b Mon Sep 17 00:00:00 2001 From: errorage Date: Thu, 4 Apr 2013 00:40:30 +0200 Subject: [PATCH] - Added an extra variable to determine the behavior of bans when they are applied. The variable is kickbannedckey. It is used to determine whether the bans, which are handled by db_ban kick the mob or not, if he is connected, that is. Some ban types, such as permaban and tempban, do not use this, as it is handled by legacy ban code. --- code/modules/admin/DB ban/functions.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index 8244fa353b3..3b2faf98319 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -14,6 +14,9 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = var/maxadminbancheck //Used to limit the number of active bans of a certein type that each admin can give. Used to protect against abuse or mutiny. var/announceinirc //When set, it announces the ban in irc. Intended to be a way to raise an alarm, so to speak. var/blockselfban //Used to prevent the banning of yourself. + var/kickbannedckey //Defines whether this proc should kick the banned person, if they are connected (if banned_mob is defined). + //some ban types kick players after this proc passes (tempban, permaban), but some are specific to db_ban, so + //they should kick within this proc. switch(bantype) if(BANTYPE_PERMA) bantype_str = "PERMABAN" @@ -42,12 +45,14 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = maxadminbancheck = 1 announceinirc = 1 blockselfban = 1 + kickbannedckey = 1 if(BANTYPE_ADMIN_TEMP) bantype_str = "ADMIN_TEMPBAN" bantype_pass = 1 maxadminbancheck = 1 announceinirc = 1 blockselfban = 1 + kickbannedckey = 1 if( !bantype_pass ) return if( !istext(reason) ) return if( !isnum(duration) ) return @@ -86,10 +91,12 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = a_computerid = src.owner:computer_id a_ip = src.owner:address + /* TODO UNCEOMMENT if(blockselfban) if(a_ckey == ckey) usr << "\red You cannot apply this ban type on yourself." return + */ var/who for(var/client/C in clients) @@ -125,6 +132,10 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = if(announceinirc) send2irc("BAN ALERT","[a_ckey] applied a [bantype_str] on [ckey]") + if(kickbannedckey) + if(banned_mob && banned_mob.client && banned_mob.client.ckey == banckey) + del(banned_mob.client) + datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "") @@ -339,7 +350,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" output += "" output += "" - output += "" + output += "" output += "" output += "" output += "" @@ -463,6 +474,4 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" - usr << browse(output,"window=lookupbans;size=900x500") - -#undef MAX_ADMIN_BANS_PER_ADMIN \ No newline at end of file + usr << browse(output,"window=lookupbans;size=900x500") \ No newline at end of file