mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-31 18:31:04 +00:00
Add minetest.bulk_set_node call + optimize Environment::set_node call (#6958)
* Add minetest.bulk_set_node call + experimental mod unittest * Optimize set_node function to prevent triple lookup on contentfeatures Do only one lookup for old, and try to merge old and new lookup if node is same than previous node * Add benchmark function + optimize vector population to have real results
This commit is contained in:
parent
3b4df956b1
commit
584d00a01c
5 changed files with 124 additions and 3 deletions
|
@ -2749,6 +2749,15 @@ and `minetest.auth_reload` call the authentication handler.
|
|||
* `node`: table `{name=string, param1=number, param2=number}`
|
||||
* If param1 or param2 is omitted, it's set to `0`.
|
||||
* e.g. `minetest.set_node({x=0, y=10, z=0}, {name="default:wood"})`
|
||||
* `minetest.bulk_set_node({pos1, pos2, pos3, ...}, node)`
|
||||
* Set node on all positions set in the first argument.
|
||||
* e.g. `minetest.bulk_set_node({{x=0, y=1, z=1}, {x=1, y=2, z=2}}, {name="default:stone"})`
|
||||
* For node specification or position syntax see `minetest.set_node` call
|
||||
* Faster than set_node due to single call, but still considerably slower than
|
||||
Voxel Manipulators (LVM) for large numbers of nodes.
|
||||
Unlike LVMs, this will call node callbacks. It also allows setting nodes in spread out
|
||||
positions which would cause LVMs to waste memory.
|
||||
For setting a cube, this is 1.3x faster than set_node whereas LVM is 20x faster.
|
||||
* `minetest.swap_node(pos, node)`
|
||||
* Set node at position, but don't remove metadata
|
||||
* `minetest.remove_node(pos)`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue