Professional Documents
Culture Documents
Startup
Startup
Startup
--de 1 o 2 de ancho
function cut1()
altura = 0
while turtle.detectUp() do
altura = altura + 1
turtle.digUp()
turtle.up()
end
for i = 0, altura do
turtle.down(altura)
end
turtle.back()
end
function cut2(l_l)
altura = 0
turtle.dig()
while turtle.detectUp() do
altura = altura + 1
turtle.digUp()
turtle.up()
turtle.dig()
end
if l_l == 1 then
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnRight()
else
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnLeft()
end
turtle.dig()
for i = 1, altura do
turtle.digDown()
turtle.down()
turtle.dig()
end
if l_l == 1 then
turtle.turnLeft()
turtle.back()
turtle.turnRight()
turtle.back()
else
turtle.turnRight()
turtle.back()
turtle.turnLeft()
turtle.back()
end
end
function cut(t_t)
if t_t == 0 then
cut1()
else
cut2(t_t)
end
end
function rearrange()
print("preparando")
turtle.select(1)
if turtle.getItemCount(1) ~= 0 then
for i = 2, 16 do
if turtle.getItemCount(i) > 0 then
if turtle.compare(i) then
turtle.transferTo(i)
break
end
elseif turtle.getItemCount(i) < 1 then
turtle.transferTo(i)
break
end
end
turtle.select(1)
end
end
function checkTree()
rearrange()
turtle.dig()
turtle.forward()
end
function plant_tree()
--to do
end
--INIT
local success, d = turtle.inspect()
term.clear()
term.setCursorPos(1, 1)
print("Finalizado.")
end
read()