Skip to content

Some cleanup of scripted animation handling.

Closes #7636 (closed)

Closes #7637 (closed)

Closes #4742 (closed)

#7636 (closed) was caused by the rebuild of the character's animation that happens when you switch view. The scripted animation remains in the queue but was wiped from the animation, leaving the character in an inconsistent state. To fix this, the character controller now resumes scripted animations that stopped playing unexpectedly.

#7637 (closed) was fixed by directly blocking movement while playing scripted animation. This still allows falling while playing scripted animations, just like in vanilla.

I replaced the use of "persist" with respect to scripted animation to "scripted", since that is what they are.

Lastly the CharacterController now removes scripted animations that have finished playing when that is appropriate. While testing, it was also evident that OpenMW does not remove scripted animations from the queue when we should. It seems in !1845 (closed) the conclusion was that animations should not be removed from the queue, but based on my testing they should. It is only the specific case where the scripted animation was already playing where it should not be removed (and only to reproduce a vanilla bug). I still reproduce this bug.

If a script is not removed from the queue and instead hangs around forever, it will interact with all code that checks if the queue is empty or not. For NPCs this is mostly not an issue because the AI queues up new animations frequently, allowing the queue to progress. The problem appears if the NPC plays the same animation as a scripted animation that finished but is still hanging out in the queue. In this case this unscripted animation will behave partially like a scripted animation.

The most reliable way to reproduce i found is using loopgroup, walkforward, 2, 1 on a wandering NPC while it is standing still. In OpenMW, when the NPC begins walking after finishing the scripted animation, it will become forever stuck in a walkforward animation: https://streamable.com/ru3b4l

In vanilla, the npc reverts to normal and does not get stuck: https://streamable.com/3kbucw

Edited by Mads Buvik Sandvei

Merge request reports