Add node breaking logic to twisting vines and weeping vines

breaking twisting vines will break the ones above them, breaking weeping vines breaks the ones below them
This commit is contained in:
SmokeyDope 2023-01-24 17:15:22 +00:00
parent dc3eedac5f
commit 6f22d7daa4

View file

@ -149,6 +149,16 @@ minetest.register_node("mcl_crimson:twisting_vines", {
end end
return itemstack return itemstack
end, end,
--breaking twisting vines breaks the vines above logic
on_dig = function(pos, node, digger)
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local abovenode = minetest.get_node(above)
minetest.node_dig(pos, node, digger)
if abovenode.name == node.name and (not mcl_core.check_vines_supported(above, abovenode)) then
minetest.registered_nodes[node.name].on_dig(above, node, digger)
end
end,
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
@ -216,6 +226,17 @@ minetest.register_node("mcl_crimson:weeping_vines", {
end end
return itemstack return itemstack
end, end,
--breaking weeping vines breaks the vines below logic
on_dig = function(pos, node, digger)
local below = {x=pos.x, y=pos.y-1, z=pos.z}
local belownode = minetest.get_node(below)
minetest.node_dig(pos, node, digger)
if belownode.name == node.name and (not mcl_core.check_vines_supported(below, belownode)) then
minetest.registered_nodes[node.name].on_dig(below, node, digger)
end
end,
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {