2022-01-22 16:20:10 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
|
|
|
local minetest
|
|
|
|
= minetest
|
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
2022-01-23 17:28:48 -05:00
|
|
|
local pending
|
|
|
|
|
2022-01-22 16:20:10 -05:00
|
|
|
local oldreg = minetest.register_abm
|
|
|
|
function minetest.register_abm(def, ...)
|
|
|
|
if not def.action_delay then return oldreg(def, ...) end
|
|
|
|
|
|
|
|
local oldact = def.action
|
2022-01-23 17:28:48 -05:00
|
|
|
function def.action(pos, node)
|
|
|
|
if not pending then
|
|
|
|
pending = {}
|
|
|
|
minetest.after(0, function()
|
|
|
|
for i = 1, #pending do
|
|
|
|
(pending[i])()
|
|
|
|
end
|
|
|
|
pending = nil
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
pending[#pending + 1] = function()
|
|
|
|
local nn = minetest.get_node(pos)
|
|
|
|
if nn.name == node.name then
|
|
|
|
return oldact(pos, node)
|
|
|
|
end
|
2022-01-22 16:20:10 -05:00
|
|
|
end
|
|
|
|
end
|
2022-01-23 17:28:48 -05:00
|
|
|
|
|
|
|
return oldreg(def, ...)
|
|
|
|
end
|