mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
add nether vine placement checks for top and bottom of nodes (#4129)
This adds placement checks to weeping and twisting vines, weeping vines should only be placed on bottom of nodes and twisting vines should only be placed on top of nodes. Most of the work for this was done by JoseDouglas26. This was made with their permission, I just had to tweak the code a bit to get twisting vines to place right. Thank you Jose! Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4129 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land> Co-authored-by: SmokeyDope <smokey@tilde.team> Co-committed-by: SmokeyDope <smokey@tilde.team>
This commit is contained in:
parent
8e103cf615
commit
2d2b64006b
1 changed files with 32 additions and 1 deletions
|
@ -148,6 +148,22 @@ minetest.register_node("mcl_crimson:twisting_vines", {
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
local under = pointed_thing.under
|
||||||
|
local above = pointed_thing.above
|
||||||
|
local unode = minetest.get_node(under)
|
||||||
|
if under.y < above.y then
|
||||||
|
minetest.set_node(above, {name = "mcl_crimson:twisting_vines"})
|
||||||
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if unode.name == "mcl_crimson:twisting_vines" then
|
||||||
|
return minetest.registered_nodes[unode.name].on_rightclick(under, unode, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
on_dig = function(pos, node, digger)
|
on_dig = function(pos, node, digger)
|
||||||
local above = vector.offset(pos,0,1,0)
|
local above = vector.offset(pos,0,1,0)
|
||||||
local abovenode = minetest.get_node(above)
|
local abovenode = minetest.get_node(above)
|
||||||
|
@ -223,7 +239,22 @@ minetest.register_node("mcl_crimson:weeping_vines", {
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
local under = pointed_thing.under
|
||||||
|
local above = pointed_thing.above
|
||||||
|
local unode = minetest.get_node(under)
|
||||||
|
if under.y > above.y then
|
||||||
|
minetest.set_node(above, {name = "mcl_crimson:weeping_vines"})
|
||||||
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if unode.name == "mcl_crimson:weeping_vines" then
|
||||||
|
return minetest.registered_nodes[unode.name].on_rightclick(under, unode, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
on_dig = function(pos, node, digger)
|
on_dig = function(pos, node, digger)
|
||||||
local below = vector.offset(pos,0,-1,0)
|
local below = vector.offset(pos,0,-1,0)
|
||||||
local belownode = minetest.get_node(below)
|
local belownode = minetest.get_node(below)
|
||||||
|
|
Loading…
Reference in a new issue