paramat wrote:1. Yes you can get and set a big chunk of param2 (rotation) data, i'm now doing this in flexrealm to rotate nodes properly https://github.com/paramat/flexrealm/blob/master/init.lua
Note you can also do this with param1 (light) data also.
2. Voxelmanip is exactly that, a way to get, process and write a big chunk of nodes in lua at once, instead of accessing the map via C++ one node at a time with get_node/add_node. The speedup is huge, my first lua mapgens took 1 minute per chunk to generate.
paramat wrote:Note you can also do this with param1 (light) data also.
paramat wrote:There isn't a default value for light level, it's best to leave that alone because light level for each node is calculated at the end in 'vm:calc_lighting()' or 'vm:update_map()'.
paramat wrote:> set_node_at and get_node_at [...] And does it "move" the metadata?
No, as far as i know.
> Wiki says these 2 methods are to be used only when implementing a map generator.
Ignore that, you can use anything for anything as long as it works.
> I need to move a structure of nodes along with their facedir and light data. When it moves, the space behind it becomes air and I need to "reset" its lighting.
Don't bother moving light data. Light levels, including any lights inside your airship will be re-calculated by 'update_map()' at the end. For example if you fly under a floatland you need the airship exterior to go dark.
The space of air behind the airship can only be reset by re-calculating light levels using 'update_map()'.
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(pos1, pos2)
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local data = vm:get_data()
...
...
...
vm:set_data(data)
vm:write_to_map()
vm:update_map()
There are 2 types of voxelmanip, one is for mapgen and worlks on a whole 80^3 mapchunk.
bobomb wrote:Can someone explain how one would use voxel manipulator to make ABMs more efficient? you still need to register an abm to trigger a manipulation, then what? i have a situation where I want to run an abm action on all nodes of a similar type at once. wouldn't i have to still allow all nodes of the type to be identified by the abm search? is there a way to use vm to make this search process more efficient? or would vm only be useful to apply the transformation? what i need is a way to get the extent of a volume that would enclose all of a given node type (actually based on an identifier in the metadata), and apply a transformation to all these at once. but then the abm must stop scanning all those nodes individually to gain a benefit. can someone enlighten me?
Users browsing this forum: No registered users and 2 guests