<commit_before>#define TONGUE_MAX_HEALTH 60

/obj/item/organ/tongue
	name = "tongue"
	desc = "A fleshy muscle mostly used for lying."
	icon_state = "tonguenormal"
	zone = BODY_ZONE_PRECISE_MOUTH
	slot = ORGAN_SLOT_TONGUE
	attack_verb = list("licked", "slobbered", "slapped", "frenched", "tongued")
	var/list/languages_possible
	var/say_mod = null
	var/taste_sensitivity = 15 // lower is more sensitive.
	maxHealth = TONGUE_MAX_HEALTH
	var/list/initial_accents //the ones the tongue starts with, not what it currently has
	var/list/accents //done in order of priority (please always apply abductor accent and stuttering last)
	var/static/list/languages_possible_base = typecacheof(list(
		/datum/language/common,
		/datum/language/draconic,
		/datum/language/codespeak,
		/datum/language/monkey,
		/datum/language/narsie,
		/datum/language/beachbum,
		/datum/language/ratvar,
		/datum/language/aphasia,
		/datum/language/slime,
		/datum/language/vampiric,
		/datum/language/dwarf,
	))
	healing_factor = STANDARD_ORGAN_HEALING*5 //Fast!!
	decay_factor = STANDARD_ORGAN_DECAY/2

/obj/item/organ/tongue/Initialize(mapload)
	for(var/accent in initial_accents)
		accents += new accent
	. = ..()
	low_threshold_passed = "<span class='info'>Your [name] feels a little sore.</span>"
	low_threshold_cleared = "<span class='info'>Your [name] soreness has subsided.</span>"
	high_threshold_passed = "<span class='warning'>Your [name] is really starting to hurt.</span>"
	high_threshold_cleared = "<span class='info'>The pain of your [name] has subsided a little.</span>"
	now_failing = "<span class='warning'>Your [name] feels like it's about to fall out!.</span>"
	now_fixed = "<span class='info'>The excruciating pain of your [name] has subsided.</span>"
	languages_possible = languages_possible_base

/obj/item/organ/tongue/proc/handle_speech(datum/source, list/speech_args) //this wont proc unless there's initial_accents
	for(var/datum/accent/speech_modifier in accents)
		speech_args = speech_modifier.modify_speech(speech_args, source, owner)

/obj/item/organ/tongue/applyOrganDamage(d, maximum = maxHealth)
	. = ..()
	if (damage >= maxHealth)
		to_chat(owner, "<span class='userdanger'>Your tongue is singed beyond recognition, and disintegrates!</span>")
		SSblackbox.record_feedback("tally", "fermi_chem", 1, "Tongues lost to Fermi")
		qdel(src)

/obj/item/organ/tongue/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
	..()
	if(say_mod && M.dna && M.dna.species)
		M.dna.species.say_mod = say_mod
	if(length(accents))
		RegisterSignal(M, COMSIG_MOB_SAY, .proc/handle_speech)
	M.UnregisterSignal(M, COMSIG_MOB_SAY)

/obj/item/organ/tongue/Remove(special = FALSE)
	if(!QDELETED(owner))
		if(say_mod && owner.dna?.species)
			owner.dna.species.say_mod = initial(owner.dna.species.say_mod)
		UnregisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
		owner.RegisterSignal(owner, COMSIG_MOB_SAY, /mob/living/carbon/.proc/handle_tongueless_speech)
	return ..()

/obj/item/organ/tongue/could_speak_language(language)
	return is_type_in_typecache(language, languages_possible)

/obj/item/organ/tongue/lizard
	name = "forked tongue"
	desc = "A thin and long muscle typically found in reptilian races, apparently moonlights as a nose."
	icon_state = "tonguelizard"
	say_mod = "hisses"
	taste_sensitivity = 10 // combined nose + tongue, extra sensitive
	maxHealth = 40 //extra sensitivity means tongue is more susceptible to damage
	initial_accents = list(/datum/accent/lizard)

/obj/item/organ/tongue/fly
	name = "proboscis"
	desc = "A freakish looking meat tube that apparently can take in liquids."
	icon_state = "tonguefly"
	say_mod = "buzzes"
	taste_sensitivity = 25 // you eat vomit, this is a mercy
	maxHealth = 80 //years of eatting trash has made your tongue strong
	initial_accents = list(/datum/accent/fly)<commit_msg>makes more sense this way<commit_after>#define TONGUE_MAX_HEALTH 60

