Performance improvements.

I have made some misc performance improvements:
* Making minetest.env and minetest.registered_nodes local.
* Using table.concat instead of concatenating in a loop.
* And other small things.

The map is now generated up to 2x as fast as before and the time it takes to generate is now printed in the terminal.