Closed lulzyyy closed 8 years ago
Yeah, I just thinking about it :) Will be added soon
I used some form of custom censorship for fun. I'll pull up a snippet of my code from my server when I get a chance.
(Or @Barbosik can if he wants.)
Snippet: (contains vulgar words)
GameServer.prototype.wordFilter = function(words) {
if (this.wordFilterList.length == 0) {
return words;
}
var out = words;
var low = words.toLowerCase();
if (low.indexOf("team") >= 0 && low.indexOf("no") < 0 && low.indexOf("n't") < 0 && low.indexOf("stop") < 0 && low.indexOf("hate") < 0) {
out = "I HATE TEAMING";
}
else {
// Because regex takes loger to process
if (low.indexOf("bitch") >= 0)
out = out.replace(/bitch/ig, "coast");
if (low.indexOf("fuck") >= 0)
out = out.replace(/fuck/ig, "ahhh");
if (low.indexOf("shit") >= 0 || low.indexOf("crap") >= 0)
out = out.replace(/shit|crap/ig, "gold");
if (low.indexOf("damn") >= 0)
out = out.replace(/damn/ig, "wall");
if (low.indexOf("dick") >= 0)
out = out.replace(/dick/ig, "ohhh");
}
return out;
}
Seems cool.
I would do this client-side (receiving end), not server-side.
Well this isn't really an issue but people could easily make scripts to stop the encoding of the words if it was client sided.
implemented. You can add censored words into badwords.txt. But do not add large amount of words, because it will leads to lags.
What is needed is the option of censoring chat because a lot of kids play this game and sometimes people use very vulgar language... I added censorship to my public servers on c0nsume.me and I used this https://www.npmjs.com/package/censoring + some validation with regular expressions. May be useful