Adds Common Second Language quirk, tweaks to partial understanding (#90614)

## About The Pull Request

- Tweaks partial understanding. 

Paragraphs are now split into sentences first creating more natural
breaks between sentences.

- Adds "Common Second Language" quirk

This quirk changes your default understanding of common (up to) 90%
(your choice), meaning you drop the occasional word.


![image](https://github.com/user-attachments/assets/63e9d67b-7db2-4d23-9d0f-bae175962db4)


![image](https://github.com/user-attachments/assets/840ef391-5126-4ba7-9298-804686bcd6df)

Additionally, when your sanity drops below a threshold, you become
forced to speak your native language, albeit with a partial
understanding applied for everyone else.

Incompatible with similar language quirks + can't be taken by humans
(yet?)

## Why It's Good For The Game

Just a fun way to play around with the new "partial understanding"
system.

## Changelog

🆑 Melbert
add: "Common Second Language" quirk
qol: Language translations chunk sentences together better, making
partial understanding a bit easier to parse.
/🆑
This commit is contained in:
MrMelbert
2025-04-20 22:18:05 -05:00
committed by Shadow-Quill
parent 52e970f101
commit 8eeca96108
14 changed files with 203 additions and 42 deletions

View File

@@ -435,16 +435,15 @@
taste_sensitivity = 32
liked_foodtypes = GROSS | MEAT | RAW | GORE
disliked_foodtypes = NONE
// List of english words that translate to zombie phrases
GLOBAL_LIST_INIT(english_to_zombie, list())
// List of english words that translate to zombie phrases
var/static/list/english_to_zombie = list()
/obj/item/organ/tongue/zombie/proc/add_word_to_translations(english_word, zombie_word)
GLOB.english_to_zombie[english_word] = zombie_word
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
english_to_zombie[english_word + plural_s(english_word)] = zombie_word
english_to_zombie[english_word + "ing"] = zombie_word
english_to_zombie[english_word + "ed"] = zombie_word
/obj/item/organ/tongue/zombie/proc/load_zombie_translations()
var/list/zombie_translation = strings("zombie_replacement.json", "zombie")
@@ -453,20 +452,20 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
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)
english_to_zombie = sort_list(english_to_zombie) // Alphabetizes the list (for debugging)
/obj/item/organ/tongue/zombie/modify_speech(datum/source, list/speech_args)
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))
if(!length(english_to_zombie))
load_zombie_translations()
// 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[LOWER_TEXT(word)]
word = english_to_zombie[LOWER_TEXT(word)]
translated_word_list += word ? word : FALSE
// all occurrences of characters "eiou" (case-insensitive) are replaced with "r"
@@ -501,6 +500,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
taste_sensitivity = 10 // LIZARDS ARE ALIENS CONFIRMED
modifies_speech = TRUE // not really, they just hiss
voice_filter = @{"[0:a] asplit [out0][out2]; [out0] asetrate=%SAMPLE_RATE%*0.8,aresample=%SAMPLE_RATE%,atempo=1/0.8,aformat=channel_layouts=mono [p0]; [out2] asetrate=%SAMPLE_RATE%*1.2,aresample=%SAMPLE_RATE%,atempo=1/1.2,aformat=channel_layouts=mono[p2]; [p0][0][p2] amix=inputs=3"}
// Aliens can only speak alien and a few other languages.
/obj/item/organ/tongue/alien/get_possible_languages()
return list(
@@ -557,6 +557,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
modifies_speech = FALSE
liked_foodtypes = VEGETABLES
disliked_foodtypes = FRUIT | CLOTH
languages_native = list(/datum/language/calcic)
/obj/item/organ/tongue/robot
name = "robotic voicebox"
@@ -611,6 +612,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
attack_verb_continuous = list("shocks", "jolts", "zaps")
attack_verb_simple = list("shock", "jolt", "zap")
voice_filter = @{"[0:a] asplit [out0][out2]; [out0] asetrate=%SAMPLE_RATE%*0.99,aresample=%SAMPLE_RATE%,volume=0.3 [p0]; [p0][out2] amix=inputs=2"}
languages_native = list(/datum/language/voltaic)
// Ethereal tongues can speak all default + voltaic
/obj/item/organ/tongue/ethereal/get_possible_languages()
@@ -623,6 +625,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
liked_foodtypes = SEAFOOD | ORANGES | BUGS | GORE
disliked_foodtypes = GROSS | CLOTH | RAW
organ_traits = list(TRAIT_WOUND_LICKER, TRAIT_FISH_EATER)
languages_native = list(/datum/language/nekomimetic)
/obj/item/organ/tongue/jelly
name = "jelly tongue"
@@ -631,6 +634,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
liked_foodtypes = MEAT | BUGS
disliked_foodtypes = GROSS
toxic_foodtypes = NONE
languages_native = list(/datum/language/slime)
/obj/item/organ/tongue/jelly/get_food_taste_reaction(obj/item/food, foodtypes = NONE)
// a silver slime created this? what a delicacy!
@@ -644,6 +648,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
say_mod = "chimpers"
liked_foodtypes = MEAT | FRUIT | BUGS
disliked_foodtypes = CLOTH
languages_native = list(/datum/language/monkey)
/obj/item/organ/tongue/moth
name = "moth tongue"
@@ -652,11 +657,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
liked_foodtypes = VEGETABLES | DAIRY | CLOTH
disliked_foodtypes = FRUIT | GROSS | BUGS | GORE
toxic_foodtypes = MEAT | RAW | SEAFOOD
/obj/item/organ/tongue/zombie
name = "rotting tongue"
desc = "Makes you speak like you're at the dentist and you just absolutely refuse to spit because you forgot to mention you were allergic to space shellfish."
say_mod = "moans"
languages_native = list(/datum/language/moffic)
/obj/item/organ/tongue/mush
name = "mush-tongue-room"
@@ -664,6 +665,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
icon = 'icons/obj/service/hydroponics/seeds.dmi'
icon_state = "mycelium-angel"
say_mod = "poofs"
languages_native = list(/datum/language/mushroom)
/obj/item/organ/tongue/pod
name = "pod tongue"
@@ -673,6 +675,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
disliked_foodtypes = GORE | MEAT | DAIRY | SEAFOOD | BUGS
foodtype_flags = PODPERSON_ORGAN_FOODTYPES
color = COLOR_LIME
languages_native = list(/datum/language/sylvan)
/obj/item/organ/tongue/golem
name = "golem tongue"
@@ -684,3 +687,4 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
liked_foodtypes = STONE
disliked_foodtypes = NONE //you don't care for much else besides stone
toxic_foodtypes = NONE //you can eat fucking uranium
languages_native = list(/datum/language/terrum)