wasplib: optimize flow in ws.replace
parent
e62a0bc9c4
commit
54b6b951c6
|
@ -772,14 +772,15 @@ end
|
||||||
function ws.replace(pos,arg)
|
function ws.replace(pos,arg)
|
||||||
arg=tablearg(arg)
|
arg=tablearg(arg)
|
||||||
local nd=minetest.get_node_or_nil(pos)
|
local nd=minetest.get_node_or_nil(pos)
|
||||||
if nd and not ws.in_list(nd.name,arg) and nd.name ~= 'air' then
|
if nd and not ws.in_list(nd.name,arg) and ws.buildable_to(pos) then
|
||||||
local tm=ws.get_digtime(nd.name) or 0
|
local tm=ws.get_digtime(nd.name) or 0
|
||||||
ws.dig(pos)
|
ws.dig(pos)
|
||||||
minetest.after(tm + 0.1,function()
|
minetest.after(tm + 0.1,function()
|
||||||
ws.place(pos,arg)
|
ws.place(pos,arg)
|
||||||
end)
|
end)
|
||||||
|
return tm
|
||||||
else
|
else
|
||||||
ws.place(pos,arg)
|
return ws.place(pos,arg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue