Minor say code refactor, fixes signers sometimes using the wrong verbs over radio (#80092)

## About The Pull Request

Alternative title: "Baby's third pr: surprise say code refactor"

While testing sign language I worked out that if the first message sent
after toggling sign language involves speaking directly into a radio, it
proceeds to use the wrong verb. After several hours of digging through
say and telecomms code, I worked out the cause:
the `verb_say` on humans is primarily updated to match tongue data
during the verb _selection_ method `say_mod()` in `human_say.dm`, and as
a consequence this meant the verb wasn't updated to the correct one
until far after it had been copied to a virtualspeaker, leading to the
incorrect verb being used for the radio message.

This pr fixes this by refactoring this verb updating behaviour to be in
a new method `update_verbs()`, which we then call _before_ attempting to
call `radio()` to avoid wrongful copying and thus fixing the bug.

There's theoretically also cases where the previous behaviour would use
the wrong verb if one lost or gained a tongue between radio messages, or
the wrong verb from those picked from a list for some simple/basic
animals, but those are significantly less common.

To note, I gave the new `update_verbs()` method the same arguments as
the `say_mod()` method it got split out of, but having gone through all
instances of it being used for this I don't feel it actually *needs*
those arguments. So I'm unsure whether it should keep them or not.
Opened as a draft for now for sanity's sake, and also cause, y'know, it
touches say code.
## Why It's Good For The Game

It was _really_ annoying.
## Changelog
🆑
fix: Signers no longer use the wrong verb when speaking directly into a
radio for the first message after toggling sign language.
refactor: Moved the updating of verb variables into a new method which
is called earlier in living's say, which should avoid this happening for
other things which updated their verbs the same way.
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
_0Steven
2024-01-15 22:54:39 +01:00
committed by GitHub
parent b326f22fd3
commit d131e74095
8 changed files with 51 additions and 30 deletions
+2 -4
View File
@@ -138,10 +138,8 @@
if(staminaloss > 0)
adjustStaminaLoss(-stamina_recovery * seconds_per_tick, forced = TRUE)
/mob/living/basic/say_mod(input, list/message_mods = list())
if(length(speak_emote))
verb_say = pick(speak_emote)
return ..()
/mob/living/basic/get_default_say_verb()
return length(speak_emote) ? pick(speak_emote) : ..()
/mob/living/basic/death(gibbed)
. = ..()