> Somewhere l read that minetest.set_node works faster when it's used in an on_generated, is it true?
I saw that too, i think it is a little faster inside 'on gen' but still much slower than LVM for a large number of nodes.
everamzah, the lua voxelmanips are already flat arrays.
The voxelmanip index always increases by 1 along the x direction, so instead of calculating index per node, calculate the initial index (for x = x0) before the x loop, then increment it by 1 per node.
The end of your code doesn't reset lighting, it should be:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
vm:set_data(data)
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:write_to_map(data)