1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-26 18:21:04 +00:00

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.
This commit is contained in:
Dániel Juhász 2017-03-11 17:07:04 +01:00 committed by Ekdohibs
parent 6d1e6f8898
commit 57e5aa6628
8 changed files with 209 additions and 3 deletions

View file

@ -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