Fix crash when AnimationLayer is missing
Pathfinding & map grid improvements.

There were still only 6 of 8 bits of the map grid in use.
The last 2 bits are now available as non-colliding user bits,
and are ignored unless specially treated.
The findPath() function can now be told which bits to respect,
which allows to prevent pathfinding to pass through fish tunnels,
for example.
A function for fast user bit map dilation is added as well.
Fix problematic Lua init and add user setting to keep 'os' and 'io' functions.

From the Lua 5.1 manual:
"The luaopen_* functions (to open libraries) cannot be called directly,
like a regular C function. They must be called through Lua,
like a Lua function."

All standard tables are now loaded with luaL_openlibs(), which includes os and io.
Because these are inherently unsafe, there is a new config setting:
<AllowDangerousScriptFunctions on="1" />
This is disabled by default.
The title screen will show a warning when the setting is on.