Walking animation breaks for some Cloakbots when unit is resized
Walking animation scripts for some of the Cloakbots, particularly:
- Scythe
- Conjurer
- Gremlin
- Iris
- Glaive (sometimes)
break when the unit is enlarged, for example using dbg_size_changer.lua gadget. When this happens these units don't move legs when walking, instead they "float" with their legs spread. Enable dbg_size_changer.lua gadget to see this.
Although it is an issue mostly for mods that change unit size, it signals some problem with these unitscripts. And I think I have seen Scythes not moving legs occasionally in teamgames, so it seems the issue can appear even in base ZK with no resized units, just rarely.
I investigated this.
The problematic line in the script is:
WaitForMove(hips, y_axis)
Whenever a script of resized unit encountered this line, and some animation was running on "hips" piece, the line never returned, so the Walk thread blocked.
It seems related to the fact that "hips" is a root piece of these models, so the scaling transformation is applied to it, and it seems it somehow conflicts with animation.
This is also why the problem doesn't happen for other Cloakbots, particularly:
- Rogue, Zeus - because these have the extra empty base piece, so the scaled piece and the animated piece are not the same
- Reaver - because it doesn't use WaitForMove() on "hips" piece, using Sleep() instead
I am going to fix this for the problematic units by adding the empty base piece for them, because having an empty base piece is probably a good idea anyway.
Edit: I did some additional tests and it seems that no other walking unit except these mentioned have this problem.
And I think I have seen Scythes not moving legs occasionally in teamgames, so it seems the issue can appear even in base ZK with no resized units, just rarely.
This is caused by #4361 more than likely