Merge pull request #15237 from DeltaFire15/phobia-redtext

Fixes phobias just deleting trigger words, also highlights all of them
This commit is contained in:
Lin
2021-10-05 10:22:17 -07:00
committed by GitHub

View File

@@ -83,13 +83,19 @@
return
if(HAS_TRAIT(owner, TRAIT_FEARLESS))
return
var/matches = FALSE
var/mainsource
for(var/word in trigger_words)
var/regex/reg = regex("(\\b|\\A)[REGEX_QUOTE(word)]'?s*(\\b|\\Z)", "i")
var/regex/reg = regex("(\\b|\\A)[REGEX_QUOTE(word)]'?s*(\\b|\\Z)", "ig")
if(findtext(hearing_args[HEARING_RAW_MESSAGE], reg))
addtimer(CALLBACK(src, .proc/freak_out, null, word), 10) //to react AFTER the chat message
hearing_args[HEARING_RAW_MESSAGE] = reg.Replace(hearing_args[HEARING_RAW_MESSAGE], "<span class='phobia'>$1</span>")
break
hearing_args[HEARING_RAW_MESSAGE] = reg.Replace(hearing_args[HEARING_RAW_MESSAGE], "<span class='phobia'>$0</span>")
matches = TRUE
mainsource = word
if(matches)
addtimer(CALLBACK(src, .proc/freak_out, null, mainsource), 10) //to react AFTER the chat message
/datum/brain_trauma/mild/phobia/handle_speech(datum/source, list/speech_args)
if(HAS_TRAIT(owner, TRAIT_FEARLESS))