/obj/item/organ/tongue
	name = "tongue"
	desc = "A fleshy muscle mostly used for lying."
	icon_state = "tonguenormal"
	zone = BODY_ZONE_PRECISE_MOUTH
	slot = ORGAN_SLOT_TONGUE
	attack_verb = list("licked", "slobbered", "slapped", "frenched", "tongued")
	var/list/languages_possible
	var/say_mod = null
	var/taste_sensitivity = 15 // lower is more sensitive.
	maxHealth = TONGUE_MAX_HEALTH
	var/list/initial_accents //the ones the tongue starts with, not what it currently has
	var/list/accents //done in order of priority (please always apply abductor accent and stuttering last)
	var/static/list/languages_possible_base = typecacheof(list(
		/datum/language/common,
		/datum/language/draconic,
		/datum/language/codespeak,
		/datum/language/monkey,
		/datum/language/narsie,
		/datum/language/beachbum,
		/datum/language/ratvar,
		/datum/language/aphasia,
		/datum/language/slime,
		/datum/language/vampiric,
		/datum/language/dwarf,
	))
	healing_factor = STANDARD_ORGAN_HEALING*5 //Fast!!
	decay_factor = STANDARD_ORGAN_DECAY/2

/obj/item/organ/tongue/Initialize(mapload)
	. = ..()
	for(var/accent in initial_accents)
		accents += new accent
	low_threshold_passed = "<span class='info'>Your [name] feels a little sore.</span>"
	low_threshold_cleared = "<span class='info'>Your [name] soreness has subsided.</span>"
	high_threshold_passed = "<span class='warning'>Your [name] is really starting to hurt.</span>"
	high_threshold_cleared = "<span class='info'>The pain of your [name] has subsided a little.</span>"
	now_failing = "<span class='warning'>Your [name] feels like it's about to fall out!.</span>"
	now_fixed = "<span class='info'>The excruciating pain of your [name] has subsided.</span>"
	languages_possible = languages_possible_base

/obj/item/organ/tongue/proc/handle_speech(datum/source, list/speech_args)
	for(var/datum/accent/speech_modifier in accents)
		speech_args = speech_modifier.modify_speech(speech_args, source, owner)

/obj/item/organ/tongue/applyOrganDamage(d, maximum = maxHealth)
	. = ..()
	if (damage >= maxHealth)
		to_chat(owner, "<span class='userdanger'>Your tongue is singed beyond recognition, and disintegrates!</span>")
		SSblackbox.record_feedback("tally", "fermi_chem", 1, "Tongues lost to Fermi")
		qdel(src)

/obj/item/organ/tongue/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
	..()
	if(say_mod && M.dna && M.dna.species)
		M.dna.species.say_mod = say_mod
	RegisterSignal(M, COMSIG_MOB_SAY, .proc/handle_speech)
	M.UnregisterSignal(M, COMSIG_MOB_SAY)

/obj/item/organ/tongue/Remove(special = FALSE)
	if(!QDELETED(owner))
		if(say_mod && owner.dna?.species)
			owner.dna.species.say_mod = initial(owner.dna.species.say_mod)
		UnregisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
		owner.RegisterSignal(owner, COMSIG_MOB_SAY, /mob/living/carbon/.proc/handle_tongueless_speech)
	return ..()

/obj/item/organ/tongue/could_speak_language(language)
	return is_type_in_typecache(language, languages_possible)

/obj/item/organ/tongue/lizard
	name = "forked tongue"
	desc = "A thin and long muscle typically found in reptilian races, apparently moonlights as a nose."
	icon_state = "tonguelizard"
	say_mod = "hisses"
	taste_sensitivity = 10 // combined nose + tongue, extra sensitive
	maxHealth = 40 //extra sensitivity means tongue is more susceptible to damage
	initial_accents = list(/datum/accent/lizard)

/obj/item/organ/tongue/fly
	name = "proboscis"
	desc = "A freakish looking meat tube that apparently can take in liquids."
	icon_state = "tonguefly"
	say_mod = "buzzes"
	taste_sensitivity = 25 // you eat vomit, this is a mercy
	maxHealth = 80 //years of eatting trash has made your tongue strong
	initial_accents = list(/datum/accent/fly)
{'fraction_non_alphanumeric': 0.12116040955631399, 'fraction_numerical': 0.00420057757941717, 'mean_word_length': 4.961658841940532, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '233194', 'n_tokens_mistral': 2907, 'n_tokens_neox': 2735, 'n_words': 604}