local data = {} -- reuse the massive VoxelManip memory buffers instead of creating on every on_generate()
local function on_generated(minp, maxp, blockseed)
local vm, emerge_min, emerge_max = minetest.get_mapgen_object("voxelmanip")
vm:get_data(data) -- put all nodes except the ground surface in this array
local area = VoxelArea:new{MinEdge=emerge_min, MaxEdge=emerge_max}
local nodeId_debug1 = minetest.get_content_id("default:clay")
-- v7 rivers appear to be cutting off the top and bottom of the view area
for x = minp.x, maxp.x do
data[area:index(x, minp.y, minp.z)] = nodeId_debug1
data[area:index(x, maxp.y, minp.z)] = nodeId_debug1
data[area:index(x, minp.y, maxp.z)] = nodeId_debug1
data[area:index(x, maxp.y, maxp.z)] = nodeId_debug1
end
for y = minp.y, maxp.y do
data[area:index(minp.x, y, minp.z)] = nodeId_debug1
data[area:index(maxp.x, y, minp.z)] = nodeId_debug1
data[area:index(minp.x, y, maxp.z)] = nodeId_debug1
data[area:index(maxp.x, y, maxp.z)] = nodeId_debug1
end
for z = minp.z, maxp.z do
data[area:index(minp.x, minp.y, z)] = nodeId_debug1
data[area:index(maxp.x, minp.y, z)] = nodeId_debug1
data[area:index(minp.x, maxp.y, z)] = nodeId_debug1
data[area:index(maxp.x, maxp.y, z)] = nodeId_debug1
end
vm:set_data(data)
vm:set_lighting({day=0, night=0})
vm:calc_lighting()
vm:write_to_map()
end
minetest.register_on_generated(on_generated)
DrFrankenstone wrote:FWIW, I didn't mean that drawing beyond the bounds of the chunk might cause it, I meant that being limited to within the bounds of the on_generate chunk may cause it if you don't also successfully spawn the structure in every other chunk that the structure touches.
Are the missing parts aligned with chunk boundaries?
DrFrankenstone wrote:I've been using large schematics to create giant trees. The replacement table passed to place_schematic() is different for each type of tree, and I've noticed that if two trees are near each other (like in the cherry blossom screenshot), the first replacement table ends up being applied to both schematics, even though a very different table was passed to the second place_schematic() call.
DrFrankenstone wrote:My thinkings is that the replacement table might not be the only thing inadvertently being shared by invocations of place_schematic() (which might be running in parallel).
paramat wrote:What value are you using for 'num_emerge_threads'? The default is automatic behaviour which is 'number of processors' - 2. Also note that a sqlite world database is not 'thread safe' so 'num_emerge_threads' should be set to '1'.
Try '1' to see if this improves anything.
rubenwardy wrote:I had this bug in CTF, and found that you need to emerge the area first using minetest.emerge_area
local function emergeblocks_callback(pos, action, num_calls_remaining, ctx)
if not ctx.total_blocks then
ctx.total_blocks = num_calls_remaining + 1
ctx.current_blocks = 0
end
ctx.current_blocks = ctx.current_blocks + 1
if ctx.current_blocks == ctx.total_blocks then
minetest.place_schematic(ctx.pos, ctx.schematic, ctx.rotation, ctx.replacements, ctx.force_placement)
end
end
local function my_place_schematic((pos, schematic, rotation, replacements, force_placement))
minetest.emerge_area(pos, pos, emergeblocks_callback, {
pos = pos,
schematic = schematic,
rotation = rotation,
replacements = replacements,
force_placement = force_placement
})
end
Users browsing this forum: Bing Bot [Bot] and 0 guests