2021-05-25 12:52:25 +02:00
|
|
|
local vector = vector
|
|
|
|
|
|
|
|
local facedir_to_dir = minetest.facedir_to_dir
|
|
|
|
local get_item_group = minetest.get_item_group
|
|
|
|
local remove_node = minetest.remove_node
|
|
|
|
local get_node = minetest.get_node
|
|
|
|
|
2018-01-08 20:10:44 +01:00
|
|
|
local original_function = minetest.check_single_for_falling
|
|
|
|
|
2021-05-25 12:52:25 +02:00
|
|
|
function minetest.check_single_for_falling(pos)
|
2018-01-08 20:10:44 +01:00
|
|
|
local ret_o = original_function(pos)
|
|
|
|
local ret = false
|
|
|
|
local node = minetest.get_node(pos)
|
2021-05-25 12:52:25 +02:00
|
|
|
if get_item_group(node.name, "attached_node_facedir") ~= 0 then
|
|
|
|
local dir = facedir_to_dir(node.param2)
|
2020-02-23 20:37:42 +01:00
|
|
|
if dir then
|
2021-05-25 12:52:25 +02:00
|
|
|
if get_item_group(get_node(vector.add(pos, dir)).name, "solid") == 0 then
|
|
|
|
remove_node(pos)
|
2020-02-23 20:37:42 +01:00
|
|
|
local drops = minetest.get_node_drops(node.name, "")
|
|
|
|
for dr=1, #drops do
|
|
|
|
minetest.add_item(pos, drops[dr])
|
|
|
|
end
|
|
|
|
ret = true
|
2018-01-08 20:10:44 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return ret_o or ret
|
|
|
|
end
|
|
|
|
|