From 9529063aa370dc0f217f0b60759cd50fc4fff95f Mon Sep 17 00:00:00 2001 From: Strommer Kilian Date: Thu, 2 May 2019 09:48:39 +0200 Subject: [PATCH] New brain trauma: expressive aphasia (#43608) * new mutation: simple speech * finalize simple speech and fix word list apostrophes * Is now a brain trauma instead * fix merge conflict * grammer fix * cleanup cause I'm an idiot * made the suffix list a bit easier to read * fix traits.dm --- code/__DEFINES/traits.dm | 2 +- code/datums/brain_damage/mild.dm | 41 ++ code/datums/mutations/speech.dm | 1 + code/modules/mob/living/say.dm | 1 + strings/1000_most_common.txt | 1035 ++++++++++++++++++++++++++++++ 5 files changed, 1079 insertions(+), 1 deletion(-) create mode 100644 strings/1000_most_common.txt diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 446fb141284..b029b0cc3ec 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -165,4 +165,4 @@ #define NINJA_SUIT_TRAIT "ninja-suit" #define ANTI_DROP_IMPLANT_TRAIT "anti-drop-implant" #define HIVEMIND_ONE_MIND_TRAIT "one_mind" -#define VR_ZONE_TRAIT "vr_zone_trait" \ No newline at end of file +#define VR_ZONE_TRAIT "vr_zone_trait" diff --git a/code/datums/brain_damage/mild.dm b/code/datums/brain_damage/mild.dm index 84bb0149978..3fc593f8e7e 100644 --- a/code/datums/brain_damage/mild.dm +++ b/code/datums/brain_damage/mild.dm @@ -182,3 +182,44 @@ addtimer(CALLBACK(owner, /mob/.proc/emote, "cough"), 12) owner.emote("cough") ..() + +/datum/brain_trauma/mild/expressive_aphasia + name = "Expressive Aphasia" + desc = "Patient is affected by partial loss of speech leading to a reduced vocabulary." + scan_desc = "inability to form complex sentences" + gain_text = "You lose your grasp on complex words." + lose_text = "You feel your vocabulary returning to normal again." + + var/static/list/common_words = world.file2list("strings/1000_most_common.txt") + +/datum/brain_trauma/mild/expressive_aphasia/on_say(message) + if(message) + var/list/message_split = splittext(message, " ") + var/list/new_message = list() + + for(var/word in message_split) + var/suffix = copytext(word,-1) + + // Check if we have a suffix and break it out of the word + if(suffix in list("." , "," , ";" , "!" , ":" , "?")) + word = copytext(word,1,-1) + else + suffix = "" + + word = html_decode(word) + + if(lowertext(word) in common_words) + new_message += word + suffix + else + if(prob(30) && message_split.len > 2) + new_message += pick("uh","erm") + break + else + var/list/charlist = string2charlist(word) // Stupid shit code + shuffle_inplace(charlist) + charlist.len = round(charlist.len * 0.5,1) + new_message += html_encode(jointext(charlist,"")) + suffix + + message = jointext(new_message, " ") + + return trim(message) diff --git a/code/datums/mutations/speech.dm b/code/datums/mutations/speech.dm index e188c6641c2..f6b87aca5b0 100644 --- a/code/datums/mutations/speech.dm +++ b/code/datums/mutations/speech.dm @@ -221,3 +221,4 @@ ..() owner.grant_language(/datum/language/common) owner.remove_language(/datum/language/beachbum) + diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index da137fdfaf9..63a35865293 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -324,6 +324,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list( return null /mob/living/proc/treat_message(message) + if(has_trait(TRAIT_UNINTELLIGIBLE_SPEECH)) message = unintelligize(message) diff --git a/strings/1000_most_common.txt b/strings/1000_most_common.txt new file mode 100644 index 00000000000..64e6fd2af88 --- /dev/null +++ b/strings/1000_most_common.txt @@ -0,0 +1,1035 @@ +a +able +about +above +accept +across +act +actually +add +admit +afraid +after +afternoon +again +against +age +ago +agree +ah +ahead +air +all +allow +almost +alone +along +already +alright +also +although +always +am +amaze +an +and +anger +angry +animal +annoy +another +answer +any +anymore +anyone +anything +anyway +apartment +apparently +appear +approach +are +area +arent +aren't +arm +around +arrive +as +ask +asleep +ass +at +attack +attempt +attention +aunt +avoid +away +baby +back +bad +bag +ball +band +bar +barely +bathroom +be +beat +beautiful +became +because +become +bed +bedroom +been +before +began +begin +behind +believe +bell +beside +besides +best +better +between +big +bit +bite +black +blink +block +blonde +blood +blue +blush +body +book +bore +both +bother +bottle +bottom +box +boy +boyfriend +brain +break +breakfast +breath +breathe +bright +bring +broke +broken +brother +brought +brown +brush +build +burn +burst +bus +business +busy +but +buy +by +call +calm +came +can +cant +can't +car +card +care +carefully +carry +case +cat +catch +caught +cause +cell +chair +chance +change +chase +check +cheek +chest +child +children +chuckle +city +class +clean +clear +climb +close +clothes +coffee +cold +college +color +come +comment +complete +completely +computer +concern +confuse +consider +continue +control +conversation +cool +corner +couch +could +couldnt +couldn't +counter +couple +course +cover +crack +crazy +cross +crowd +cry +cup +cut +cute +dad +damn +dance +dark +date +daughter +day +dead +deal +dear +death +decide +deep +definitely +desk +did +didnt +didn't +die +different +dinner +direction +disappear +do +doctor +does +doesnt +doesn't +dog +dont +don't +done +door +doubt +down +drag +draw +dream +dress +drink +drive +drop +drove +dry +during +each +ear +early +easily +easy +eat +edge +either +else +empty +end +enjoy +enough +enter +entire +escape +especially +even +evening +eventually +ever +every +everyone +everything +exactly +except +excite +exclaim +excuse +expect +explain +expression +eye +eyebrow +face +fact +fall +family +far +fast +father +fault +favorite +fear +feel +feet +fell +felt +few +field +fight +figure +fill +finally +find +fine +finger +finish +fire +first +fit +five +fix +flash +flip +floor +fly +focus +follow +food +foot +for +force +forget +form +forward +found +four +free +friend +from +front +frown +fuck +full +fun +funny +further +game +gasp +gave +gaze +gently +get +giggle +girl +girlfriend +give +given +glad +glance +glare +glass +go +God +gone +gonna +good +got +gotten +grab +great +green +greet +grey +grin +grip +groan +ground +group +grow +guard +guess +gun +guy +had +hadnt +hadn't +hair +half +hall +hallway +hand +handle +hang +happen +happy +hard +has +hate +have +havent +haven't +he +hed +he'd +hes +he's +head +hear +heard +heart +heavy +held +hell +hello +help +her +here +herself +hey +hi +hide +high +him +himself +his +hit +hold +home +hope +horse +hospital +hot +hour +house +how +however +hug +huge +huh +human +hundred +hung +hurry +hurt +I +Id +I'd +Ill +I'll +Im +I'm +Ive +I've +ice +idea +if +ignore +imagine +immediately +important +in +inside +instead +interest +interrupt +into +is +isnt +isn't +it +its +it's +its +jacket +jeans +jerk +job +join +joke +jump +just +keep +kept +key +kick +kid +kill +kind +kiss +kitchen +knee +knew +knock +know +known +lady +land +large +last +late +laugh +lay +lead +lean +learn +least +leave +led +left +leg +less +let +letter +lie +life +lift +light +like +line +lip +listen +little +live +lock +locker +long +look +lose +lost +lot +loud +love +low +lunch +mad +made +make +man +manage +many +mark +marry +match +matter +may +maybe +me +mean +meant +meet +memory +men +mention +met +middle +might +mind +mine +minute +mirror +miss +mom +moment +money +month +mood +more +morning +most +mother +mouth +move +movie +Mr. +Mrs. +much +mum +mumble +music +must +mutter +my +myself +name +near +nearly +neck +need +nervous +never +new +next +nice +night +no +nod +noise +none +normal +nose +not +note +nothing +notice +now +number +obviously +of +off +offer +office +often +oh +okay +old +on +once +one +only +onto +open +or +order +other +our +out +outside +over +own +pack +pain +paint +pair +pants +paper +parents +park +part +party +pass +past +pause +pay +people +perfect +perhaps +person +phone +pick +picture +piece +pink +piss +place +plan +play +please +pocket +point +police +pop +position +possible +power +practically +present +press +pretend +pretty +probably +problem +promise +pull +punch +push +put +question +quick +quickly +quiet +quietly +quite +race +rain +raise +ran +rang +rather +reach +read +ready +real +realize +really +reason +recognize +red +relationship +relax +remain +remember +remind +repeat +reply +respond +rest +return +ride +right +ring +road +rock +roll +room +rose +round +rub +run +rush +sad +safe +said +same +sat +save +saw +say +scare +school +scream +search +seat +second +see +seem +seen +self +send +sense +sent +serious +seriously +set +settle +seven +several +shadow +shake +share +she +shed +she'd +shes +she's +shift +shirt +shit +shock +shoe +shook +shop +short +shot +should +shoulder +shouldnt +shouldn't +shout +shove +show +shower +shrug +shut +sick +side +sigh +sight +sign +silence +silent +simply +since +single +sir +sister +sit +situation +six +skin +sky +slam +sleep +slightly +slip +slow +slowly +small +smell +smile +smirk +smoke +snap +so +soft +softly +some +somehow +someone +something +sometimes +somewhere +son +song +soon +sorry +sort +sound +space +speak +spend +spent +spoke +spot +stair +stand +star +stare +start +state +stay +step +stick +still +stomach +stood +stop +store +story +straight +strange +street +strong +struggle +stuck +student +study +stuff +stupid +such +suck +sudden +suddenly +suggest +summer +sun +suppose +sure +surprise +surround +sweet +table +take +taken +talk +tall +teacher +team +tear +teeth +tell +ten +than +thank +that +thats +that's +the +their +them +themselves +then +there +theres +there's +these +they +theyd +they'd +theyre +they're +thick +thing +think +third +this +those +though +thought +three +threw +throat +through +throw +tie +tight +time +tiny +tire +to +today +together +told +tomorrow +tone +tongue +tonight +too +took +top +totally +touch +toward +town +track +trail +train +tree +trip +trouble +trust +truth +try +turn +TV +twenty +two +type +uncle +under +understand +until +up +upon +us +use +usual +usually +very +visit +voice +wait +wake +walk +wall +want +warm +warn +was +wasnt +wasn't +watch +water +wave +way +we +well +we'll +were +we're +weve +we've +wear +week +weird +well +went +were +werent +weren't +wet +what +whats +what's +whatever +when +where +whether +which +while +whisper +white +who +whole +why +wide +wife +will +wind +window +wipe +wish +with +within +without +woke +woman +women +wont +won't +wonder +wood +word +wore +work +world +worry +worse +would +wouldnt +wouldn't +wow +wrap +write +wrong +yeah +year +yell +yes +yet +you +youd +you'd +youll +you'll +youre +you're +youve +you've +young +your +yourself +TRUE \ No newline at end of file