Fixes brain gibberish from attempting to emote (#27901)

* fixes brain gibberish

* brain gibberish proc + touch-ups

* extra line

---------

Co-authored-by: Toastical <toastical@toaster.com>
Co-authored-by: Toastical <toast@toaster.com>
This commit is contained in:
Toastical
2025-01-10 02:07:36 +00:00
committed by GitHub
co-authored by Toastical Toastical
parent 0eafad8475
commit c939bbc347
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
if(prob(10)) //10% chance to drop the message entirely
return
else
message = Gibberish(message, (emp_damage*6))//scrambles the message, gets worse when emp_damage is higher
message = brain_gibberish(message, (emp_damage*6))//scrambles the message, gets worse when emp_damage is higher
..(message)
+11
View File
@@ -351,6 +351,17 @@
return returntext
/proc/brain_gibberish(message, emp_damage)
if(copytext(message, 1, 2) == "*") // if the brain tries to emote, return an emote
return message
var/repl_char = pick("@","&","%","$","/")
var/regex/bad_char = regex("\[*]|#")
message = Gibberish(message, emp_damage)
message = bad_char.Replace(message, repl_char, 1, 2) // prevents the gibbered message from emoting
return message
/proc/Gibberish_all(list/message_pieces, p, replace_rate)
for(var/datum/multilingual_say_piece/S in message_pieces)
S.message = Gibberish(S.message, p, replace_rate)