TheKojent icon

flatten64

TheKojent | PRO | 02/01/13 03:16:21 AM UTC | 0 ⭐ | 175 👁️ | Never ⏰ | []
Lua |

1.13 KB

|

None

|

0 👍

/

0 👎

--flattens a 64x64 area
function forward()
  while not turtle.forward() do
    if not turtle.detect() then
      turtle.attack()
    else
      turtle.dig()
    end
  end
end
 
function floorCheck()
  if not turtle.detectDown() then
    turtle.select(1)
    turtle.placeDown()
  end
end
 
function flat()
  while turtle.detectUp() do
    turtle.digUp()
    turtle.Up()
  end
  while not turtle.detectDown() do
    turtle.down()
  end
end
 
function flattenRow()
  x = 0
  flat()
  while x < 63 do
    forward()
    floorCheck()
    flat()
    x = x + 1
    turtle.suck()
  end
end
 
function returnH()
  z = y - 1
  turtle.turnLeft()
  while z ~= 0 do
    forward()
    z = z - 1
  end
  turtle.turnLeft()
  for i = 1,63 do
    forward()
  end
end
 
function invDump()
  i = 1
  for 1,15 do
    i = i + 1
    turtle.select(i)
    turtle.drop()
  end
  turtle.select(1)
  turtle.dropUp()
  turtle.suckUp()
end
 
y = 0
while y < 63 do
  y = y + 1
  flattenRow()
  returnH()
  invDump()
  turtle.turnLeft()
  r = y
  while r ~= 0 do
    forward()
    r = r - 1
  end
  turtle.turnLeft()
end
flattenRow()
returnH()
invDump()

Comments