mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-03 22:12:38 +00:00
Macro specific spam protection + mouse abuse (#2022)
Someone forgot to spam check squeaking. I forgot to upload anti-macro spam measures. So let's have both in one go, yay!
This commit is contained in:
@@ -6,8 +6,13 @@
|
||||
var/datum/admins/deadmin_holder = null
|
||||
var/buildmode = 0
|
||||
|
||||
///////////////////
|
||||
//SPAM PROTECTION//
|
||||
///////////////////
|
||||
var/last_message = "" //Contains the last message sent by this client - used to protect against copy-paste spamming.
|
||||
var/last_message_count = 0 //contins a number of how many times a message identical to last_message was sent.
|
||||
var/last_message_time
|
||||
var/spam_alert = 0
|
||||
|
||||
/////////
|
||||
//OTHER//
|
||||
@@ -59,4 +64,4 @@
|
||||
var/turf/previous_turf = null
|
||||
var/obj/screen/plane_master/parallax_master/parallax_master = null
|
||||
var/obj/screen/plane_master/parallax_dustmaster/parallax_dustmaster = null
|
||||
var/obj/screen/plane_master/parallax_spacemaster/parallax_spacemaster = null
|
||||
var/obj/screen/plane_master/parallax_spacemaster/parallax_spacemaster = null
|
||||
|
||||
@@ -197,19 +197,35 @@
|
||||
..() //redirect to hsrc.()
|
||||
|
||||
/client/proc/handle_spam_prevention(var/message, var/mute_type)
|
||||
if(config.automute_on && !holder && src.last_message == message)
|
||||
src.last_message_count++
|
||||
if(src.last_message_count >= SPAM_TRIGGER_AUTOMUTE)
|
||||
src << "\red You have exceeded the spam filter limit for identical messages. An auto-mute was applied."
|
||||
cmd_admin_mute(src.mob, mute_type, 1)
|
||||
return 1
|
||||
if(src.last_message_count >= SPAM_TRIGGER_WARNING)
|
||||
src << "\red You are nearing the spam filter limit for identical messages."
|
||||
return 0
|
||||
else
|
||||
last_message = message
|
||||
src.last_message_count = 0
|
||||
return 0
|
||||
if (config.automute_on && !holder)
|
||||
if (last_message_time)
|
||||
if (world.time - last_message_time < 5)
|
||||
spam_alert++
|
||||
if (spam_alert > 3)
|
||||
if (!(prefs.muted & mute_type))
|
||||
cmd_admin_mute(src.mob, mute_type, 1)
|
||||
|
||||
src << "<span class='danger'>You have tripped the macro filter. An auto-mute was applied.</span>"
|
||||
last_message_time = world.time
|
||||
return 1
|
||||
else
|
||||
spam_alert = max(0, spam_alert--)
|
||||
|
||||
last_message_time = world.time
|
||||
|
||||
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."
|
||||
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."
|
||||
return 0
|
||||
|
||||
last_message = message
|
||||
last_message_count = 0
|
||||
return 0
|
||||
|
||||
//This stops files larger than UPLOAD_LIMIT being sent from client to server via input(), client.Import() etc.
|
||||
/client/AllowUpload(filename, filelength)
|
||||
@@ -273,7 +289,7 @@
|
||||
prefs.last_id = computer_id //these are gonna be used for banning
|
||||
|
||||
. = ..() //calls mob.Login()
|
||||
|
||||
|
||||
prefs.sanitize_preferences()
|
||||
|
||||
if (byond_version < config.client_error_version)
|
||||
|
||||
@@ -184,16 +184,37 @@
|
||||
/mob/living/simple_animal/mouse/verb/squeak_loud_verb()
|
||||
set name = "Squeal!"
|
||||
set category = "Abilities"
|
||||
|
||||
if (usr.client.handle_spam_prevention(null, MUTE_IC))
|
||||
return
|
||||
else if (usr.client.prefs.muted & MUTE_IC)
|
||||
usr << "<span class='danger'>You are muted from IC emotes.</span>"
|
||||
return
|
||||
|
||||
squeak_loud(1)
|
||||
|
||||
/mob/living/simple_animal/mouse/verb/squeak_soft_verb()
|
||||
set name = "Soft Squeaking"
|
||||
set category = "Abilities"
|
||||
|
||||
if (usr.client.handle_spam_prevention(null, MUTE_IC))
|
||||
return
|
||||
else if (usr.client.prefs.muted & MUTE_IC)
|
||||
usr << "<span class='danger'>You are muted from IC emotes.</span>"
|
||||
return
|
||||
|
||||
squeak_soft(1)
|
||||
|
||||
/mob/living/simple_animal/mouse/verb/squeak_verb()
|
||||
set name = "Squeak"
|
||||
set category = "Abilities"
|
||||
|
||||
if (usr.client.handle_spam_prevention(null, MUTE_IC))
|
||||
return
|
||||
else if (usr.client.prefs.muted & MUTE_IC)
|
||||
usr << "<span class='danger'>You are muted from IC emotes.</span>"
|
||||
return
|
||||
|
||||
squeak(1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user