My code is as follows:
Code: Select all
local p1 = {x=0,y=0,z=0}
local p2 = {x=5,y=5,z=5}
local vm = VoxelManip(p1,p2)
minetest.generate_decorations(vm)
Code: Select all
local p1 = {x=0,y=0,z=0}
local p2 = {x=5,y=5,z=5}
local vm = VoxelManip(p1,p2)
minetest.generate_decorations(vm)
This won't work. An LVM can only work on load. Thats it. My code needs to execute all the time.ShadMOrdre wrote: ↑Mon Jul 27, 2020 07:59I don't think this function works outside of on_generate.
You might consider node timers or an LVM instead.
Code: Select all
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(p1, p2)
minetest.generate_decorations(vm)
vm:calc_lighting()
vm:write_to_map()
vm:update_liquids()
The lua_api.txt document clearly states that a VM must be used. Hence the LVM suggestion.I don't think this function works outside of on_generate.
You are confusing an LVM(Lua Voxel Manipulator) for a LBM(Loading Block Modifier).LC Creations wrote: ↑Mon Jul 27, 2020 16:26This won't work. An LVM can only work on load. Thats it. My code needs to execute all the time.
To my understanding VM(VoxelManip) and LVM(Lua Voxel Manipulator) both refer to the same thing. Which they are already using. So I don't quite understand what it is you are suggesting.ShadMOrdre wrote: ↑Mon Jul 27, 2020 22:15The lua_api.txt document clearly states that a VM must be used. Hence the LVM suggestion
This is false, just now I managed to succesfully call it from a chatcommand to generate decorations in the current chunk.ShadMOrdre wrote: ↑Mon Jul 27, 2020 22:15... only available, and thus usable, in a minetest.register_on_generated definition.
Code: Select all
minetest.register_chatcommand("gendeco", {
params = "",
description = "generate decorations in current mapchunk.",
privs = {server=true},
func = function(name, param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
local minp = {x = 80 * math.floor((pos.x + 32) / 80) - 33,
y = 80 * math.floor((pos.y + 32) / 80) - 33,
z = 80 * math.floor((pos.z + 32) / 80) - 33}
local maxp = {x = minp.x + 81, y = minp.y + 81, z = minp.z + 81}
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(minp, maxp)
minetest.generate_decorations(vm)
vm:write_to_map()
end,
})
Code: Select all
local p1 = {x=0,y=0,z=0}
local p2 = {x=5,y=5,z=5}
local vm = VoxelManip(p1,p2)
minetest.generate_decorations(vm, p1, p2)
Users browsing this forum: No registered users and 4 guests