mob
proc
filter(string)
for(var/i in src.curses)
var/pos = src.case ? findText(string,i) : findtext(string,i)
while(pos)
string = copytext(string,1,pos) + stars(i) + copytext(string,pos+length(i))
pos = findtext(string,i)
return string
stars(string)
if(!istext(string)) return stars("[string]")
var/stars = ""
var/len = length(string)
for(var/i = 1 to len)
stars += "*"
return stars
mob
var
list
curses = list("Crap","Poo","Hilary Clinton")
case
filtering = 1
verb
Add_Word(t as text)
if(t in src.curses) return
src.curses += t
src << "You are now filtering [t] with a total of [src.curses.len] filtered words"
Remove_Word(i in src.curses)
src.curses -= i
src << "[i] is no longer filtered, you are now filtering [src.curses.len] words"
Toggle_Case_Sensitivity()
src.case = !src.case
src << "Your filter is [src.case ? "now" : "no longer"] case sensitive"
ToggleFilter()
src.filtering = !src.filtering
if(!src.filtering)
src.verbs -= /mob/verb/Add_Word
src.verbs -= /mob/verb/Remove_Word
src.verbs -= /mob/verb/Toggle_Case_Sensitivity
else
src.verbs += /mob/verb/Add_Word
src.verbs += /mob/verb/Remove_Word
src.verbs += /mob/verb/Toggle_Case_Sensitivity
Say(t as text)
for(var/client/C)
C << "[src.name] : [C.mob.filtering ? C.mob.filter(t) : (t)]"
Is that the best way to go about it? Like letting the user decide if he wants his messages filtered and to choose what words he wants filtered?
Consider this as well: shouldn't players always see the same output? One player may not see a word while another will, which might create confusion or misinterpretation, dependably.