From e66aaaa0c257fb021a3aa5d6e3f8910fa599edad Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 26 Sep 2022 02:12:48 +0200 Subject: [PATCH] [MIRROR] Add speech modifier to zombie tongue [MDB IGNORE] (#16417) * Add speech modifier to zombie tongue (#69899) About The Pull Request A zombie rotten tongue has a complex language modifier. The language modifier works by: All occurrences of characters "eiou" (case-insensitive) are replaced with "r". All characters other than "zhrgbmna .!?-" (case-insensitive) are stripped. Multiple spaces are replaced with a single. Lower-case "r" at the end of words replaced with "rh". An "a" or "A" by itself will be replaced with "hra". The first character is capitalised. Some interesting dialogue examples: Bab, am gaa habbah abah zah namrh ah Bh!rh!b? Bob, are you happy about the death of Philip? Zah bang bang man ganna harm mah zambah? Will the Zombie Hunter attack me? Mah zambah nah harm brazzarz. I do not hurt brothers. Mah zambah ganna gangbang harmanz zammarrar. I will kill humans tomorrow. Mah zambah am nah habbah, an mah zambah gab, -Graaaagh!- I am not happy, and I say "Graaaagh!" The language idea was taken from a zombie game back in 2005 called Urban Dead. It's no longer developed and I made all the code myself while following the given language rule structures. Zombie Speech Translator Zombie Language Examples Zombie Dictionary Why It's Good For The Game Abracadabra - The Steve Miller Band Ah raab zha brahnz ahn zarh hagh, (I love the brains in your head) Ah ganna barg abgrah gangbang, (I'm gonna eat them when you're dead) Az rahnah zarh ranz ahn hahg ahahz, (Now as you run and hide away) Zarh harh mah zambah az hah zahz: (You hear my zombie as he says:) Abra-abra-gababra, (Abra-abra-cadabra) Ah ganna rahg arg ahn grab zarh! (I'm gonna reach out and grab ya!) Abra-abra-gababra, (Abra-abra-cadabra) Ah ganna rahg arg ahn grab zarh! (I'm gonna reach out and grab ya!) Changelog cl add: Rotten zombie tongue has a new speech modifier that converts spoken language into zombie sentences. If the person speaking is a high-functioning zombie this is bypassed. /cl * Add speech modifier to zombie tongue Co-authored-by: Tim --- code/modules/surgery/organs/tongue.dm | 61 ++++++- strings/zombie_replacement.json | 254 ++++++++++++++++++++++++++ 2 files changed, 305 insertions(+), 10 deletions(-) create mode 100644 strings/zombie_replacement.json diff --git a/code/modules/surgery/organs/tongue.dm b/code/modules/surgery/organs/tongue.dm index 68109c91988..25d29e2fb4e 100644 --- a/code/modules/surgery/organs/tongue.dm +++ b/code/modules/surgery/organs/tongue.dm @@ -320,21 +320,62 @@ modifies_speech = TRUE taste_sensitivity = 32 +// List of english words that translate to zombie phrases +GLOBAL_LIST_INIT(english_to_zombie, list()) + +/obj/item/organ/internal/tongue/zombie/proc/add_word_to_translations(english_word, zombie_word) + GLOB.english_to_zombie[english_word] = zombie_word + // zombies don't care about grammar (any tense or form is all translated to the same word) + GLOB.english_to_zombie[english_word + plural_s(english_word)] = zombie_word + GLOB.english_to_zombie[english_word + "ing"] = zombie_word + GLOB.english_to_zombie[english_word + "ed"] = zombie_word + +/obj/item/organ/internal/tongue/zombie/proc/load_zombie_translations() + var/list/zombie_translation = strings("zombie_replacement.json", "zombie") + for(var/zombie_word in zombie_translation) + // since zombie words are a reverse list, we gotta do this backwards + var/list/data = islist(zombie_translation[zombie_word]) ? zombie_translation[zombie_word] : list(zombie_translation[zombie_word]) + for(var/english_word in data) + add_word_to_translations(english_word, zombie_word) + GLOB.english_to_zombie = sort_list(GLOB.english_to_zombie) // Alphabetizes the list (for debugging) + /obj/item/organ/internal/tongue/zombie/modify_speech(datum/source, list/speech_args) - var/list/message_list = splittext(speech_args[SPEECH_MESSAGE], " ") - var/maxchanges = max(round(message_list.len / 1.5), 2) + var/message = speech_args[SPEECH_MESSAGE] + if(message[1] != "*") + // setup the global list for translation if it hasn't already been done + if(!length(GLOB.english_to_zombie)) + load_zombie_translations() - for(var/i = rand(maxchanges / 2, maxchanges), i > 0, i--) - var/insertpos = rand(1, message_list.len - 1) - var/inserttext = message_list[insertpos] + // make a list of all words that can be translated + var/list/message_word_list = splittext(message, " ") + var/list/translated_word_list = list() + for(var/word in message_word_list) + word = GLOB.english_to_zombie[lowertext(word)] + translated_word_list += word ? word : FALSE - if(!(copytext(inserttext, -3) == "..."))//3 == length("...") - message_list[insertpos] = inserttext + "..." + // all occurrences of characters "eiou" (case-insensitive) are replaced with "r" + message = replacetext(message, regex(@"[eiou]", "ig"), "r") + // all characters other than "zhrgbmna .!?-" (case-insensitive) are stripped + message = replacetext(message, regex(@"[^zhrgbmna.!?-\s]", "ig"), "") + // multiple spaces are replaced with a single (whitespace is trimmed) + message = replacetext(message, regex(@"(\s+)", "g"), " ") - if(prob(20) && message_list.len > 3) - message_list.Insert(insertpos, "[pick("BRAINS", "Brains", "Braaaiinnnsss", "BRAAAIIINNSSS")]...") + var/list/old_words = splittext(message, " ") + var/list/new_words = list() + for(var/word in old_words) + // lower-case "r" at the end of words replaced with "rh" + word = replacetext(word, regex(@"\lr\b"), "rh") + // an "a" or "A" by itself will be replaced with "hra" + word = replacetext(word, regex(@"\b[Aa]\b"), "hra") + new_words += word - speech_args[SPEECH_MESSAGE] = jointext(message_list, " ") + // if words were not translated, then we apply our zombie speech patterns + for(var/i in 1 to length(new_words)) + new_words[i] = translated_word_list[i] ? translated_word_list[i] : new_words[i] + + message = new_words.Join(" ") + message = capitalize(message) + speech_args[SPEECH_MESSAGE] = message /obj/item/organ/internal/tongue/alien name = "alien tongue" diff --git a/strings/zombie_replacement.json b/strings/zombie_replacement.json new file mode 100644 index 00000000000..8af2bb641b8 --- /dev/null +++ b/strings/zombie_replacement.json @@ -0,0 +1,254 @@ +{ + "zombie": { + "aaah": "oh", + "aabz": ["oops", "ops", "oof"], + "abzah": ["myself", "yourself", "himself", "herself", "itself", "ourselves", "themselves"], + "hah": ["he"], + "zam": ["him", "they", "them"], + "zhar": ["she", "her"], + "haz": ["have", "has"], + "habbanah": ["haven't", "havent"], + "haarh": "here", + "rahg": "reach", + "arg": "out", + "anazarh": "another", + "anazambah": "anyone", + "anazang": "anything", + "angrah": ["angry", "mad", "pissed", "upset", "yell", "scream"], + "zamran": "someone", + "narh": "north", + "azz": "ass", + "bahrn": "burn", + "bambg!n": "pumpkin", + "bam-mahbam": "suicide", + "banana man": "clown", + "banana": ["banana", "slip", "fall", "fell"], + "az": ["east", "as"], + "azgha!b": ["escape", "depature"], + "az!an": "asian", + "agzg": "ask", + "nag": ["annoy", "pester"], + "naga": ["liar", "snake"], + "nahgh": "knock", + "nambah": "number", + "braag": "blood", + "braaz": "please", + "brabram": "problem", + "bra!nbag": ["hat", "helmet"], + "ba": "by", + "g!zz": "kiss", + "ga!n": ["gain", "join", "profit"], + "gaam": "game", + "brrrh": "cold", + "h!gh": ["high", "up", "above"], + "bagan": "begin", + "baag": "book", + "azzarh": "over", + "b!g": ["big", "large", "giant", "huge", "massive", "enlarge"], + "b!rznah": "birthday", + "azzbag": ["seat", "chair", "sofa", "couch", "cockpit", "stool"], + "azzbangarh": "necrophillia", + "azz!gn": "assign", + "agzrah": ["xray", "x-ray"], + "zah": ["south", "the", "stay", "so"], + "zahn": ["sun", "son"], + "zanraaz": "sunrise", + "zanzat": "sunset", + "zarbraz": "surprise", + "zarman": ["sermon", "preach", "pray", "prayer"], + "zazzahz": "sister", + "brahg": "bright", + "zgaarah": "scary", + "zhaar": "share", + "zhanz": "chance", + "zharh": "light", + "znaagah": "sneak", + "znag": ["snow", "snag"], + "harrah": ["hurry", "fast"], + "gaz": "cast", + "ambraz": ["embrace", "accept"], + "zahgah": "shadow", + "n!gh": "night", + "n!ngah": "ninja", + "n!z": "nice", + "baza": "busy", + "bahrang": "boring", + "arn": "mine", + "raz": "west", + "ana": ["1", "one"], + "zma": ["2", "two"], + "zhraa": ["3", "three"], + "haar": ["4", "four"], + "raah": ["5", "five"], + "zaz": ["6", "six"], + "zaban": ["7", "seven"], + "aaghz": ["8", "eight"], + "nahn": ["9", "nine"], + "zhan": ["10", "ten"], + "hangarg": ["100", "hundred"], + "harzanz": ["1000", "1,000", "thousand"], + "m!rrh!an": ["1000000", "1,000,000", "million"], + "mah zambah": "i", + "ag": "it", + "marh": "more", + "maz hab": "need", + "maz": "must", + "mazagaam": "metagame", + "marharhahar": "motherfucker", + "mazah": "mercy", + "marnang": "morning", + "aga!n": "again", + "ag!ng": ["aging", "old"], + "agzahra": "exactly", + "harb": "hard", + "zhag": "weak", + "angarzangang": "understand", + "gahmangang": "demand", + "barragahz": ["barricade", "cade", "airlock", "door", "bolt", "wall", "sandbag", "window", "weld"], + "barg": "eat", + "brang": "bring", + "bram": "from", + "rabah": "lover", + "raab": "love", + "habbah": "happy", + "abah": "about", + "ah": ["of", "if"], + "ahbgrag": "upgrade", + "harh": "hear", + "mama": ["mom", "mother", "mama"], + "baba": ["dad", "papa", "father"], + "babah": ["baby", "kid", "child"], + "ahn": "in", + "ahn-na-ahn": "between", + "ahahz": "away", + "anh": "and", + "ann": "on", + "arghazzm": "orgasm", + "abrahb": ["afraid", "fear"], + "hanah": "honey", + "hag": "hug", + "zaan": "soon", + "zagzaz": "success", + "gan": "can", + "zang": "change", + "zangz": "thanks", + "zarrah": "sorry", + "zanh": ["can't", "cant", "cannot"], + "gang": ["group", "mob", "horde"], + "barbaga zaarz": "bbq sauce", + "hab": "help", + "ahnna": "into", + "arahn": "around", + "za": "to", + "ahn!nn": "within", + "aham": "ahem", + "anamah": "animal", + "zaa": ["see", "saw", "seen", "vision", "sight"], + "z!gzag": ["zigzag", "obstruct", "dodge", "avoid"], + "z!gn": "sign", + "z!ng": "sing", + "z!ngz": "thing", + "mabban": "move", + "rabhabh": "revive", + "zammarrar": "tomorrow", + "graan": "green", + "arh": "or", + "arm": "arm", + "arzhahm": "awesome", + "arrang": ["along", "with", "alongside"], + "arza": ["also", "too"], + "bgaz": "because", + "mah zambah brazzahz": ["we", "us"], + "grazzaz": "glasses", + "habban": "heaven", + "mazzah man": "chaplain", + "hanz": "hand", + "hab-ganna": ["want", "gonna have"], + "magma": ["magma", "lava"], + "manzhan": "mansion", + "harmbargarz": "hamburger", + "harrazz": "harass", + "namz": "name", + "ramambarh": "remember", + "rh!zzan": "listen", + "rabrarah": "library", + "ragargarh": "recorder", + "zarh": ["you", "your", "you're", "ya"], + "hagh": "head", + "RNA": "DNA", + "zambahz": "zombies", + "zzzz": ["chill", "relax", "sleep", "calm", "peace", "dream"], + "bah": ["bad", "evil", "but"], + "gag": ["gross", "nasty", "vomit", "smelly", "stinky", "stench", "foul", "quiet", "silence", "shutup"], + "gammah": ["give", "gimmie"], + "gah": ["get", "go"], + "gargazz": ["body", "corpse"], + "rag": ["uniform", "suit", "rag", "clothing", "jumpsuit"], + "garbagz": ["garbage", "janitor", "custodian", "trash", "clean", "dirt", "filth", "mess", "junk"], + "bagman": ["doctor", "medic", "healer", "paramedic", "curator", "librarian"], + "gangbang": ["death", "kill", "die", "slay", "ERP", "punish", "detain", "prison", "prisoner", "brig", "cell", "jail", "perma", "permabrig"], + "bag": ["duffle", "dufflebag", "pocket", "box", "bag", "backpack", "storage", "inventory"], + "aarbagz": ["airbag", "atmos", "airtank", "canister", "air", "atmos tech", "atmospherics", "tank", "gas", "flood", "siphon"], + "bar": ["bar", "drink", "alchol", "liquor"], + "bar man": "bartender", + "barn": ["hydroponics", "botany", "office", "room"], + "brainz barn": ["kitchen", "cafe", "service"], + "nah": ["not", "nope", "no", "deny", "don't", "dont"], + "nabarh": "never", + "nabarmang": "nevermind", + "naz!n": "nothing", + "abar": "all", + "abara": "every", + "abarahaarh": "everywhere", + "abargargazz": "everybody", + "abban": "open", + "abzarb": ["drink", "absorb"], + "gaa": ["yes", "ya", "okay", "alright"], + "abargamz": "always", + "am": ["is", "are", "am"], + "aman": "amen", + "amaz!ng": "amazing", + "zahz": ["say", "says", "that"], + "gab": ["told", "talk", "speak", "spoke", "language", "communication", "radio", "comms", "text", "word", "speech"], + "mrh": ["why", "how", "when", "who", "what", "where"], + "zmazh": ["smash", "break", "destroy", "deconstruct", "dismantle", "ruin", "destruction", "demolish"], + "ranz": ["run", "ran", "ride"], + "hahg": ["hide", "hidden", "shelter"], + "zanz": ["dance", "spin", "flip"], + "ganna": ["going", "gonna"], + "mannah": ["many", "much", "very"], + "mazzargh": "massacure", + "mazzah": ["lord", "god", "religion", "chapel", "altar", "bible", "messiah", "christ"], + "mararana": ["weed", "420", "marijuana", "drug"], + "barb": ["knife", "poke", "thorn", "joke"], + "mmmm": ["delicious", "tasty", "like", "enjoy"], + "barbarh": "barber", + "bargahn": "bargain", + "bargh": "barge", + "ban!zh": ["ban", "banish"], + "brazzarz": ["brother", "skeleton", "skele"], + "zambah": ["zombie", "undead", "dead", "horde"], + "gangbang harmanz": ["sec", "security", "assistant", "greyshirt", "greytide", "cargo", "syndie", "rev", "shitsec", "shitcurity"], + "ganz": ["gun", "rifle", "taser", "shotgun", "revovler", "sniper", "pistol"], + "bang": ["bomb", "detonate", "explode", "explosion", "boom", "bang", "noise", "loud"], + "bang-bang": ["bullet", "shot", "shoot", "fire", "laser", "lazer"], + "harm": ["attack", "punch", "hit", "throw", "fight", "strike", "combat", "choke", "suffoicate", "baton", "harmbaton"], + "ram": ["smash", "smack", "punch", "tackle", "kick", "push", "beat"], + "zhangh": ["stab", "slash", "slice"], + "bang bang man": ["officer", "warden", "hos", "bounty hunter", "hunt", "hunter"], + "manbagz": ["testicle", "balls"], + "grahn": ["groan", "gasp", "crit", "moan", "unconscious"], + "gahn": "gone", + "ganarazharh": ["power", "apc", "generator", "smes"], + "grabz": ["grab", "hold", "held", "grip", "restrain", "handcuff", "cuff", "arrest"], + "mah": ["my", "me"], + "mana man": "wizard", + "mana": "magic", + "mana bang-bang": "spell", + "mahg": "make", + "mannarz": "manner", + "brainz": ["brain", "intelligence", "smart", "hungry", "hunger", "eat", "meat", "desert"], + "harman": ["human", "food", "person", "groceries"], + "harmanz": ["crew", "people", "humans"] + } +}