mirror of
https://github.com/Skyrat-SS13/Skyrat-tg.git
synced 2026-08-26 22:37:52 +01:00
[MIRROR] Fix Tongue Based Speech Modifiers Being Applied To Users Native Languages (#28854)
* Fix Tongue Based Speech Modifiers Being Applied To Users Native Languages * Update fly_organs.dm * Update _tongue.dm --------- Co-authored-by: FearfulFurnishing <139661819+FearfulFurnishing@users.noreply.github.com> Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
This commit is contained in:
co-authored by
FearfulFurnishing
SpaceLoveSs13
parent
8989a1a546
commit
7ca7e8292f
@@ -13,8 +13,10 @@
|
||||
var/slots
|
||||
/// If set to true, turns all text to uppercase
|
||||
var/uppercase = FALSE
|
||||
/// Any additional checks that we should do before applying the speech modification
|
||||
var/datum/callback/should_modify_speech = null
|
||||
|
||||
/datum/component/speechmod/Initialize(replacements = list(), end_string = "", end_string_chance = 100, slots, uppercase = FALSE)
|
||||
/datum/component/speechmod/Initialize(replacements = list(), end_string = "", end_string_chance = 100, slots, uppercase = FALSE, should_modify_speech)
|
||||
if (!ismob(parent) && !isitem(parent) && !istype(parent, /datum/mutation/human))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
@@ -23,6 +25,7 @@
|
||||
src.end_string_chance = end_string_chance
|
||||
src.slots = slots
|
||||
src.uppercase = uppercase
|
||||
src.should_modify_speech = should_modify_speech
|
||||
|
||||
if (istype(parent, /datum/mutation/human))
|
||||
RegisterSignal(parent, COMSIG_MUTATION_GAINED, PROC_REF(on_mutation_gained))
|
||||
@@ -51,6 +54,8 @@
|
||||
var/message = speech_args[SPEECH_MESSAGE]
|
||||
if(message[1] == "*")
|
||||
return
|
||||
if(!isnull(should_modify_speech) && !should_modify_speech.Invoke(source, speech_args))
|
||||
return
|
||||
|
||||
for (var/to_replace in replacements)
|
||||
var/replacement = replacements[to_replace]
|
||||
@@ -123,3 +128,7 @@
|
||||
return
|
||||
UnregisterSignal(targeted, COMSIG_MOB_SAY)
|
||||
targeted = null
|
||||
|
||||
/datum/component/speechmod/Destroy()
|
||||
should_modify_speech = null
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user