Skip to content

Fixed thirdperson animations from third-party addons - #1858

Merged
saibotk merged 13 commits into
TTT-2:masterfrom
mexikoedi:fix-third-party-thirdperson-animation
Jul 20, 2026
Merged

saibotk merged 13 commits into
TTT-2:masterfrom
mexikoedi:fix-third-party-thirdperson-animation

Conversation

@mexikoedi

@mexikoedi mexikoedi commented Feb 23, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes #1690 .

Third-party addons that create thirdperson animations like Custom Taunt can use gesture slots that conflict with TTT2 gesture handling (for example: GESTURE_SLOT_CUSTOM).
Because of this, the local player’s third-person animation could be visually overridden and not appear correctly.

There was also a second issue with the TTT2 voice chat gesture (ACT_GMOD_IN_CHAT) which interfered with active third-party thirdperson animations.

This fix adds clientside external gesture detection and suppresses the TTT2 ACT_GMOD_IN_CHAT gesture while an external gesture is active.
To make this more robust for all kinds of addons, both AddVCDSequenceToGestureSlot and AnimRestartGesture are tracked, while TTT2 internal gestures are excluded from that detection.

I tested this with the addon mentioned above and can confirm the issue is resolved (thirdperson animation is now visible for the local player).
The voice chat ACT_GMOD_IN_CHAT behavior also works as expected, and I did not encounter errors during testing.

Edit:
Description doesn't fit the code changes anymore, see comments below.

@saibotk

saibotk commented Feb 23, 2026

Copy link
Copy Markdown
Member

Thanks for digging into these issues!

Heads up: The earliest i can review this is probably this weekend or next week!

@saibotk saibotk left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked over the changes and got some concerns and questions we need to discuss and i would prefer not to merge those in their current state.

  • Not to shame you, but if this code was written with AI, I'd prefer if you'd disclose so (if not, I'm sorry its just hard to tell in todays world)
  • Can you elaborate on the exact problem that was fixed here? The issue is rather old and lacks some information on how this behaves in the current version and what you expect it to do
  • Can you elaborate how the Custom Taunts addon uses these functions or GMOD functions to handle animations, so we can understand why and what we need to adjust here?
  • I'd prefer not to introduce additional public methods, especially since GMOD also has functions like IsPlayingTaunt already. This will be very confusing and we need to check if we handle all cases correctly

Let's first collect more information on this and then we can discuss a potential solution together. This way you don't waste time iterating too much on a potential solution.

Thanks for your understanding!

@mexikoedi

Copy link
Copy Markdown
Contributor Author

I looked over the changes and got some concerns and questions we need to discuss and i would prefer not to merge those in their current state.

  • Not to shame you, but if this code was written with AI, I'd prefer if you'd disclose so (if not, I'm sorry its just hard to tell in todays world)
  • Can you elaborate on the exact problem that was fixed here? The issue is rather old and lacks some information on how this behaves in the current version and what you expect it to do
  • Can you elaborate how the Custom Taunts addon uses these functions or GMOD functions to handle animations, so we can understand why and what we need to adjust here?
  • I'd prefer not to introduce additional public methods, especially since GMOD also has functions like IsPlayingTaunt already. This will be very confusing and we need to check if we handle all cases correctly

Let's first collect more information on this and then we can discuss a potential solution together. This way you don't waste time iterating too much on a potential solution.

Thanks for your understanding!

  • I use autocompletion for example for code comments/variables and I also had multiple iterations until I was happy with the results from testing so there are some not needed and confusing code parts. After reading through your comments it makes sense and I should have looked more at the code than the ingame testing results.

  • The bug is a local visibility conflict in thirdperson when gesture layers overlap. Custom Taunt plays emote sequences via AddVCDSequenceToGestureSlot on GESTURE_SLOT_CUSTOM. TTT2 also starts its own player gestures (for example voicechat). This overlaps with the Custom Taunt gestures on the same gesture layer and overrides (visually) the local thirdperson taunt while other players can still see it. (see issue description to see when it worked, when it stopped working, ...) I want to see the Custom Taunt gestures in thirdperson too and I don't want other gestures (voicechat) to cause visual interferences with it.

  • The client selects a gesture via the dance menu. Then the duration is calculated (LookupSequence+ SequenceDuration), then the client sends a mmddance net message, the server receives it and broadcasts playmmd, then the client plays the animation with ply:AddVCDSequenceToGestureSlot(GESTURE_SLOT_CUSTOM, ply:LookupSequence(mmdDance), 0, true). If the client wants to stop the gesture he can also do that via the menu and then ply:AddVCDSequenceToGestureSlot(GESTURE_SLOT_CUSTOM, ply:LookupSequence("gesture_bow_base_layer"), 0, true) will be run and the gesture is finished afterwards. AnimRestartGesture or other functions are not used. It's just over net messages, AddVCDSequenceToGestureSlot with LookupSequence and SequenceDuration.

  • Yes that would be better, I didn't know about the existence of IsPlayingTaunt. I can try that instead of HasExternalGestureActive.

So I could implement your comments:

  • Remove HasExternalGestureActive and try to use something like IsPlayingTaunt instead
  • Remove the whole AnimRestartGesture part if wanted or instead try to implement your suggestion there
  • Remove GESTURE_SLOT_VCD and use GESTURE_SLOT_CUSTOM entirely again
  • Remove the check (in AddVCDSequenceToGestureSlot)
  • Make a boolean instead of a counter (in AnimApplyGesture) or try to remove it entirely if AnimRestartGesture is not needed
  • And maybe clean up/reduce code parts if possible

What do you think?
Thanks for your detailed review and your time.

@saibotk

saibotk commented Apr 6, 2026

Copy link
Copy Markdown
Member

Thanks for the explanation!

Going forward:

  • I think the IsPlayingTaunt function is quite mysterious and might not really solve our case, but you can try to use that
  • I'd like us to not override any of these functions and instead try to check if any sequence is playing on that gesture layer. Would you be up to research and try this approach? Its a bit annoying, as you have to manually check if the layer is currently playing a sequence via GetLayerCycle and GetLayerWeight.
  • We could just by default not show the voice chat animation when another animation is currently playing on the same layer, i think that would be a good trade-off and generalization

What do you think?
Note: I am not 100% sure if this way of detecting a playing animation works correctly or if i understood the concept of layers and sequences, so please test this approach and report back, if you go for this route.

@TimGoll what do you think about just not playing the hand to head animation in general when another animation plays? I think this should be fine, but want a second opinion on this.

@TimGoll

TimGoll commented Apr 7, 2026

Copy link
Copy Markdown
Member

@TimGoll what do you think about just not playing the hand to head animation in general when another animation plays? I think this should be fine, but want a second opinion on this.

Good question, I have to think about this. Not sure honestly. While I think TTT2 would improve a lot by better/more animations and sounds (like the corpse search sound I added), I never actually looked at such details

@mexikoedi

mexikoedi commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor Author

I adjusted the code.
It's now much simpler/cleaner.
IsPlayingTaunt didn't work and GetLayerCycle is not needed.
Now there is only one new function which has a couple of checks to make sure that custom gestures come through if the voice chat gesture (the only problematic gesture) is active.
I tested it with a player and it worked without any errors (I and he could see the custom gestures.).

@saibotk saibotk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small suggestion.

Otherwise clean!

Thanks for your effort and the simplification!

@saibotk saibotk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🙏

@saibotk
saibotk merged commit 30e6b13 into TTT-2:master Jul 20, 2026
4 checks passed
@mexikoedi
mexikoedi deleted the fix-third-party-thirdperson-animation branch July 21, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with thirdperson animation from third-party addon

3 participants