1
0
Fork 0

Check node_replaceable after dig_by_piston

Allows tallgrass, nether vines etc to drop
This commit is contained in:
seventeenthShulker 2023-07-04 18:22:05 +02:00
parent e5829f719d
commit 98cf3b7f7a
1 changed files with 32 additions and 33 deletions

View File

@ -141,21 +141,19 @@ function mesecon.mvps_get_stack(pos, dir, maximum, piston_pos)
return return
end end
if not node_replaceable(nn.name) then
if minetest.get_item_group(nn.name, "dig_by_piston") == 1 then if minetest.get_item_group(nn.name, "dig_by_piston") == 1 then
-- if we want the node to drop, e.g. sugar cane, do not count towards push limit -- if we want the node to drop, e.g. sugar cane, do not count towards push limit
table.insert(dig_nodes, {node = nn, pos = {x=np.x, y=np.y, z=np.z}}) table.insert(dig_nodes, {node = nn, pos = {x=np.x, y=np.y, z=np.z}})
else else
if not node_replaceable(nn.name) then
table.insert(nodes, {node = nn, pos = {x=np.x, y=np.y, z=np.z}}) table.insert(nodes, {node = nn, pos = {x=np.x, y=np.y, z=np.z}})
if #nodes > maximum then return nil, nil, false, true end if #nodes > maximum then return nil, nil, false, true end
end
-- add connected nodes to frontiers, connected is a vector list -- add connected nodes to frontiers, connected is a vector list
-- the vectors must be absolute positions -- the vectors must be absolute positions
local connected = {} local connected = {}
local has_loop local has_loop
if minetest.registered_nodes[nn.name] if minetest.registered_nodes[nn.name] and minetest.registered_nodes[nn.name].mvps_sticky then
and minetest.registered_nodes[nn.name].mvps_sticky then
connected, has_loop = minetest.registered_nodes[nn.name].mvps_sticky(np, nn, piston_pos) connected, has_loop = minetest.registered_nodes[nn.name].mvps_sticky(np, nn, piston_pos)
if has_loop then if has_loop then
return {}, {}, true, false return {}, {}, true, false
@ -182,6 +180,7 @@ function mesecon.mvps_get_stack(pos, dir, maximum, piston_pos)
end end
end end
end end
end
table.remove(frontiers, 1) table.remove(frontiers, 1)
end end