Growth tool: Grow vines, ladder and rope
This commit is contained in:
parent
15093febd4
commit
4773cdafea
@ -651,6 +651,38 @@ minetest.register_tool("tools:grow", {
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif nname == "nodes:vine" or nname == "nodes:ladder" or nname == "nodes:rope" then
|
||||
-- Grow vines. Also grow other climbable nodes as they are similar
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
if param2 >= 2 or nname == "nodes:rope" then
|
||||
-- Grow downwards if sideways or rope
|
||||
local below
|
||||
for i=1,15 do
|
||||
below = {x=pos.x,y=pos.y-i,z=pos.z}
|
||||
local node = minetest.get_node(below)
|
||||
if node.name == "air" then
|
||||
minetest.set_node(below, {name=nname, param2=param2})
|
||||
break
|
||||
elseif node.name ~= nname then
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
-- At floor or ceiling: grow around
|
||||
local posses = {
|
||||
{ x=1, y=0, z=0 },
|
||||
{ x=-1, y=0, z=0 },
|
||||
{ x=0, y=0, z=1 },
|
||||
{ x=0, y=0, z=-1 },
|
||||
}
|
||||
for p=1, #posses do
|
||||
local ppos = vector.add(pos, posses[p])
|
||||
if minetest.get_node(ppos).name == "air" then
|
||||
minetest.set_node(ppos, {name=nname, param2=param2})
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif nname == "nodes:dirt" then
|
||||
-- Grow grass cover on dirt
|
||||
for x = math.max(box.minp.x + 1, pos.x - 2), math.min(box.maxp.x - 1, pos.x + 2) do
|
||||
|
Loading…
x
Reference in New Issue
Block a user