Skip to content

Fix getPedAnimation for short-lived partial anims#5078

Merged
FileEX merged 4 commits into
multitheftauto:masterfrom
QueryOfficial:fix/getpedanimation-partial-anims
Jul 24, 2026
Merged

Fix getPedAnimation for short-lived partial anims#5078
FileEX merged 4 commits into
multitheftauto:masterfrom
QueryOfficial:fix/getpedanimation-partial-anims

Conversation

@QueryOfficial

Copy link
Copy Markdown
Contributor

Summary

Make getPedAnimation keep returning the cached block/anim when a short-lived partial animation has already ended its TASK_SIMPLE_NAMED_ANIM primary task but loop / freezeLastFrame still holds the pose.

Also set m_AnimationCache.startTime in RunNamedAnimation for locally applied animations (RPCs already set it).

setPedAnimation(localPlayer, "carry", "crry_prtial", 1, true, true, true, true, 0, false)
print(getPedAnimation(localPlayer)) -- expected: "carry", "crry_prtial", ...

Motivation

With a short but non-zero time (e.g. 1), partial anims such as carry / crry_prtial finish the named-anim task almost immediately. The ped stays in the carry pose via loop/freeze, but IsRunningAnimation only checked TASK_SIMPLE_NAMED_ANIM for streamed-in peds, so getPedAnimation returned false. Using time = -1 kept the task alive and appeared to work.

Fixes #5077.

Test plan

  1. Build the client.
  2. Run:
    setPedAnimation(localPlayer, "carry", "crry_prtial", 1, true, true, true, true, 0, false)
    then getPedAnimation(localPlayer) — expect "carry" / "crry_prtial" (not false).
  3. Run the same with time = -1 and confirm it still returns the correct values.
  4. Clear with setPedAnimation(localPlayer, false) and confirm getPedAnimation returns false.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Comment thread Client/mods/deathmatch/logic/CClientPed.cpp Outdated
@FileEX FileEX added invalid This doesn't seem right bugfix Solution to a bug of any kind and removed invalid This doesn't seem right labels Jul 24, 2026
@FileEX FileEX added this to the 1.7 (Current) milestone Jul 24, 2026
@FileEX
FileEX merged commit 4f02566 into multitheftauto:master Jul 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getPedAnimation can return false in partial anims

3 participants