mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 09:08:30 +01:00
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)  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.  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) /🆑
This commit is contained in:
@@ -10,23 +10,42 @@
|
||||
var/list/channels = list()
|
||||
/// Flags for which "special" radio networks should be accessible
|
||||
var/special_channels = NONE
|
||||
var/datum/language/translated_language
|
||||
/// Assoc list of language to how well understood it is. 0 is invalid, 100 is perfect.
|
||||
var/list/language_data
|
||||
|
||||
greyscale_config = /datum/greyscale_config/encryptionkey_basic
|
||||
greyscale_colors = "#820a16#3758c4"
|
||||
|
||||
/obj/item/encryptionkey/examine(mob/user)
|
||||
. = ..()
|
||||
if(LAZYLEN(channels) || special_channels & RADIO_SPECIAL_BINARY)
|
||||
var/list/examine_text_list = list()
|
||||
for(var/i in channels)
|
||||
examine_text_list += "[GLOB.channel_tokens[i]] - [LOWER_TEXT(i)]"
|
||||
|
||||
if(special_channels & RADIO_SPECIAL_BINARY)
|
||||
examine_text_list += "[GLOB.channel_tokens[MODE_BINARY]] - [MODE_BINARY]"
|
||||
|
||||
. += span_notice("It can access the following channels; [jointext(examine_text_list, ", ")].")
|
||||
else
|
||||
if(!LAZYLEN(channels) && !(special_channels & RADIO_SPECIAL_BINARY) && !LAZYLEN(language_data))
|
||||
. += span_warning("Has no special codes in it. You should probably tell a coder!")
|
||||
return
|
||||
|
||||
var/list/examine_text_list = list()
|
||||
for(var/i in channels)
|
||||
examine_text_list += "[GLOB.channel_tokens[i]] - [LOWER_TEXT(i)]"
|
||||
|
||||
if(special_channels & RADIO_SPECIAL_BINARY)
|
||||
examine_text_list += "[GLOB.channel_tokens[MODE_BINARY]] - [MODE_BINARY]"
|
||||
|
||||
if(length(examine_text_list))
|
||||
. += span_notice("It can access the following channels; [jointext(examine_text_list, ", ")].")
|
||||
|
||||
var/list/language_text_list = list()
|
||||
for(var/lang in language_data)
|
||||
var/langstring = "[GLOB.language_datum_instances[lang].name]"
|
||||
switch(language_data[lang])
|
||||
if(25 to 50)
|
||||
langstring += " (poor)"
|
||||
if(50 to 75)
|
||||
langstring += " (average)"
|
||||
if(75 to 100)
|
||||
langstring += " (good)"
|
||||
language_text_list += langstring
|
||||
|
||||
if(length(language_text_list))
|
||||
. += span_notice("It can translate the following languages; [jointext(language_text_list, ", ")].")
|
||||
|
||||
/obj/item/encryptionkey/syndicate
|
||||
name = "syndicate encryption key"
|
||||
@@ -40,7 +59,9 @@
|
||||
name = "binary translator key"
|
||||
icon_state = "cypherkey_basic"
|
||||
special_channels = RADIO_SPECIAL_BINARY
|
||||
translated_language = /datum/language/machine
|
||||
language_data = list(
|
||||
/datum/language/machine = 100,
|
||||
)
|
||||
greyscale_config = /datum/greyscale_config/encryptionkey_basic
|
||||
greyscale_colors = "#24a157#3758c4"
|
||||
|
||||
@@ -219,7 +240,9 @@
|
||||
RADIO_CHANNEL_ENTERTAINMENT = 1,
|
||||
)
|
||||
special_channels = RADIO_SPECIAL_BINARY
|
||||
translated_language = /datum/language/machine
|
||||
language_data = list(
|
||||
/datum/language/machine = 100,
|
||||
)
|
||||
|
||||
/obj/item/encryptionkey/ai/evil //ported from NT, this goes 'inside' the AI.
|
||||
name = "syndicate binary encryption key"
|
||||
|
||||
@@ -35,8 +35,6 @@ GLOBAL_LIST_INIT(channel_tokens, list(
|
||||
drop_sound = 'sound/items/handling/headset/headset_drop1.ogg'
|
||||
sound_vary = TRUE
|
||||
var/obj/item/encryptionkey/keyslot2 = null
|
||||
/// A list of all languages that this headset allows the user to understand. Populated by language encryption keys.
|
||||
var/list/language_list
|
||||
|
||||
// headset is too small to display overlays
|
||||
overlay_speaker_idle = null
|
||||
@@ -111,8 +109,32 @@ GLOBAL_LIST_INIT(channel_tokens, list(
|
||||
|
||||
/// Grants all the languages this headset allows the mob to understand via installed chips.
|
||||
/obj/item/radio/headset/proc/grant_headset_languages(mob/grant_to)
|
||||
var/list/language_list = keyslot?.language_data?.Copy()
|
||||
|
||||
if(keyslot2)
|
||||
if(length(language_list))
|
||||
for(var/language in keyslot2.language_data)
|
||||
if(language_list[language] < keyslot2.language_data[language])
|
||||
language_list[language] = keyslot2.language_data[language]
|
||||
continue
|
||||
language_list[language] = keyslot2.language_data[language]
|
||||
|
||||
else
|
||||
language_list = keyslot2.language_data?.Copy()
|
||||
|
||||
for(var/language in language_list)
|
||||
grant_to.grant_language(language, language_flags = UNDERSTOOD_LANGUAGE, source = LANGUAGE_RADIOKEY)
|
||||
var/amount_understood = language_list[language]
|
||||
if(amount_understood >= 100)
|
||||
grant_to.grant_language(language, language_flags = UNDERSTOOD_LANGUAGE, source = LANGUAGE_RADIOKEY)
|
||||
else
|
||||
grant_to.grant_partial_language(language, amount = amount_understood, source = LANGUAGE_RADIOKEY)
|
||||
|
||||
/// Clears all radio related languages from the mob.
|
||||
/obj/item/radio/headset/proc/remove_headset_languages(mob/remove_from)
|
||||
if(QDELETED(remove_from)) //This can be called as a part of destroy
|
||||
return
|
||||
remove_from.remove_all_languages(source = LANGUAGE_RADIOKEY)
|
||||
remove_from.remove_all_partial_languages(source = LANGUAGE_RADIOKEY)
|
||||
|
||||
/obj/item/radio/headset/equipped(mob/user, slot, initial)
|
||||
. = ..()
|
||||
@@ -123,10 +145,7 @@ GLOBAL_LIST_INIT(channel_tokens, list(
|
||||
|
||||
/obj/item/radio/headset/dropped(mob/user, silent)
|
||||
. = ..()
|
||||
if(QDELETED(src)) //This can be called as a part of destroy
|
||||
return
|
||||
for(var/language in language_list)
|
||||
user.remove_language(language, language_flags = UNDERSTOOD_LANGUAGE, source = LANGUAGE_RADIOKEY)
|
||||
remove_headset_languages(user)
|
||||
|
||||
// Headsets do not become hearing sensitive as broadcasting instead controls their talk_into capabilities
|
||||
/obj/item/radio/headset/set_broadcasting(new_broadcasting, actual_setting = TRUE)
|
||||
@@ -482,22 +501,10 @@ GLOBAL_LIST_INIT(channel_tokens, list(
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
|
||||
|
||||
var/list/old_language_list = language_list?.Copy()
|
||||
language_list = list()
|
||||
if(keyslot?.translated_language)
|
||||
language_list += keyslot.translated_language
|
||||
if(keyslot2?.translated_language)
|
||||
language_list += keyslot2.translated_language
|
||||
|
||||
// If we're equipped on a mob, we should make sure all the languages
|
||||
// learned from our installed key chips are all still accurate
|
||||
// Updates radio languages entirely for the mob wearing the headset
|
||||
var/mob/mob_loc = loc
|
||||
if(istype(mob_loc) && mob_loc.get_item_by_slot(slot_flags) == src)
|
||||
// Remove all the languages we may not be able to know anymore
|
||||
for(var/language in old_language_list)
|
||||
mob_loc.remove_language(language, language_flags = UNDERSTOOD_LANGUAGE, source = LANGUAGE_RADIOKEY)
|
||||
|
||||
// And grant all the languages we definitely should know now
|
||||
remove_headset_languages(mob_loc)
|
||||
grant_headset_languages(mob_loc)
|
||||
|
||||
/obj/item/radio/headset/click_alt(mob/living/user)
|
||||
|
||||
Reference in New Issue
Block a user