From 584d00a01c4bcd359cc3e585dbcab5cada662348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Tue, 30 Jan 2018 00:30:02 +0100 Subject: 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 --- doc/lua_api.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 27620aa8f..afeb53cd6 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -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)` -- cgit v1.2.3