mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Pax bans (#31926)
* Pax bans * Fixes * Stops removal during it * Fix * Annotation * Actual ban loading too * New way of doing it * New way of doing it * Truncates code * Even more truncating Co-authored-by: kanef <kanef9x@protonmail.com>
This commit is contained in:
@@ -680,6 +680,8 @@ var/list/liftable_structures = list(\
|
|||||||
#define BANTYPE_APPEARANCE 6
|
#define BANTYPE_APPEARANCE 6
|
||||||
#define BANTYPE_OOC_PERMA 7
|
#define BANTYPE_OOC_PERMA 7
|
||||||
#define BANTYPE_OOC_TEMP 8
|
#define BANTYPE_OOC_TEMP 8
|
||||||
|
#define BANTYPE_PAX_PERMA 9
|
||||||
|
#define BANTYPE_PAX_TEMP 10
|
||||||
|
|
||||||
#define SEE_INVISIBLE_MINIMUM 5
|
#define SEE_INVISIBLE_MINIMUM 5
|
||||||
|
|
||||||
@@ -1446,6 +1448,8 @@ var/proccalls = 1
|
|||||||
//OOC isbanned
|
//OOC isbanned
|
||||||
#define oocban_isbanned(key) oocban_keylist.Find("[ckey(key)]")
|
#define oocban_isbanned(key) oocban_keylist.Find("[ckey(key)]")
|
||||||
|
|
||||||
|
#define paxban_isbanned(key) paxban_keylist.Find("[ckey(key)]")
|
||||||
|
|
||||||
//message modes. you're not supposed to mess with these.
|
//message modes. you're not supposed to mess with these.
|
||||||
#define MODE_HEADSET "headset"
|
#define MODE_HEADSET "headset"
|
||||||
#define MODE_ROBOT "robot"
|
#define MODE_ROBOT "robot"
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ var/global/floorIsLava = 0
|
|||||||
<A href='?src=\ref[src];newban=\ref[M]'>Ban</A> |
|
<A href='?src=\ref[src];newban=\ref[M]'>Ban</A> |
|
||||||
<A href='?src=\ref[src];jobban2=\ref[M]'>Jobban</A> |
|
<A href='?src=\ref[src];jobban2=\ref[M]'>Jobban</A> |
|
||||||
<A href='?src=\ref[src];oocban=\ref[M]'>OOC Ban</A> |
|
<A href='?src=\ref[src];oocban=\ref[M]'>OOC Ban</A> |
|
||||||
|
<A href='?src=\ref[src];paxban=\ref[M]'>Pax Ban</A> |
|
||||||
<A href='?_src_=holder;appearanceban=\ref[M]'>Identity Ban</A> |
|
<A href='?_src_=holder;appearanceban=\ref[M]'>Identity Ban</A> |
|
||||||
<A href='?src=\ref[src];notes=show;mob=\ref[M]'>Notes</A>
|
<A href='?src=\ref[src];notes=show;mob=\ref[M]'>Notes</A>
|
||||||
"}
|
"}
|
||||||
|
|||||||
34
code/modules/admin/banpax.dm
Normal file
34
code/modules/admin/banpax.dm
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
var/paxban_keylist[0]
|
||||||
|
|
||||||
|
/proc/pax_unban(mob/M)
|
||||||
|
if(!M)
|
||||||
|
return 0
|
||||||
|
return paxban_keylist.Remove("[M.ckey]")
|
||||||
|
|
||||||
|
/proc/pax_ban(mob/M)
|
||||||
|
if(!M)
|
||||||
|
return 0
|
||||||
|
return paxban_keylist.Add("[M.ckey]")
|
||||||
|
|
||||||
|
/proc/paxban_loadbanfile()
|
||||||
|
if(!SSdbcore.Connect())
|
||||||
|
world.log << "Database connection failed. Skipping pax ban loading"
|
||||||
|
diary << "Database connection failed. Skipping pax ban loading"
|
||||||
|
return
|
||||||
|
|
||||||
|
//OOC permabans
|
||||||
|
var/datum/DBQuery/query = SSdbcore.NewQuery("SELECT ckey FROM erro_ban WHERE (bantype = :pax_perma OR (bantype = :pax_temp AND expiration_time > Now())) AND isnull(unbanned)",
|
||||||
|
list(
|
||||||
|
"pax_perma" = "pax_PERMABAN",
|
||||||
|
"pax_temp" = "pax_TEMPBAN",
|
||||||
|
))
|
||||||
|
if(!query.Execute())
|
||||||
|
message_admins("Error: [query.ErrorMsg()]")
|
||||||
|
log_sql("Error: [query.ErrorMsg()]")
|
||||||
|
qdel(query)
|
||||||
|
return
|
||||||
|
|
||||||
|
while(query.NextRow())
|
||||||
|
var/ckey = query.item[1]
|
||||||
|
paxban_keylist.Add("[ckey]")
|
||||||
|
qdel(query)
|
||||||
@@ -193,12 +193,12 @@
|
|||||||
return
|
return
|
||||||
banduration = null
|
banduration = null
|
||||||
banjob = null
|
banjob = null
|
||||||
if(BANTYPE_OOC_PERMA)
|
if(BANTYPE_OOC_PERMA || BANTYPE_PAX_PERMA)
|
||||||
if(!banckey || !banreason)
|
if(!banckey || !banreason)
|
||||||
to_chat(usr, "Not enough parameters (Requires ckey and reason)")
|
to_chat(usr, "Not enough parameters (Requires ckey and reason)")
|
||||||
return
|
return
|
||||||
banduration = null
|
banduration = null
|
||||||
if(BANTYPE_OOC_TEMP)
|
if(BANTYPE_OOC_TEMP || BANTYPE_PAX_TEMP)
|
||||||
if(!banckey || !banreason || !banduration)
|
if(!banckey || !banreason || !banduration)
|
||||||
to_chat(usr, "Not enough parameters (Requires ckey, reason, and duration)")
|
to_chat(usr, "Not enough parameters (Requires ckey, reason, and duration)")
|
||||||
return
|
return
|
||||||
@@ -923,6 +923,58 @@
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
|
else if(href_list["paxban"])
|
||||||
|
if(!check_rights(R_BAN))
|
||||||
|
return
|
||||||
|
var/mob/M = locate(href_list["paxban"])
|
||||||
|
if(!ismob(M))
|
||||||
|
to_chat(usr, "This can only be used on instances of type /mob")
|
||||||
|
return
|
||||||
|
if(!M.ckey) //sanity
|
||||||
|
to_chat(usr, "This mob has no ckey")
|
||||||
|
return
|
||||||
|
var/paxbanned = paxban_isbanned("[M.ckey]")
|
||||||
|
if(paxbanned && alert("Remove pax ban?","Please Confirm","Yes","No") == "Yes")
|
||||||
|
ban_unban_log_save("[key_name(usr)] removed [key_name(M)]'s pax ban")
|
||||||
|
log_admin("[key_name(usr)] removed [key_name(M)]'s pax ban")
|
||||||
|
feedback_inc("ban_pax_unban", 1)
|
||||||
|
DB_ban_unban(M.ckey, BANTYPE_PAX_PERMA)
|
||||||
|
pax_unban(M)
|
||||||
|
message_admins("<span class='notice'>[key_name_admin(usr)] removed [key_name_admin(M)]'s PAX ban</span>", 1)
|
||||||
|
to_chat(M, "<span class='warning'><BIG><B>[usr.client.ckey] has removed your PAX ban.</B></BIG></span>")
|
||||||
|
else if(alert("Pax ban [M.ckey]?","Please Confirm","Yes","No") == "Yes")
|
||||||
|
var/temp = alert("Temporary Ban?",,"Yes","No", "Cancel")
|
||||||
|
var/mins = 0
|
||||||
|
switch(temp)
|
||||||
|
if("Yes")
|
||||||
|
mins = input(usr,"How long (in minutes)?","PAX Ban time",1440) as num|null
|
||||||
|
if(!mins)
|
||||||
|
return
|
||||||
|
if(mins >= 525600)
|
||||||
|
mins = 525599
|
||||||
|
if("Cancel")
|
||||||
|
return
|
||||||
|
var/istemp = temp == "Yes"
|
||||||
|
var/reason = input(usr,"Reason?","reason","Greytider") as text|null
|
||||||
|
if(!reason)
|
||||||
|
return
|
||||||
|
to_chat(M, "<span class='warning'><BIG><B>You have been PAX banned by [usr.client.ckey].\nReason: [reason].</B></BIG></span>")
|
||||||
|
to_chat(M, "<span class='warning'>This is a [istemp ? "temporary" : "permanent"] pax ban[istemp ? ", it will be removed in [mins] minutes" : ""].</span>")
|
||||||
|
if(config.banappeals)
|
||||||
|
to_chat(M, "<span class='warning'>To try to resolve this matter head to [config.banappeals]</span>")
|
||||||
|
else
|
||||||
|
to_chat(M, "<span class='warning'>No ban appeals URL has been set.</span>")
|
||||||
|
var/resolvetext = istemp ? "This will be removed in [mins] minutes." : "This is a permanent pax ban."
|
||||||
|
ban_unban_log_save("[usr.client.ckey] has [istemp ? "temp-" : "perma-"]pax banned [M.ckey]. - Reason: [reason] - [resolvetext]")
|
||||||
|
feedback_inc(istemp ? "ban_pax_tmp" : "ban_pax_perma",1)
|
||||||
|
DB_ban_record(istemp ? BANTYPE_PAX_TEMP : BANTYPE_PAX_PERMA, M, istemp ? mins : -1, reason)
|
||||||
|
if(istemp)
|
||||||
|
feedback_inc("ban_pax_tmp_mins",mins)
|
||||||
|
log_admin("[usr.client.ckey] has pax banned [M.ckey].\nReason: [reason]\n[resolvetext]")
|
||||||
|
message_admins("<span class='warning'>[usr.client.ckey] has pax banned [M.ckey].\nReason: [reason]\n[resolvetext]</span>")
|
||||||
|
pax_ban(M)
|
||||||
|
else
|
||||||
|
return
|
||||||
|
|
||||||
else if(href_list["appearanceban"])
|
else if(href_list["appearanceban"])
|
||||||
if(!check_rights(R_BAN))
|
if(!check_rights(R_BAN))
|
||||||
|
|||||||
@@ -2103,6 +2103,10 @@ Use this proc preferably at the end of an equipment loadout
|
|||||||
alphas.Remove(source_define)
|
alphas.Remove(source_define)
|
||||||
|
|
||||||
/mob/proc/is_pacified(var/message = VIOLENCE_SILENT,var/target,var/weapon)
|
/mob/proc/is_pacified(var/message = VIOLENCE_SILENT,var/target,var/weapon)
|
||||||
|
if(paxban_isbanned(ckey))
|
||||||
|
to_chat(src, "<span class='warning'>You feel some strange force preventing you from being violent.</span>")
|
||||||
|
return TRUE
|
||||||
|
|
||||||
if (runescape_pvp)
|
if (runescape_pvp)
|
||||||
var/area/A = get_area(src)
|
var/area/A = get_area(src)
|
||||||
if (!istype(A, /area/maintenance) && !is_type_in_list(A,non_standard_maint_areas))
|
if (!istype(A, /area/maintenance) && !is_type_in_list(A,non_standard_maint_areas))
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ var/auxtools_path
|
|||||||
load_alienwhitelist()
|
load_alienwhitelist()
|
||||||
jobban_loadbanfile()
|
jobban_loadbanfile()
|
||||||
oocban_loadbanfile()
|
oocban_loadbanfile()
|
||||||
|
paxban_loadbanfile()
|
||||||
jobban_updatelegacybans()
|
jobban_updatelegacybans()
|
||||||
appearance_loadbanfile()
|
appearance_loadbanfile()
|
||||||
LoadBans()
|
LoadBans()
|
||||||
|
|||||||
@@ -1336,6 +1336,7 @@
|
|||||||
#include "code\modules\admin\banappearance.dm"
|
#include "code\modules\admin\banappearance.dm"
|
||||||
#include "code\modules\admin\banjob.dm"
|
#include "code\modules\admin\banjob.dm"
|
||||||
#include "code\modules\admin\banooc.dm"
|
#include "code\modules\admin\banooc.dm"
|
||||||
|
#include "code\modules\admin\banpax.dm"
|
||||||
#include "code\modules\admin\body_archive_panel.dm"
|
#include "code\modules\admin\body_archive_panel.dm"
|
||||||
#include "code\modules\admin\buildmode.dm"
|
#include "code\modules\admin\buildmode.dm"
|
||||||
#include "code\modules\admin\check_antagonists.dm"
|
#include "code\modules\admin\check_antagonists.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user