summaryrefslogtreecommitdiff
path: root/doc/lua_api.txt
diff options
context:
space:
mode:
authorDániel Juhász <juhdanad@gmail.com>2017-03-11 17:07:04 +0100
committerEkdohibs <nathanael.courant@laposte.net>2017-04-20 05:39:14 +0200
commit57e5aa662851485902575c3c747437e365bf72c8 (patch)
tree3e8469a85db5577140110e5d87a98514f5dd8d2f /doc/lua_api.txt
parent6d1e6f889826a5802e17f53f99000a51b2e00066 (diff)
downloadminetest-57e5aa662851485902575c3c747437e365bf72c8.tar.gz
minetest-57e5aa662851485902575c3c747437e365bf72c8.tar.bz2
minetest-57e5aa662851485902575c3c747437e365bf72c8.zip
Light update for map blocks
This is not really different from the light update of a voxel manipulator. This update does not assume that the lighting was correct before, therefore it is useful for correction. Also expose this function to the Lua API for light correction, and allow voxel manipulators not to update the light.
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r--doc/lua_api.txt24
1 files changed, 23 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 6e7a1de68..16e662e0c 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2398,6 +2398,22 @@ and `minetest.auth_reload` call the authetification handler.
* increase level of leveled node by level, default `level` equals `1`
* if `totallevel > maxlevel`, returns rest (`total-max`)
* can be negative for decreasing
+* `minetest.fix_light(pos1, pos2)`: returns `true`/`false`
+ * resets the light in a cuboid-shaped part of
+ the map and removes lighting bugs.
+ * Loads the area if it is not loaded.
+ * `pos1` is the corner of the cuboid with the least coordinates
+ (in node coordinates), inclusive.
+ * `pos2` is the opposite corner of the cuboid, inclusive.
+ * The actual updated cuboid might be larger than the specified one,
+ because only whole map blocks can be updated.
+ The actual updated area consists of those map blocks that intersect
+ with the given cuboid.
+ * However, the neighborhood of the updated area might change
+ as well, as light can spread out of the cuboid, also light
+ might be removed.
+ * returns `false` if the area is not fully generated,
+ `true` otherwise
* `core.check_single_for_falling(pos)`
* causes an unsupported `group:falling_node` node to fall and causes an
unattached `group:attached_node` node to fall.
@@ -3421,8 +3437,14 @@ will place the schematic inside of the VoxelManip.
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object containing
the region formed by `p1` and `p2`.
* returns actual emerged `pmin`, actual emerged `pmax`
-* `write_to_map()`: Writes the data loaded from the `VoxelManip` back to the map.
+* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to the map.
* **important**: data must be set using `VoxelManip:set_data()` before calling this
+ * if `light` is true, then lighting is automatically recalculated.
+ The default value is true.
+ If `light` is false, no light calculations happen, and you should correct
+ all modified blocks with `minetest.fix_light()` as soon as possible.
+ Keep in mind that modifying the map where light is incorrect can cause
+ more lighting bugs.
* `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in
the `VoxelManip` at that position
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position