1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Add callback parameter for core.emerge_area()

This commit is contained in:
kwolekr 2015-10-30 02:48:37 -04:00
parent 5c3546e459
commit c2b5da735e
9 changed files with 166 additions and 22 deletions

View file

@ -2039,9 +2039,19 @@ and `minetest.auth_reload` call the authetification handler.
* `pos1` and `pos2` are optional and default to mapchunk minp and maxp.
* `minetest.clear_objects()`
* clear all objects in the environments
* `minetest.emerge_area(pos1, pos2)`
* queues all mapblocks in the area from pos1 to pos2, inclusive, for emerge
* i.e. asynchronously loads blocks from disk, or if inexistent, generates them
* `minetest.emerge_area(pos1, pos2, [callback], [param])`
* Queue all blocks in the area from `pos1` to `pos2`, inclusive, to be asynchronously
* fetched from memory, loaded from disk, or if inexistent, generates them.
* If `callback` is a valid Lua function, this will be called for each block emerged.
* The function signature of callback is:
* `function EmergeAreaCallback(blockpos, action, calls_remaining, param)`
* - `blockpos` is the *block* coordinates of the block that had been emerged
* - `action` could be one of the following constant values:
* `core.EMERGE_CANCELLED`, `core.EMERGE_ERRORED`, `core.EMERGE_FROM_MEMORY`,
* `core.EMERGE_FROM_DISK`, `core.EMERGE_GENERATED`
* - `calls_remaining` is the number of callbacks to be expected after this one
* - `param` is the user-defined parameter passed to emerge_area (or nil if the
* parameter was absent)
* `minetest.delete_area(pos1, pos2)`
* delete all mapblocks in the area from pos1 to pos2, inclusive
* `minetest.line_of_sight(pos1, pos2, stepsize)`: returns `boolean, pos`