Configable anti-macro protection (#2293)

Apparently some people spam type faster than the hardcoded variable. Fuck it, to the config it is.
This commit is contained in:
skull132
2017-05-17 21:59:02 +03:00
committed by GitHub
parent df0911c116
commit 3dc10cdf2f
3 changed files with 12 additions and 5 deletions
+6 -2
View File
@@ -76,6 +76,7 @@ var/list/gamemode_cache = list()
var/load_jobs_from_txt = 0
var/ToRban = 0
var/automute_on = 0 //enables automuting/spam prevention
var/macro_trigger = 5 // The grace period between messages before it's counted as abusing a macro.
var/jobs_have_minimal_access = 0 //determines whether jobs use minimal access or expanded access.
var/cult_ghostwriter = 1 //Allows ghosts to write in blood in cult rounds...
@@ -614,6 +615,9 @@ var/list/gamemode_cache = list()
if("automute_on")
automute_on = 1
if("macro_trigger")
macro_trigger = text2num(value)
if("usealienwhitelist")
usealienwhitelist = 1
@@ -808,10 +812,10 @@ var/list/gamemode_cache = list()
if("log_gelf_enabled")
config.log_gelf_enabled = text2num(value)
if("log_gelf_ip")
config.log_gelf_ip = value
if("log_gelf_port")
config.log_gelf_port = value
+3 -3
View File
@@ -214,7 +214,7 @@
/client/proc/handle_spam_prevention(var/message, var/mute_type)
if (config.automute_on && !holder)
if (last_message_time)
if (world.time - last_message_time < 5)
if (world.time - last_message_time < config.macro_trigger)
spam_alert++
if (spam_alert > 3)
if (!(prefs.muted & mute_type))
@@ -231,11 +231,11 @@
if(!isnull(message) && last_message == message)
last_message_count++
if(last_message_count >= SPAM_TRIGGER_AUTOMUTE)
src << "\red You have exceeded the spam filter limit for identical messages. An auto-mute was applied."
src << "<span class='danger'>You have exceeded the spam filter limit for identical messages. An auto-mute was applied.</span>"
cmd_admin_mute(src.mob, mute_type, 1)
return 1
if(last_message_count >= SPAM_TRIGGER_WARNING)
src << "\red You are nearing the spam filter limit for identical messages."
src << "<span class='danger'>You are nearing the spam filter limit for identical messages.</span>"
return 0
last_message = message
+3
View File
@@ -251,6 +251,9 @@ SOCKET_TALK 0
## Comment this out to disable automuting
#AUTOMUTE_ON
## Adjust this time to modify how sensitive to fast messages spam protection should be.
MACRO_TRIGGER 5
## How long the delay is before the Away Mission gate opens. Default is half an hour.
GATEWAY_DELAY 18000