From d542b0d264d7e12e9edcc1fca2e24189074f3765 Mon Sep 17 00:00:00 2001 From: Kush1Push1 <78963858+Kush1Push1@users.noreply.github.com> Date: Wed, 15 Sep 2021 08:03:59 +0700 Subject: [PATCH] Native languages for tongues (#61352) If a mob (human one) speaks with a language their tongue tracks as native (for their language's anatomy), the message's text will not be changed with default language's text replaces. Basicly, if a lizard (or other human mob) with lizard tongue speaks with draconic, their speech will be without accent changes It looks a bit strange when races speak at their own language with difficult without real reasons for it. The changes remove that part. --- code/__DEFINES/dcs/signals.dm | 4 ++-- code/modules/surgery/organs/tongue.dm | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 31a18fe88cc..f698321da79 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -562,9 +562,9 @@ #define SPEECH_MESSAGE 1 // #define SPEECH_BUBBLE_TYPE 2 #define SPEECH_SPANS 3 - /* #define SPEECH_SANITIZE 4 + // #define SPEECH_SANITIZE 4 #define SPEECH_LANGUAGE 5 - #define SPEECH_IGNORE_SPAM 6 + /* #define SPEECH_IGNORE_SPAM 6 #define SPEECH_FORCED 7 */ ///from /mob/say_dead(): (mob/speaker, message) diff --git a/code/modules/surgery/organs/tongue.dm b/code/modules/surgery/organs/tongue.dm index d4f018d358a..a7f94ded735 100644 --- a/code/modules/surgery/organs/tongue.dm +++ b/code/modules/surgery/organs/tongue.dm @@ -7,6 +7,7 @@ attack_verb_continuous = list("licks", "slobbers", "slaps", "frenches", "tongues") attack_verb_simple = list("lick", "slobber", "slap", "french", "tongue") var/list/languages_possible + var/list/languages_native //human mobs can speak with this languages without the accent (letters replaces) var/say_mod = null /// Whether the owner of this tongue can taste anything. Being set to FALSE will mean no taste feedback will be provided. @@ -37,6 +38,12 @@ /obj/item/organ/tongue/proc/handle_speech(datum/source, list/speech_args) SIGNAL_HANDLER + if(speech_args[SPEECH_LANGUAGE] in languages_native) + return FALSE //no changes + modify_speech(source, speech_args) + +/obj/item/organ/tongue/proc/modify_speech(datum/source, list/speech_args) + return speech_args[SPEECH_MESSAGE] /obj/item/organ/tongue/Insert(mob/living/carbon/tongue_owner, special = 0) ..() @@ -75,8 +82,9 @@ say_mod = "hisses" taste_sensitivity = 10 // combined nose + tongue, extra sensitive modifies_speech = TRUE + languages_native = list(/datum/language/draconic) -/obj/item/organ/tongue/lizard/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/lizard/modify_speech(datum/source, list/speech_args) var/static/regex/lizard_hiss = new("s+", "g") var/static/regex/lizard_hiSS = new("S+", "g") var/static/regex/lizard_kss = new(@"(\w)x", "g") @@ -180,6 +188,7 @@ say_mod = "buzzes" taste_sensitivity = 25 // you eat vomit, this is a mercy modifies_speech = TRUE + languages_native = list(/datum/language/buzzwords) var/static/list/languages_possible_fly = typecacheof(list( /datum/language/common, /datum/language/draconic, @@ -197,7 +206,7 @@ /datum/language/buzzwords )) -/obj/item/organ/tongue/fly/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/fly/modify_speech(datum/source, list/speech_args) var/static/regex/fly_buzz = new("z+", "g") var/static/regex/fly_buZZ = new("Z+", "g") var/message = speech_args[SPEECH_MESSAGE] @@ -246,7 +255,7 @@ else . += span_notice("It is attuned to [mothership].") -/obj/item/organ/tongue/abductor/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/abductor/modify_speech(datum/source, list/speech_args) //Hacks var/message = speech_args[SPEECH_MESSAGE] var/mob/living/carbon/human/user = source @@ -273,7 +282,7 @@ modifies_speech = TRUE taste_sensitivity = 32 -/obj/item/organ/tongue/zombie/handle_speech(datum/source, list/speech_args) +/obj/item/organ/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) @@ -306,7 +315,7 @@ . = ..() languages_possible = languages_possible_alien -/obj/item/organ/tongue/alien/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/alien/modify_speech(datum/source, list/speech_args) playsound(owner, "hiss", 25, TRUE, TRUE) /obj/item/organ/tongue/bone @@ -343,7 +352,7 @@ phomeme_type = pick(phomeme_types) languages_possible = languages_possible_skeleton -/obj/item/organ/tongue/bone/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/bone/modify_speech(datum/source, list/speech_args) if (chattering) chatter(speech_args[SPEECH_MESSAGE], phomeme_type, source) switch(phomeme_type) @@ -373,7 +382,7 @@ /obj/item/organ/tongue/robot/can_speak_language(language) return TRUE // THE MAGIC OF ELECTRONICS -/obj/item/organ/tongue/robot/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/robot/modify_speech(datum/source, list/speech_args) speech_args[SPEECH_SPANS] |= SPAN_ROBOT /obj/item/organ/tongue/snail @@ -382,7 +391,7 @@ desc = "A minutely toothed, chitious ribbon, which as a side effect, makes all snails talk IINNCCRREEDDIIBBLLYY SSLLOOWWLLYY." modifies_speech = TRUE -/obj/item/organ/tongue/snail/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/snail/modify_speech(datum/source, list/speech_args) var/new_message var/message = speech_args[SPEECH_MESSAGE] for(var/i in 1 to length(message)) @@ -451,7 +460,7 @@ //Thank you Jwapplephobia for helping me with the literal hellcode below -/obj/item/organ/tongue/tied/handle_speech(datum/source, list/speech_args) +/obj/item/organ/tongue/tied/modify_speech(datum/source, list/speech_args) var/new_message var/message = speech_args[SPEECH_MESSAGE] var/exclamation_found = findtext(message, "!")