Page 1 of 1

Trying to make a chameleon tongue for comms agents

Posted: Thu Jan 16, 2020 10:26 am
by cacogen
Comms agents can't impersonate crewmembers with high volume, alternative speech verbs, speech patterns or alternative fonts. The first is easily fixed, the second three not so much. Because speech verbs, speech spans (fonts) and speech patterns are handled by tongues, I thought the best way of solving the problem might be creating a chameleon variant of the tongue.

I came up with this:

L304 tongue.dm

Code: Select all

/obj/item/organ/tongue/robot/omni
	name = "omnitongue"
	
	var/datum/action/item_action/chameleon/change/tongue/chameleon_action

/obj/item/organ/tongue/robot/omni/Initialize()
	. = ..()
	chameleon_action = new(src)
	chameleon_action.chameleon_type = /obj/item/organ/tongue
	chameleon_action.chameleon_name = "Tongue"
	chameleon_action.initialize_disguises()

/datum/action/item_action/chameleon/change/tongue/update_item(obj/item/picked_item)
	var/obj/item/organ/tongue/picked_tongue = picked_item
	var/obj/item/organ/tongue/T = target

	T.name = initial(picked_tongue.name)
	T.desc = initial(picked_tongue.desc)
	T.icon = initial(picked_tongue.icon)
	T.icon_state = initial(picked_tongue.icon_state)
	T.say_mod = initial(picked_tongue.say_mod)
	T.modifies_speech = initial(picked_tongue.modifies_speech)

	var/mob/living/carbon/M = owner
	if(T.say_mod && M.dna && M.dna.species)
		M.dna.species.say_mod = T.say_mod
	if(T.modifies_speech)
		picked_tongue.RegisterSignal(M, COMSIG_MOB_SAY, /obj/item/organ/tongue/.proc/handle_speech)
	M.UnregisterSignal(M, COMSIG_MOB_SAY)
It compiles, doesn't runtime, changes say_mod properly and changes the span from robotic (the parent's type) to normal, but it doesn't change it to the correct span for the tongues that need it.

I've been trying to get this working for ages. If someone can point me in the right direction, I'd greatly appreciate it.

Re: Trying to make a chameleon tongue for comms agents

Posted: Fri Jan 24, 2020 11:32 am
by XDTM
You're unregistering the mob_say signal right after registering it; try putting unregister first instead.