Trying to make a chameleon tongue for comms agents

How, what and why to code in BYOND.

Moderators: MisterPerson, Code Maintainers

cacogen
 
Joined: Sat Jun 02, 2018 10:27 am
Byond Username: Cacogen

Trying to make a chameleon tongue for comms agents

Postby cacogen » Thu Jan 16, 2020 10:26 am #536013

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.



User avatar
XDTM
Github User
 
Joined: Fri Mar 04, 2016 8:38 pm
Location: XDTM
Byond Username: XDTM
Github Username: XDTM

Re: Trying to make a chameleon tongue for comms agents

Postby XDTM » Fri Jan 24, 2020 11:32 am #537142

You're unregistering the mob_say signal right after registering it; try putting unregister first instead.
a.k.a. Duke Hayka

Coder of golems, virology, hallucinations, traumas, nanites, and a bunch of miscellaneous stuff.


Return to Coding

Who is online

Users browsing this forum: No registered users