Commit 310a150e authored by Fedja Beader's avatar Fedja Beader
Browse files

WorldEdit: Ensure node is actually placed before moving on to the next

parent 3ff58a74
......@@ -45,6 +45,21 @@ local function have_space()
end
function queued_ensure_node(pos, name, timeout)
if timeout < 0 then
print("Timeout reached while waiting for node " .. name .. " at " .. minetest.pos_to_string(pos))
queue:clear()
return
end
local node = core.get_node_or_nil(pos)
if node and node.name == name then
return 0
else
queue:prepend(function() return queued_ensure_node(pos, name, timeout - 0.01) end)
return 0.01
end
end
local state = {
......@@ -161,6 +176,7 @@ local function compute_next_step_saved()
local pos = { x = x, y = y - 1, z = z }
local attach_pos = { x = x, y = y - 0, z = z }
queue:append(function() return step_place(node_data.node.name, pos, attach_pos) end)
queue:append(function() return queued_ensure_node(attach_pos, node_data.node.name, 5) end)
-- 6) rotate if needed
queue:append(compute_next_step_saved)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment