wasplib: optimize flow in ws.replace

master
cora 2021-08-31 21:52:02 +02:00
parent e62a0bc9c4
commit 54b6b951c6
1 changed files with 3 additions and 2 deletions

View File

@ -772,14 +772,15 @@ end
function ws.replace(pos,arg)
arg=tablearg(arg)
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
ws.dig(pos)
minetest.after(tm + 0.1,function()
ws.place(pos,arg)
end)
return tm
else
ws.place(pos,arg)
return ws.place(pos,arg)
end
end