From 0a3f7d384d3c1ca481c7e72fb4c4c8490ca0fa12 Mon Sep 17 00:00:00 2001 From: MortoSasye Date: Sun, 29 Sep 2024 01:28:00 -0300 Subject: [PATCH 1/4] I'm just ken --- .../~doppler_defines/declarations.dm | 2 + code/__DEFINES/~doppler_defines/language.dm | 5 + code/_globalvars/traits/_traits.dm | 1 + code/_globalvars/traits/admin_tooling.dm | 1 + .../preferences/middleware/_middleware.dm | 12 ++ .../primitive_genemod/code/language.dm | 2 +- .../languages/code/language menu/_language.dm | 22 +++ .../code/language menu/client_languages.dm | 169 ++++++++++++++++++ .../code/language menu/language_holder.dm | 111 ++++++++++++ .../language menu/language_preferences.dm | 29 +++ .../languages/{ => code}/language_datums.dm | 22 ++- .../languages/{ => icons}/language.dmi | Bin .../modular_mob_spawn/code/mob_spawn.dm | 9 + .../{ => code}/excitable/quirk.dm | 0 .../modular_quirks/code/good_quirks.dm | 9 + .../{ => code}/overwrites/musician.dm | 0 .../overwrites/code/species.dm | 16 ++ .../primitive_genemod/primitive_genemod.dm | 2 +- tgstation.dme | 12 +- .../CharacterPreferenceWindow.tsx | 27 ++- .../PreferencesMenu/LanguagesMenu.tsx | 83 +++++++++ .../tgui/interfaces/PreferencesMenu/data.ts | 13 ++ 22 files changed, 538 insertions(+), 9 deletions(-) create mode 100644 code/__DEFINES/~doppler_defines/language.dm create mode 100644 modular_doppler/languages/code/language menu/_language.dm create mode 100644 modular_doppler/languages/code/language menu/client_languages.dm create mode 100644 modular_doppler/languages/code/language menu/language_holder.dm create mode 100644 modular_doppler/languages/code/language menu/language_preferences.dm rename modular_doppler/languages/{ => code}/language_datums.dm (70%) rename modular_doppler/languages/{ => icons}/language.dmi (100%) rename modular_doppler/modular_quirks/{ => code}/excitable/quirk.dm (100%) create mode 100644 modular_doppler/modular_quirks/code/good_quirks.dm rename modular_doppler/modular_quirks/{ => code}/overwrites/musician.dm (100%) create mode 100644 tgui/packages/tgui/interfaces/PreferencesMenu/LanguagesMenu.tsx diff --git a/code/__DEFINES/~doppler_defines/declarations.dm b/code/__DEFINES/~doppler_defines/declarations.dm index bc4ec3858dbf7..88fbb381b8a2c 100644 --- a/code/__DEFINES/~doppler_defines/declarations.dm +++ b/code/__DEFINES/~doppler_defines/declarations.dm @@ -6,3 +6,5 @@ #define TRAIT_EXCITABLE "wagwag" /// Trait for hemophages particularly! #define TRAIT_OXYIMMUNE "oxyimmune" // Immune to oxygen damage, ideally give this to all non-breathing species or bad stuff will happen +// Trait for extra language point. +#define TRAIT_LINGUIST "Linguist" diff --git a/code/__DEFINES/~doppler_defines/language.dm b/code/__DEFINES/~doppler_defines/language.dm new file mode 100644 index 0000000000000..14d7782365124 --- /dev/null +++ b/code/__DEFINES/~doppler_defines/language.dm @@ -0,0 +1,5 @@ +#define LANGUAGE_UNDERSTOOD 1 +#define LANGUAGE_SPOKEN 2 +// LANGUAGE SOURCE DEFINES +/// Use this when granting languages in special() for spawner roles, to prevent prefs from removing them +#define LANGUAGE_SPAWNER "spawner" diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index 798c2eae7ae45..dafb51d8d6ef1 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -699,6 +699,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_EXCITABLE" = TRAIT_EXCITABLE, "TRAIT_TWITCH_ADAPTED" = TRAIT_TWITCH_ADAPTED, "TRAIT_GOLEM_LIMBATTACHMENT" = TRAIT_GOLEM_LIMBATTACHMENT, + "TRAIT_LINGUIST" = TRAIT_LINGUIST, ), // DOPPLER EDIT ADDITION END )) diff --git a/code/_globalvars/traits/admin_tooling.dm b/code/_globalvars/traits/admin_tooling.dm index c1910e642fc84..8447ca019c1b1 100644 --- a/code/_globalvars/traits/admin_tooling.dm +++ b/code/_globalvars/traits/admin_tooling.dm @@ -382,6 +382,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list( "TRAIT_DETECTIVE" = TRAIT_DETECTIVE, "TRAIT_EXCITABLE" = TRAIT_EXCITABLE, "TRAIT_TWITCH_ADAPTED" = TRAIT_TWITCH_ADAPTED, + "TRAIT_LINGUIST" = TRAIT_LINGUIST ), // DOPPLER EDIT ADDITION END )) diff --git a/code/modules/client/preferences/middleware/_middleware.dm b/code/modules/client/preferences/middleware/_middleware.dm index 8f47f73642c80..37a01371db8ef 100644 --- a/code/modules/client/preferences/middleware/_middleware.dm +++ b/code/modules/client/preferences/middleware/_middleware.dm @@ -50,3 +50,15 @@ /// Called when a character is changed. /datum/preference_middleware/proc/on_new_character(mob/user) return + +//DOPPLER EDIT +/// Called after every update_preference, returns TRUE if this handled it. +/datum/preference_middleware/proc/post_set_preference(mob/user, preference, value) + return FALSE + +/// Called when applying preferences to the mob. +/datum/preference_middleware/proc/apply_to_human(mob/living/carbon/human/target, datum/preferences/preferences, visuals_only = FALSE) //NOVA EDIT CHANGE + SHOULD_NOT_SLEEP(TRUE) + SHOULD_CALL_PARENT(FALSE) + return +//DOPPLER EDIT END diff --git a/modular_doppler/hearthkin/primitive_genemod/code/language.dm b/modular_doppler/hearthkin/primitive_genemod/code/language.dm index 45e16e407d1c4..43a79ef522344 100644 --- a/modular_doppler/hearthkin/primitive_genemod/code/language.dm +++ b/modular_doppler/hearthkin/primitive_genemod/code/language.dm @@ -15,4 +15,4 @@ icon_state = "omgkittyhiii" icon = 'modular_doppler/hearthkin/primitive_genemod/icons/language_icon.dmi' default_priority = 94 - // secret = TRUE //this needs a dedicated module for language + secret = TRUE diff --git a/modular_doppler/languages/code/language menu/_language.dm b/modular_doppler/languages/code/language menu/_language.dm new file mode 100644 index 0000000000000..776c609b0f619 --- /dev/null +++ b/modular_doppler/languages/code/language menu/_language.dm @@ -0,0 +1,22 @@ +/datum/language/ + /// Should this be hidden on the language buy menu? + var/secret = FALSE + + +/datum/language/aphasia + secret = TRUE + +/datum/language/codespeak + secret = TRUE + +/datum/language/drone + secret = TRUE + +/datum/language/narsie + secret = TRUE + +/datum/language/piratespeak + secret = TRUE + +/datum/language/xenocommon + secret = TRUE diff --git a/modular_doppler/languages/code/language menu/client_languages.dm b/modular_doppler/languages/code/language menu/client_languages.dm new file mode 100644 index 0000000000000..a937f51d60725 --- /dev/null +++ b/modular_doppler/languages/code/language menu/client_languages.dm @@ -0,0 +1,169 @@ +#define MAX_LANGUAGES_NORMAL 3 +#define MAX_LANGUAGES_LINGUIST 4 + +/datum/asset/spritesheet/languages + name = "languages" + early = TRUE + cross_round_cachable = TRUE + +/datum/asset/spritesheet/languages/create_spritesheets() + var/list/to_insert = list() + + if(!GLOB.all_languages.len) + stack_trace("Warning: Language spritesheets could not be created because language subsystem has not been loaded yet. This should not happen--adjust the init_order in master_files/code/controllers/subsystem/language.dm.") + return + + for (var/language_name in GLOB.all_languages) + var/datum/language/language = GLOB.language_datum_instances[language_name] + var/icon/language_icon = icon(language.icon, icon_state = language.icon_state) + to_insert[sanitize_css_class_name(language.name)] = language_icon + + for (var/spritesheet_key in to_insert) + Insert(spritesheet_key, to_insert[spritesheet_key]) + +/// Middleware to handle languages +/datum/preference_middleware/languages + /// A associative list of language names to their typepath + var/static/list/name_to_language = list() + action_delegations = list( + "give_language" = PROC_REF(give_language), + "remove_language" = PROC_REF(remove_language), + ) + +/datum/preference_middleware/languages/apply_to_human(mob/living/carbon/human/target, datum/preferences/preferences, visuals_only = FALSE) + var/datum/language_holder/language_holder = target.get_language_holder() + language_holder.adjust_languages_to_prefs(preferences) + +/datum/preference_middleware/languages/get_ui_assets() + return list( + get_asset_datum(/datum/asset/spritesheet/languages), + ) + +/datum/preference_middleware/languages/post_set_preference(mob/user, preference, value) + if(preference != "species") + return + preferences.languages = list() + var/species_type = preferences.read_preference(/datum/preference/choiced/species) + var/datum/species/species = new species_type() + var/datum/language_holder/lang_holder = new species.species_language_holder() + for(var/language in preferences.get_adjusted_language_holder()) + preferences.languages[language] = LANGUAGE_SPOKEN + qdel(lang_holder) + qdel(species) + + for(var/language in lang_holder.spoken_languages) + preferences.languages[language] = LANGUAGE_SPOKEN + + qdel(lang_holder) + qdel(species) + + return ..() + +/datum/preference_middleware/languages/get_ui_data(mob/user) + if(length(name_to_language) != length(GLOB.all_languages)) + initialize_name_to_language() + + var/list/data = list() + + var/max_languages = preferences.all_quirks.Find(TRAIT_LINGUIST) ? MAX_LANGUAGES_LINGUIST : MAX_LANGUAGES_NORMAL + var/species_type = preferences.read_preference(/datum/preference/choiced/species) + var/datum/species/species = new species_type() + var/datum/language_holder/lang_holder = preferences.get_adjusted_language_holder() + if(!preferences.languages || !preferences.languages.len || (preferences.languages && preferences.languages.len > max_languages)) // Too many languages, or no languages. + preferences.languages = list() + for(var/language in lang_holder.spoken_languages) + preferences.languages[language] = LANGUAGE_SPOKEN + + var/list/selected_languages = list() + var/list/unselected_languages = list() + + for (var/language_name in GLOB.all_languages) + var/datum/language/language = GLOB.language_datum_instances[language_name] + + if(language.secret && !(language.type in species.language_prefs_whitelist)) // For ghostrole species who are able to speak a secret language, e.g. ashwalkers, display it. + continue + + if(species.always_customizable && !(language.type in lang_holder.spoken_languages)) // For the ghostrole species. We don't want ashwalkers speaking beachtongue now. + continue + if(preferences.languages[language.type]) + selected_languages += list(list( + "description" = language.desc, + "name" = language.name, + "icon" = sanitize_css_class_name(language.name) + )) + else + unselected_languages += list(list( + "description" = language.desc, + "name" = language.name, + "icon" = sanitize_css_class_name(language.name) + )) + + qdel(lang_holder) + qdel(species) + + data["total_language_points"] = max_languages + data["selected_languages"] = selected_languages + data["unselected_languages"] = unselected_languages + return data + +/// (Re-)Initializes the `name_to_language` associative list, to ensure that it's properly populated. +/datum/preference_middleware/languages/proc/initialize_name_to_language() + name_to_language = list() + for(var/language_name in GLOB.all_languages) + var/datum/language/language = GLOB.language_datum_instances[language_name] + name_to_language[language.name] = language_name + +/** + * Proc that gives a language to a character, granted that they don't already have too many + * of them, based on their maximum amount of languages. + * + * Arguments: + * * params - List of parameters, given to us by the `act()` method from TGUI. Needs to + * contain a value under `"language_name"`. + * + * Returns TRUE all the time, to ensure that the UI is updated. + */ +/datum/preference_middleware/languages/proc/give_language(list/params) + var/language_name = params["language_name"] + var/max_languages = preferences.all_quirks.Find(TRAIT_LINGUIST) ? MAX_LANGUAGES_LINGUIST : MAX_LANGUAGES_NORMAL + + if(preferences.languages && preferences.languages.len == max_languages) // too many languages + return TRUE + + preferences.languages[name_to_language[language_name]] = LANGUAGE_SPOKEN + return TRUE + +/** + * Proc that removes a language from a character. + * + * Arguments: + * * params - List of parameters, given to us by the `act()` method from TGUI. Needs to + * contain a value under `"language_name"`. + * + * Returns TRUE all the time, to ensure that the UI is updated. + */ +/datum/preference_middleware/languages/proc/remove_language(list/params) + var/language_name = params["language_name"] + preferences.languages -= name_to_language[language_name] + return TRUE + +/// Cleans up any invalid languages. Typically happens on language renames and codedels. +/datum/preferences/proc/sanitize_languages() + var/languages_edited = FALSE + for(var/lang_path as anything in languages) + if(!lang_path) + languages.Remove(lang_path) + languages_edited = TRUE + continue + + var/datum/language/language = new lang_path() + // Yes, checking subtypes is VERY necessary, because byond doesn't check to see if a path is valid at runtime! + // If you delete /datum/language/meme, it will still load as /datum/language/meme, and will instantiate with /datum/language's defaults! + var/species_type = read_preference(/datum/preference/choiced/species) + var/datum/species/species = new species_type() + if(!(language.type in subtypesof(/datum/language)) || (language.secret && !(language.type in species.language_prefs_whitelist))) + languages.Remove(lang_path) + languages_edited = TRUE + qdel(species) + qdel(language) + return languages_edited diff --git a/modular_doppler/languages/code/language menu/language_holder.dm b/modular_doppler/languages/code/language menu/language_holder.dm new file mode 100644 index 0000000000000..0a3ad41b12cbe --- /dev/null +++ b/modular_doppler/languages/code/language menu/language_holder.dm @@ -0,0 +1,111 @@ +GLOBAL_DATUM_INIT(language_holder_adjustor, /datum/language_holder_adjustor, new) + +/// Language code needs to be purged. Make sure, once and for all, that we get the correct languages on spawn. +/// Every time a crew member joins the adjustor will personally fix their language, because there is too much coupling between mind and language code to do it reliably otherwise. +/// It has already needed to be fixed like 3 times. This will (hopefully) be the final time. +/datum/language_holder_adjustor/New() + RegisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED, PROC_REF(handle_new_player)) + +/datum/language_holder_adjustor/proc/handle_new_player(datum/source, mob/living/carbon/human/new_crewmember, rank) + SIGNAL_HANDLER + + // sanity checking because we really do not want to be causing any runtimes + if(!istype(new_crewmember)) + return + if(isnull(new_crewmember.mind)) + return + + var/datum/language_holder/language_holder = new_crewmember.get_language_holder() + + if(isnull(language_holder)) + return + + language_holder.adjust_languages_to_prefs(new_crewmember.client?.prefs) + +/datum/language_holder_adjustor/Destroy() + ..() + UnregisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED) + +/datum/language_holder/proc/adjust_languages_to_prefs(datum/preferences/preferences) + // no prefs? then don't remove any languages + if(!preferences) + return + + // remove the innate languages (like common, and other species languages) and instead use the language prefs + // do not remove any languages granted by spawners, which are denoted by source = LANGUAGE_SPAWNER + remove_languages_by_source(list(LANGUAGE_MIND, LANGUAGE_ATOM, LANGUAGE_SPECIES)) + + for(var/lang_path in preferences.languages) + grant_language(lang_path) + + get_selected_language() + +/// Removes every language whose source(s) match the provided source list arg +/datum/language_holder/proc/remove_languages_by_source(list/sources) + if(!length(sources)) + return + for(var/language in understood_languages) + for(var/source in sources) + remove_language(language, ALL, source) + // in most cases spoken_languages should be empty by now, but just in case we should remove what's left + for(var/language in spoken_languages) + for(var/source in sources) + remove_language(language, ALL, source) + +//************************************************ +//* Specific language holders * +//* Use atom language sources only. * +//************************************************/ + +/datum/language_holder/machine // SYNTHETIC LIZARD & CO LANGUAGE + understood_languages = list(/datum/language/common = list(LANGUAGE_ATOM), + /datum/language/machine = list(LANGUAGE_ATOM)) + spoken_languages = list(/datum/language/common = list(LANGUAGE_ATOM), + /datum/language/machine = list(LANGUAGE_ATOM)) + +/// Modularized the Cyborg and AI language_holder, add here the languages that you want them to be able to speak and understand. +/datum/language_holder/synthetic + understood_languages = list( + /datum/language/common = list(LANGUAGE_ATOM), + /datum/language/uncommon = list(LANGUAGE_ATOM), + /datum/language/machine = list(LANGUAGE_ATOM), + /datum/language/draconic = list(LANGUAGE_ATOM), + /datum/language/moffic = list(LANGUAGE_ATOM), + /datum/language/calcic = list(LANGUAGE_ATOM), + /datum/language/voltaic = list(LANGUAGE_ATOM), + /datum/language/nekomimetic = list(LANGUAGE_ATOM), + /datum/language/gutter = list(LANGUAGE_ATOM), + /datum/language/yangyu = list(LANGUAGE_ATOM), + /datum/language/monkey = list(LANGUAGE_ATOM), + /datum/language/slime = list(LANGUAGE_ATOM), + /datum/language/beachbum = list(LANGUAGE_ATOM), + /datum/language/mushroom = list(LANGUAGE_ATOM), + /datum/language/shadowtongue = list(LANGUAGE_ATOM), + /datum/language/buzzwords = list(LANGUAGE_ATOM), + /datum/language/terrum = list(LANGUAGE_ATOM), + /datum/language/sylvan = list(LANGUAGE_ATOM), + ) + spoken_languages = list( + /datum/language/common = list(LANGUAGE_ATOM), + /datum/language/uncommon = list(LANGUAGE_ATOM), + /datum/language/machine = list(LANGUAGE_ATOM), + /datum/language/draconic = list(LANGUAGE_ATOM), + /datum/language/moffic = list(LANGUAGE_ATOM), + /datum/language/calcic = list(LANGUAGE_ATOM), + /datum/language/voltaic = list(LANGUAGE_ATOM), + /datum/language/nekomimetic = list(LANGUAGE_ATOM), + /datum/language/gutter = list(LANGUAGE_ATOM), + /datum/language/yangyu = list(LANGUAGE_ATOM), + /datum/language/monkey = list(LANGUAGE_ATOM), + /datum/language/slime = list(LANGUAGE_ATOM), + /datum/language/beachbum = list(LANGUAGE_ATOM), + /datum/language/mushroom = list(LANGUAGE_ATOM), + /datum/language/shadowtongue = list(LANGUAGE_ATOM), + /datum/language/buzzwords = list(LANGUAGE_ATOM), + /datum/language/terrum = list(LANGUAGE_ATOM), + /datum/language/sylvan = list(LANGUAGE_ATOM), + ) + +/datum/language_holder/drone_nova + understood_languages = list(/datum/language/drone = list(LANGUAGE_ATOM), /datum/language/common = list(LANGUAGE_ATOM)) + spoken_languages = list(/datum/language/drone = list(LANGUAGE_ATOM)) diff --git a/modular_doppler/languages/code/language menu/language_preferences.dm b/modular_doppler/languages/code/language menu/language_preferences.dm new file mode 100644 index 0000000000000..3bfc6c848d2d7 --- /dev/null +++ b/modular_doppler/languages/code/language menu/language_preferences.dm @@ -0,0 +1,29 @@ +#define MAX_MUTANT_ROWS 4 + +/datum/preferences + /// Associative list, keyed by language typepath, pointing to LANGUAGE_UNDERSTOOD, or LANGUAGE_SPOKEN, for whether we understand or speak the language + var/list/languages = list() + +/datum/preferences/proc/species_updated(species_type) + all_quirks = list() + // Reset cultural stuff + languages[try_get_common_language()] = LANGUAGE_SPOKEN + save_character() + +/// This helper proc gets the current species language holder and does any post-processing that's required in one easy to track place. +/// This proc should *always* be edited or used when modifying or getting the default languages of a player controlled, unrestricted species, to prevent any errant conflicts. +/datum/preferences/proc/get_adjusted_language_holder() + var/datum/species/species = read_preference(/datum/preference/choiced/species) + species = new species() + var/datum/language_holder/language_holder = new species.species_language_holder() + + // Do language post procesing here. Used to house our foreigner functionality. + // I saw little reason to remove this proc, considering it makes code using this a little easier to read. + + return language_holder + +/// Tries to get the topmost language of the language holder. Should be the species' native language, and if it isn't, you should pester a coder. +/datum/preferences/proc/try_get_common_language() + var/datum/language_holder/language_holder = get_adjusted_language_holder() + var/language = language_holder.spoken_languages[1] + return language diff --git a/modular_doppler/languages/language_datums.dm b/modular_doppler/languages/code/language_datums.dm similarity index 70% rename from modular_doppler/languages/language_datums.dm rename to modular_doppler/languages/code/language_datums.dm index e0584f5add30e..e3984ed262c02 100644 --- a/modular_doppler/languages/language_datums.dm +++ b/modular_doppler/languages/code/language_datums.dm @@ -26,7 +26,7 @@ "zhen", "zhi", "zhuai", "zhui", "zou", "zun", "zuo" ) icon_state = "hanzi" - icon = 'modular_doppler/languages/language.dmi' + icon = 'modular_doppler/languages/icons/language.dmi' default_priority = 94 default_name_syllable_min = 1 default_name_syllable_max = 2 @@ -43,7 +43,7 @@ "tá", "vé", "sál", "fáb", "l'e", "seu", "deu", "meu", "vai", "ción", "tá" ) icon_state = "gutter" - icon = 'modular_doppler/languages/language.dmi' + icon = 'modular_doppler/languages/icons/language.dmi' default_priority = 40 /datum/language/movespeak @@ -55,6 +55,22 @@ syllables = list( "wa", "wawa", "awa", "a" ) - icon = 'modular_doppler/languages/language.dmi' + icon = 'modular_doppler/languages/icons/language.dmi' icon_state = "movepeak" default_priority = 93 + +/datum/language/common + name = "Sol Common" + desc = "And when contact was established, the Admiral waved at the screen and said, \"Mi parolas la lingvon de la Homines!\" - I speak the language of Mankind. A simplified mix of Esperanto and Modern Latin, and the only recognized official language of the Sol Federation. This peculiar constructed language became popular during SolFed's earliest days, and was almost entirely overtaken by other popular tongues - it became widespread through heavy-handed political maneuvering with the help of corporate bureaucrats and other undesirables. Nowadays, it's a near-universal tongue and a must-know for any sentient being that plans to leap forward into space." + space_chance = 60 + syllables = list( + "al", "an", "ar", "as", "at", "ed", "er", "ha", "he", "hi", "is", "le", "me", "on", "se", "ti", + "ve", "wa", "ameno", "are", "ent", "for", "had", "hat", "hin", "ch", "be", "abe", "die", "sch", "aus", + "ber", "che", "que", "ait", "men", "ave", "con", "com", "eta", "eur", "est", "ing", "ver", "was", + "hin", "deed", "sed", "ut", "unde", "omnis", "latire", "iste", "natus", "sit", "vol", "totam", "rem", "eaque", + "ipsa", "quae", "ab", "illo", "et", "quasi", "dicta", "dorime", "sunt", "enim", "ipsam", "aut", "odit", "qui", + "amet", "que", "eius", "modi", "inci","ad", "vel", "eum", "iure", "hic", "pa", "mit", "dis", "du", + "di", "tol", "mi", "solari", "ite", "domum" + ) + icon_state = "solcommon" + icon = 'modular_doppler/languages/icons/language.dmi' diff --git a/modular_doppler/languages/language.dmi b/modular_doppler/languages/icons/language.dmi similarity index 100% rename from modular_doppler/languages/language.dmi rename to modular_doppler/languages/icons/language.dmi diff --git a/modular_doppler/modular_mob_spawn/code/mob_spawn.dm b/modular_doppler/modular_mob_spawn/code/mob_spawn.dm index 7e92ebd3a1ccf..d7f427c4dfc98 100644 --- a/modular_doppler/modular_mob_spawn/code/mob_spawn.dm +++ b/modular_doppler/modular_mob_spawn/code/mob_spawn.dm @@ -14,3 +14,12 @@ tgui_alert(mob_possessor, text) return FALSE return ..() + +/// Original proc in code/modules/mob_spawn/mob_spawn.dm ~line 39. +/obj/effect/mob_spawn/create(mob/mob_possessor, newname, is_pref_loaded) + var/mob/living/spawned_mob = new mob_type(get_turf(src)) //living mobs only + name_mob(spawned_mob, newname) + special(spawned_mob, mob_possessor) + if(!is_pref_loaded) + equip(spawned_mob) + return spawned_mob diff --git a/modular_doppler/modular_quirks/excitable/quirk.dm b/modular_doppler/modular_quirks/code/excitable/quirk.dm similarity index 100% rename from modular_doppler/modular_quirks/excitable/quirk.dm rename to modular_doppler/modular_quirks/code/excitable/quirk.dm diff --git a/modular_doppler/modular_quirks/code/good_quirks.dm b/modular_doppler/modular_quirks/code/good_quirks.dm new file mode 100644 index 0000000000000..2b0b26fefd478 --- /dev/null +++ b/modular_doppler/modular_quirks/code/good_quirks.dm @@ -0,0 +1,9 @@ +/datum/quirk/linguist + name = "Linguist" + desc = "You're a student of numerous languages and come with an additional language point." + value = 4 + mob_trait = TRAIT_LINGUIST + gain_text = span_notice("Your brain seems more equipped to handle different modes of conversation.") + lose_text = span_danger("Your grasp of the finer points of Draconic idioms fades away.") + medical_record_text = "Patient demonstrates a high brain plasticity in regards to language learning." + icon = FA_ICON_BOOK_ATLAS diff --git a/modular_doppler/modular_quirks/overwrites/musician.dm b/modular_doppler/modular_quirks/code/overwrites/musician.dm similarity index 100% rename from modular_doppler/modular_quirks/overwrites/musician.dm rename to modular_doppler/modular_quirks/code/overwrites/musician.dm diff --git a/modular_doppler/modular_species/overwrites/code/species.dm b/modular_doppler/modular_species/overwrites/code/species.dm index 6637c60ac0f18..dec467a8fae0e 100644 --- a/modular_doppler/modular_species/overwrites/code/species.dm +++ b/modular_doppler/modular_species/overwrites/code/species.dm @@ -2,3 +2,19 @@ /datum/species ///This is the outfit which will be used by the species its preview portrait var/datum/outfit/preview_outfit = /datum/outfit/job/assistant/consistent + +/** + * # species datum + * + * Datum that handles different species in the game. + * + * This datum handles species in the game, such as lizardpeople, mothmen, zombies, skeletons, etc. + * It is used in [carbon humans][mob/living/carbon/human] to determine various things about them, like their food preferences, if they have biological genders, their damage resistances, and more. + * + */ +/datum/species + /// Adding a language type to this in the form of /datum/language will allow the language to be displayed in preferences for that species, even if it is a secret language. + /// Currently used for Ættmál in hearthkin. + var/list/language_prefs_whitelist + ///If a species can always be picked in prefs for the purposes of customizing it for ghost roles or events + var/always_customizable = FALSE diff --git a/modular_doppler/modular_species/species_types/primitive_genemod/primitive_genemod.dm b/modular_doppler/modular_species/species_types/primitive_genemod/primitive_genemod.dm index 37fd8fb84a48d..1013beb1fa1a9 100644 --- a/modular_doppler/modular_species/species_types/primitive_genemod/primitive_genemod.dm +++ b/modular_doppler/modular_species/species_types/primitive_genemod/primitive_genemod.dm @@ -21,7 +21,7 @@ mutanteyes = /obj/item/organ/internal/eyes/low_light_adapted species_language_holder = /datum/language_holder/primitive_genemod - // language_prefs_whitelist = list(/datum/language/primitive_genemod) //this needs a dedicated module for language + language_prefs_whitelist = list(/datum/language/primitive_genemod) bodytemp_normal = 270 // If a normal human gets hugged by one it's gonna feel cold bodytemp_heat_damage_limit = 283 // To them normal station atmos would be sweltering diff --git a/tgstation.dme b/tgstation.dme index 221a28d96d74d..38bf970f4a2b4 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -405,6 +405,7 @@ #include "code\__DEFINES\~doppler_defines\cells.dm" #include "code\__DEFINES\~doppler_defines\colony_fabricator_misc.dm" #include "code\__DEFINES\~doppler_defines\construction.dm" +#include "code\__DEFINES\~doppler_defines\language.dm" #include "code\__DEFINES\~doppler_defines\declarations.dm" #include "code\__DEFINES\~doppler_defines\DNA.dm" #include "code\__DEFINES\~doppler_defines\enterprise_resource_planning.dm" @@ -6624,7 +6625,11 @@ #include "modular_doppler\kahraman_equipment\code\organic_printer_designs\clothing.dm" #include "modular_doppler\kahraman_equipment\code\organic_printer_designs\equipment.dm" #include "modular_doppler\kahraman_equipment\code\organic_printer_designs\resources.dm" -#include "modular_doppler\languages\language_datums.dm" +#include "modular_doppler\languages\code\language_datums.dm" +#include "modular_doppler\languages\code\language menu\_language.dm" +#include "modular_doppler\languages\code\language menu\client_languages.dm" +#include "modular_doppler\languages\code\language menu\language_holder.dm" +#include "modular_doppler\languages\code\language menu\language_preferences.dm" #include "modular_doppler\loadout_categories\loadout_checkers.dm" #include "modular_doppler\loadout_categories\categories\backpacks.dm" #include "modular_doppler\loadout_categories\categories\belts.dm" @@ -6819,8 +6824,9 @@ #include "modular_doppler\modular_mood\code\mood_events\dog_wag.dm" #include "modular_doppler\modular_mood\code\mood_events\hotspring.dm" #include "modular_doppler\modular_mood\code\mood_events\race_drink.dm" -#include "modular_doppler\modular_quirks\excitable\quirk.dm" -#include "modular_doppler\modular_quirks\overwrites\musician.dm" +#include "modular_doppler\modular_quirks\code\excitable\quirk.dm" +#include "modular_doppler\modular_quirks\code\overwrites\musician.dm" +#include "modular_doppler\modular_quirks\code\good_quirks.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\quirk.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\rationpacks.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\reagents.dm" diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferenceWindow.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferenceWindow.tsx index 881c92de404bf..108f7fdb7e893 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferenceWindow.tsx +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferenceWindow.tsx @@ -11,6 +11,9 @@ import { Window } from '../../layouts'; import { AntagsPage } from './AntagsPage'; import { PreferencesMenuData } from './data'; import { JobsPage } from './JobsPage'; +// DOPPLER EDIT +import { LanguagesPage } from './LanguagesMenu'; +// DOPPLER EDIT import { LoadoutPage } from './loadout/index'; import { LorePage } from './LorePage'; /* DOPPLER EDIT ADDITION */ import { MainPage } from './MainPage'; @@ -22,6 +25,9 @@ enum Page { Antags, Main, Jobs, + // DOPPLER EDIT + Languages, + // DOPPLER EDIT END Species, Quirks, Loadout, @@ -73,6 +79,11 @@ export const CharacterPreferenceWindow = (props) => { case Page.Jobs: pageContents = ; break; + // DOPPLER EDIT + case Page.Languages: + pageContents = ; + break; + // DOPPLER EDIT END case Page.Main: pageContents = ( setCurrentPage(Page.Species)} /> @@ -177,7 +188,21 @@ export const CharacterPreferenceWindow = (props) => { Occupations - + { + // DOPPLER EDIT + } + + + Languages + + + { + // DOPPLER EDIT END + } { + const { act } = useBackend(); + return ( + +
+ {props.language.description} +
+ +
+
+ ); +}; + +export const UnknownLanguage = (props) => { + const { act } = useBackend(); + return ( + +
+ {props.language.description} +
+ +
+
+ ); +}; + +export const LanguagesPage = (props) => { + const { data } = useBackend(); + return ( + + +
+ + {data.unselected_languages.map((val) => ( + + ))} + +
+
+ +
+ Here, you can purchase languages using a point buy system. Each + Language is worth 1 point. +
+
+ +
+ + {data.selected_languages.map((val) => ( + + ))} + +
+
+
+ ); +}; diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts b/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts index 246f6ffac993a..9a22a00ed46eb 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/data.ts @@ -89,6 +89,14 @@ export type Quirk = { customization_options?: string[]; }; +// DOPPLER EDIT START +export type Language = { + description: string; + name: string; + icon: string; +}; +// DOPPLER EDIT END + export type QuirkInfo = { max_positive_quirks: number; quirk_info: Record; @@ -170,6 +178,11 @@ export type PreferencesMenuData = { >; job_preferences: Record; + // DOPPLER EDIT + selected_languages: Language[]; + unselected_languages: Language[]; + total_language_points: number; + // DOPPLER EDIT END keybindings: Record; overflow_role: string; selected_quirks: string[]; From 9b61aea1c3947b9cbd430ba988d10af8139e1d0d Mon Sep 17 00:00:00 2001 From: MortoSasye Date: Sun, 29 Sep 2024 01:43:37 -0300 Subject: [PATCH 2/4] I'm just Konjin --- code/modules/surgery/organs/internal/tongue/_tongue.dm | 1 - .../languages/code/language menu/language_holder.dm | 4 ++-- modular_doppler/languages/code/language_datums.dm | 8 ++++---- .../food_and_drinks/hemophage_food.dm | 2 +- .../doppler_vendors/imported_vendors/vendor_containers.dm | 2 +- .../code/doppler_vendors/imported_vendors/vendors.dm | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/code/modules/surgery/organs/internal/tongue/_tongue.dm b/code/modules/surgery/organs/internal/tongue/_tongue.dm index 786f93263268b..74192b2d23c3d 100644 --- a/code/modules/surgery/organs/internal/tongue/_tongue.dm +++ b/code/modules/surgery/organs/internal/tongue/_tongue.dm @@ -89,7 +89,6 @@ /datum/language/shadowtongue, /datum/language/terrum, /datum/language/nekomimetic, - /datum/language/yangyu, //DOPPLER ADDITION ) /obj/item/organ/internal/tongue/proc/handle_speech(datum/source, list/speech_args) diff --git a/modular_doppler/languages/code/language menu/language_holder.dm b/modular_doppler/languages/code/language menu/language_holder.dm index 0a3ad41b12cbe..b80f785664bbf 100644 --- a/modular_doppler/languages/code/language menu/language_holder.dm +++ b/modular_doppler/languages/code/language menu/language_holder.dm @@ -75,7 +75,7 @@ GLOBAL_DATUM_INIT(language_holder_adjustor, /datum/language_holder_adjustor, new /datum/language/voltaic = list(LANGUAGE_ATOM), /datum/language/nekomimetic = list(LANGUAGE_ATOM), /datum/language/gutter = list(LANGUAGE_ATOM), - /datum/language/yangyu = list(LANGUAGE_ATOM), + /datum/language/konjin = list(LANGUAGE_ATOM), /datum/language/monkey = list(LANGUAGE_ATOM), /datum/language/slime = list(LANGUAGE_ATOM), /datum/language/beachbum = list(LANGUAGE_ATOM), @@ -95,7 +95,7 @@ GLOBAL_DATUM_INIT(language_holder_adjustor, /datum/language_holder_adjustor, new /datum/language/voltaic = list(LANGUAGE_ATOM), /datum/language/nekomimetic = list(LANGUAGE_ATOM), /datum/language/gutter = list(LANGUAGE_ATOM), - /datum/language/yangyu = list(LANGUAGE_ATOM), + /datum/language/konjin = list(LANGUAGE_ATOM), /datum/language/monkey = list(LANGUAGE_ATOM), /datum/language/slime = list(LANGUAGE_ATOM), /datum/language/beachbum = list(LANGUAGE_ATOM), diff --git a/modular_doppler/languages/code/language_datums.dm b/modular_doppler/languages/code/language_datums.dm index e3984ed262c02..ddc933f189fb2 100644 --- a/modular_doppler/languages/code/language_datums.dm +++ b/modular_doppler/languages/code/language_datums.dm @@ -1,6 +1,6 @@ /obj/item/organ/internal/tongue/get_possible_languages() var/list/langs = ..() - langs += /datum/language/yangyu + langs += /datum/language/konjin langs += /datum/language/movespeak langs += /datum/language/primitive_genemod return langs @@ -8,9 +8,9 @@ /// ACTUAL LANGUAGES BEGIN HERE -/datum/language/yangyu - name = "Yangyu" - desc = "Also popularly known as \"Konjin\", this language group formally regarded as Orbital Sino-Tibetan is a result of a genetic relationship between Chinese, Tibetan, Burmese, and other Human languages of similar characteristics that was first proposed in the early 19th century and is extremely popular even in the space age. Originating from Asia, this group of tongues is the second most spoken by Human and Human-derived populations since the birth of Sol Common - and was a primary contender to be the Sol Federation's official language. Many loanwords, idioms, and cultural relics of Japanese, Ryukyuan, Korean, and other societies have managed to persist within it, especially in the daily lives of speakers coming from Martian cities." +/datum/language/konjin + name = "Konjin" + desc = "This language group formally regarded as Orbital Sino-Tibetan is a result of a genetic relationship between Chinese, Tibetan, Burmese, and other Human languages of similar characteristics that was first proposed in the early 19th century and is extremely popular even in the space age. Originating from Asia, this group of tongues is the second most spoken by Human and Human-derived populations since the birth of Sol Common - and was a primary contender to be the Sol Federation's official language. Many loanwords, idioms, and cultural relics of Japanese, Ryukyuan, Korean, and other societies have managed to persist within it, especially in the daily lives of speakers coming from Martian cities." key = "Y" flags = TONGUELESS_SPEECH space_chance = 70 diff --git a/modular_doppler/modular_food_drinks_and_chems/food_and_drinks/hemophage_food.dm b/modular_doppler/modular_food_drinks_and_chems/food_and_drinks/hemophage_food.dm index 4f36f1872b3a1..fd231c3d399cc 100644 --- a/modular_doppler/modular_food_drinks_and_chems/food_and_drinks/hemophage_food.dm +++ b/modular_doppler/modular_food_drinks_and_chems/food_and_drinks/hemophage_food.dm @@ -79,7 +79,7 @@ /obj/item/food/hemophage/blood_curd name = "blood curd" - desc = "Also known as 'blood tofu' or 'blood pudding,' this Yangyu delicacy looks to be made of congealed and cooked blood. It's soft and smooth, slightly chewy, and rich in riboflavin." + desc = "Also known as 'blood tofu' or 'blood pudding,' this Konjin delicacy looks to be made of congealed and cooked blood. It's soft and smooth, slightly chewy, and rich in riboflavin." icon_state = "blood_curd" food_reagents = list( /datum/reagent/consumable/nutriment/protein = 5, diff --git a/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendor_containers.dm b/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendor_containers.dm index f28cd8c1dc187..71fe0dc50445a 100644 --- a/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendor_containers.dm +++ b/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendor_containers.dm @@ -36,7 +36,7 @@ /obj/item/storage/box/foodpack/yangyu name = "\improper Atatakai shokuji - Homestyle Noodles" - desc = "A well decorated red and white plastic package, covered in nearly incomprehensible yangyu text." + desc = "A well decorated red and white plastic package, covered in nearly incomprehensible konjin text." icon_state = "foodpack_yangyu_big" main_course = /obj/item/food/vendor_tray_meal/ramen side_item = /obj/effect/spawner/random/vendor_meal_sides/yangyu diff --git a/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendors.dm b/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendors.dm index 630e17790d0c0..94ee5ca6f506d 100644 --- a/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendors.dm +++ b/modular_doppler/modular_vending/code/doppler_vendors/imported_vendors/vendors.dm @@ -113,10 +113,10 @@ /datum/language_holder/yangyu_vendor understood_languages = list( - /datum/language/yangyu = list(LANGUAGE_ATOM), + /datum/language/konjin = list(LANGUAGE_ATOM), ) spoken_languages = list( - /datum/language/yangyu = list(LANGUAGE_ATOM), + /datum/language/konjin = list(LANGUAGE_ATOM), ) /obj/machinery/vending/imported/yangyu/examine_more(mob/user) From afd22b4c28c74abfe4bbceffdb8bddd11632f906 Mon Sep 17 00:00:00 2001 From: MortoSasye Date: Sun, 29 Sep 2024 02:17:10 -0300 Subject: [PATCH 3/4] I'm just linters --- tgstation.dme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tgstation.dme b/tgstation.dme index 38bf970f4a2b4..2c9e05d0b4d21 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -405,7 +405,6 @@ #include "code\__DEFINES\~doppler_defines\cells.dm" #include "code\__DEFINES\~doppler_defines\colony_fabricator_misc.dm" #include "code\__DEFINES\~doppler_defines\construction.dm" -#include "code\__DEFINES\~doppler_defines\language.dm" #include "code\__DEFINES\~doppler_defines\declarations.dm" #include "code\__DEFINES\~doppler_defines\DNA.dm" #include "code\__DEFINES\~doppler_defines\enterprise_resource_planning.dm" @@ -413,6 +412,7 @@ #include "code\__DEFINES\~doppler_defines\is_helpers.dm" #include "code\__DEFINES\~doppler_defines\item.dm" #include "code\__DEFINES\~doppler_defines\keybindings.dm" +#include "code\__DEFINES\~doppler_defines\language.dm" #include "code\__DEFINES\~doppler_defines\living.dm" #include "code\__DEFINES\~doppler_defines\loadout.dm" #include "code\__DEFINES\~doppler_defines\logging.dm" @@ -6824,9 +6824,9 @@ #include "modular_doppler\modular_mood\code\mood_events\dog_wag.dm" #include "modular_doppler\modular_mood\code\mood_events\hotspring.dm" #include "modular_doppler\modular_mood\code\mood_events\race_drink.dm" +#include "modular_doppler\modular_quirks\code\good_quirks.dm" #include "modular_doppler\modular_quirks\code\excitable\quirk.dm" #include "modular_doppler\modular_quirks\code\overwrites\musician.dm" -#include "modular_doppler\modular_quirks\code\good_quirks.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\quirk.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\rationpacks.dm" #include "modular_doppler\modular_quirks\paycheck_rations\code\reagents.dm" From fb934e977bc522ff6a8fac2bfba7209ec3ef3ce7 Mon Sep 17 00:00:00 2001 From: MortoSasye Date: Sun, 29 Sep 2024 02:26:18 -0300 Subject: [PATCH 4/4] mini-fix --- modular_doppler/languages/code/language_datums.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modular_doppler/languages/code/language_datums.dm b/modular_doppler/languages/code/language_datums.dm index 7c7b276ec1edd..d687018cab1fe 100644 --- a/modular_doppler/languages/code/language_datums.dm +++ b/modular_doppler/languages/code/language_datums.dm @@ -55,7 +55,7 @@ syllables = list( "wa", "wawa", "awa", "a" ) - icon = 'modular_doppler/languages/language.dmi' + icon = 'modular_doppler/languages/icons/language.dmi' icon_state = "movespeak" default_priority = 93