1
0
Fork 0
VoxeLibre-Fork-Pixel/mods/CORE/mcl_attached/init.lua

30 lines
803 B
Lua
Raw Normal View History

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
local original_function = minetest.check_single_for_falling
2021-05-25 12:52:25 +02:00
function minetest.check_single_for_falling(pos)
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
end
end
end
return ret_o or ret
end