Braindamage speech proc change.
What this does
Changes the braindamage speech proc so it replaces a lot more words than before with their braindamaged counterpart. Also makes it so a lot of the words used in the forced braindamage lines are also spelled that way if said normally. Ex: Singularity becomes Scrungularity when spoken regularly because the forced braindamage line says scrungularity, and this is consistent with it. It will also make it so 70% of the time, words that have two identical letters together like "look, wood, sleep, etc" lose one of those letters, becoming "lok, wod, slep, etc" (that's what the regex check is for). This is a sentence-wide check, so if one word gets the double letters removed, then all of them get them removed. There's also an independent 40% chance to replace any one word in a sentence with "um" or a variant. Players with braindamage will not be able to speak more than once per second (largely unnoticeable unless macrospamming). Finally, it reduces the forced screaming and forced stutter chance a bit, since this felt better with those reduced odds.
This is by no means a comprehensive list. Please suggest more syllable swaps to add (general "he" -> "eh" rules rather than specific words) if you happen to think of one, or point at ones that should be removed if you think one they're too on the nose or don't fit.
Why it's good
Expands the braindamage speech a bunch, making braindamage speech have an effect on more than just some very specific words. Tested pretty thoroughly and nothing seemed to break, so tested I guess. :cl:
- rscadd: Expands the braindamage speech, adding a good amount of extra words and syllables that will be replaced with their dumb counterpart. Braindamaged players might also find themselves forgetting a word once in a while.
- rscadd: Braindamaged players might find themselves gibbering incoherently if they try to speak too fast.
- tweak: Reduces the forced screaming chance and forced stutter chance when talking while braindamaged by 15 and 5 percent respectively, since those values felt better with this change.
I don't think running every brain damage message through at least 50 replacetexts is a good execution
I don't think running every brain damage message through at least 50 replacetexts is a good execution
I'll look into how to improve it, I have an idea based on catbeast code. I'm way out of my field here so it might take a while.
I think this is extra annoying from a gameplay perspective, but from a coding perspective please use some associative lists.
now that i think about it again, you can't really make this much faster?
why even bother with associative lists or making a custom "find and replace multiple" function?
time complexity is message length * number of replacements either way
Yeah, we figured something like that on the coder chat. The one idea that seems would be more performant was some fucked up schizophrenic regex to check for all chunks and replace them in one go, but I barely understand regex as is, I'm not a regexwizard that could craft something like that. So we instead came up with the idea of limiting the speech of brain damaged players to one sentence per second. It's not noticeable on regular gameplay, but macrospam (which, on testing, caused fucktons of CPU lag) would instead get the lines replaced with a gibbers uncontrollably emote, which is as performant as it can get (it's literally nulling the spoken sentence and calling emote("gibber").)
merge when??
merge when??
No idea. Dilt said he was ok with merging it if west also was. I then asked west about it a good while back and he gave a "sure whatever" since there was no real difference between assoc list and no assoc list, performance-wise (and the 1 line a second throttle compensates for the very inefficient replace list)