Listen to the mesh or skeleton being unloaded.

And stop the animation, preventing crashes from the animation state then
being invalid.
Make sure terrain update is using correct terrain.

Since this has changed on the server, and now any entity can contain the
"terrain" property, not only the root.