diff --git a/code/datums/brain_damage/mild.dm b/code/datums/brain_damage/mild.dm index 92c4e55699..eb5e3c0735 100644 --- a/code/datums/brain_damage/mild.dm +++ b/code/datums/brain_damage/mild.dm @@ -264,3 +264,36 @@ speak_dejavu += speech_args[SPEECH_MESSAGE] else speak_dejavu += speech_args[SPEECH_MESSAGE] + +/datum/brain_trauma/mild/redacted + name = "Confidentiality Trauma" + desc = "Patient's language neurons seem to be warped in a strange manner, resulting in them being unable to speak properly." + scan_desc = "\[REDACTED]" + gain_text = "You feel the need to \[REDACTED]" + lose_text = "You no longer feel the need to \[REDACTED]." + +/datum/brain_trauma/mild/redacted/handle_speech(datum/source, list/speech_args) + var/message = speech_args[SPEECH_MESSAGE] + if(message) + var/list/message_split = splittext(message, " ") + var/list/new_message = list() + + for(var/word in message_split) + var/suffix = "" + var/suffix_foundon = 0 + for(var/potential_suffix in list("." , "," , ";" , "!" , ":" , "?")) + suffix_foundon = findtext(word, potential_suffix, -length(potential_suffix)) + if(suffix_foundon) + suffix = potential_suffix + break + + if(suffix_foundon) + word = copytext(word, 1, suffix_foundon) + + word = html_decode(word) + + if(prob(25)) + word = pick(list("\[REDACTED]", "\[CLASSIFIED]", "\[EXPUNGED]")) + new_message += word + suffix + message = jointext(new_message, " ") + speech_args[SPEECH_MESSAGE] = trim(message)