add entity check

This commit is contained in:
tenplus1 2021-06-06 08:43:27 +01:00
parent b8a76a23b7
commit 8c5ee06a06

@ -271,8 +271,8 @@ minetest.register_abm({
minetest.sound_play("default_tool_breaks", { minetest.sound_play("default_tool_breaks", {
pos = pos, pos = pos,
gain = 1.0, gain = 1.0,
max_hear_distance = 10 max_hear_distance = 5
}) }, true)
local b_no = math.random(#lucky_block.wellblocks) local b_no = math.random(#lucky_block.wellblocks)
local item = lucky_block.wellblocks[b_no][1] local item = lucky_block.wellblocks[b_no][1]
@ -289,12 +289,14 @@ minetest.register_abm({
z = pos.z + math.random(-7, 7) z = pos.z + math.random(-7, 7)
}, "__builtin:falling_node") }, "__builtin:falling_node")
obj:get_luaentity():set_node(nod) if obj and obj:get_luaentity() then
obj:get_luaentity():set_node(nod)
end
end end
end end
break break
end end
end end
end, end
}) })