Made gdi04c easier to win and added cell trigger guards
Move Utils.Seconds and .Minutes into DateTime global

Also renames Date.IsHalloween to DateTime.IsHalloween
Move Utils.CenterOfCell into Map global
Point out pitfalls in the Lua API documentation
Whitespace fixes
Remove more references to old Lua API

Fixes #6811
Merge pull request #6807 from obrakmann/lua-cleanups

Lua cleanups
Lazily generate buffer in Sheet.

The managed byte buffer is created on demand, meaning a newly allocated sheet will not waste memory holding onto the buffer until some changes are actually required to be written. This avoids a newly allocated sheet wasting memory on buffers that do not differ from their backing texture.
Made Sheet.Texture into Sheet.GetTexture() since we will want to call it for side-effects.
Release sheet buffers in SequenceProvider and MapCache.

The buffers in SequenceProvider can be freed if Preload is called, since we know everything is loaded. A SequenceProvider is created for each TileSet is use so this saves memory for however many tilesets had been used in the game. This will be at least one for the shellmap, and often more.

The MapCache loading thread is kept alive for 5 seconds after it last generated a map (in anticipation of more requests). Once this time expires the thread is allowed to die, as it is unlikely there will be more requests in the short term. At this time it is ideal to force the changes to be committed to the texture so we can release the buffer. As well as marking the buffer for release, we must access the texture to force the changes stored in the buffer to be written to the texture, after which the buffer can be reclaimed.

Additionally, when starting the MapCache loading thread we must ensure the buffer is created from the main thread since it may query the texture object which has thread affinity. After that the buffer may be modified freely on the loading thread until released.