Files
Bubberstation/code/modules/language/codespeak.dm
MrMelbert 67dd51be79 Reworks language translations. Add partial language understanding. Bilingual update. (#90252)
## About The Pull Request

Fixes #89445 (well, technically. It fixes the bug associated but these
`say`s should really be emotes.)

Three things:

1. Reworks how language translation works.

Rather than scrambling a sentence into a language entirely, sentences
are now scrambled on a per-word basis.

Additionally, the 1000 most common words of a language are *never*
re-scrambled across the duration of a round. Once it's set it's set in
stone.

Example: (Sample / Old / New)


![image](https://github.com/user-attachments/assets/69be41fa-bc40-45f0-bd80-e24e799c9f38)

This allows for a number of things:

- More consistent translations, making it (more) viable to actually
"teach" someone words for something
- Maintaining emphasis such as caps (but not `||`, `++`, or `__` - at
least not yet)
- The following:

2. Adds partial language understanding

Some languages can understand portions of other languages.


![image](https://github.com/user-attachments/assets/b6eee2c7-f564-437b-8c7a-bd1d88a9b680)

This pr adds the following:
- Those who understand Beachtongue can understand 50% of Common and 33%
of Uncommon words.
- Those who understand Common can understand 33% of Beachtongue and 20%
of Uncommon words.
- Those who understand Uncommon can understand 20% of Common and 20% of
Beachtongue words.

3. Bilingual quirk has been expanded to accomodate these changes.

There are now two more preferences:
- Language Speakable
- You can toggle this, so you only understand the language, rather than
understand AND speak.
- Language Skill
- If you choose to be unable to speak the language, you can set how much
of the language you can understand, down to 10%.

## Why It's Good For The Game

Playing around languages is fun, but due to the way our translation
works, ALL context is immediately lost for what the other person may be
saying.

If the other person is shouting in all caps? Output language is normal
chatting. This is lame!

Even if someone is unable to understand you, there's a LOT you can
convey just by how you speak, and getting that across in game is quite
difficult when all translations get mauled so badly.

So this changes that. 

- Emphasis like caps lock is maintained, so you see someone shouting in
caps in a foreign language you can probably intuit something is wrong
(but not what is wrong!)
- Some languages can gleam bits of other languages, so you MIGHT be able
to pick out context if you pay close attention
- "Brother" languages will now feel more like "brothers" and not
completely divergent
- You can even "teach" someone words in your language - at least the
most common words! (Until next round)

## Changelog

🆑 Melbert
add: Languages can now have partial understanding of other languages.
More common English words are more likely to be mutually understood.
add: Those who understand Beachtongue can understand 50% of Common and
33% of Uncommon words.
add: Those who understand Common can understand 33% of Beachtongue and
20% of Uncommon words.
add: Those who understand Uncommon can understand 20% of Common and 20%
of Beachtongue words.
add: Bilingual quirk: You can now choose between being able to speak or
not speak the language
add: Bilingual quirk: You can now choose to have partial understanding
of your language, rather than full.
qol: If you speak in ALL CAPS in a foreign language, the translated
words will also be ALL CAPS.
qol: Many more forms of punctuation are now conveyed across
translations.
qol: The 1000 most common English words will now never be scrambled when
translating into other languages for the duration of the round. This
means you can actually "learn" some words if you are especially
attentive! (Until the next round at least)
refactor: Refactored language translations. Report if you see any super
odd looking translations.
fix: Force-says forcing you to speak common (such as cult invocations)
will now correctly force you to speak common (even if you don't know
common)
/🆑
2025-04-13 22:01:33 +01:00

28 lines
848 B
Plaintext

/datum/language/codespeak
name = "Codespeak"
desc = "Syndicate operatives can use a series of codewords to convey complex information, while sounding like random concepts and drinks to anyone listening in."
key = "t"
default_priority = 0
flags = TONGUELESS_SPEECH | LANGUAGE_HIDE_ICON_IF_NOT_UNDERSTOOD
icon_state = "codespeak"
always_use_default_namelist = TRUE // No syllables anyways
/datum/language/codespeak/scramble_sentence(input, list/mutual_languages)
var/sentence = read_word_cache(input)
if(sentence)
return sentence
sentence = ""
var/list/words = list()
while(length_char(sentence) < length_char(input))
words += generate_code_phrase(return_list=TRUE)
sentence = jointext(words, ", ")
sentence = capitalize(sentence)
sentence += find_last_punctuation(input)
write_word_cache(input, sentence)
return sentence