Rewrite player.lua

A rewrite of the `player.lua` file from `default` mod.

These are the main things:

* Fix the `attempt to index local 'anim' (a nil value)` errors.
* Don't leak global variables. Half the symbols in this file leaked to the global environment. This was noticed by @VanessaE while using @BlockMen's `pyramids` mod, which also assigned to `animation_speed` global, causing all player animations to run slower.
* Added ability to register custom models with their respective animations and animation speed.
* Removed lots of duplicated code.