From 54b6b951c6450cff19cb9a5a66c2ef409704bd13 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 31 Aug 2021 21:52:02 +0200 Subject: [PATCH] wasplib: optimize flow in ws.replace --- builtin/client/wasplib.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builtin/client/wasplib.lua b/builtin/client/wasplib.lua index 44abecfb4..01efb7c66 100644 --- a/builtin/client/wasplib.lua +++ b/builtin/client/wasplib.lua @@ -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