Advertisement
Guest User

build

a guest
Jul 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. function buildFloor(x,y)
  2.  turtle.refuel()
  3.  print("F:" .. turtle.getFuelLevel())
  4.  local turnRight = true
  5.  local found = false
  6.  local k = 2
  7.  turtle.select(k)
  8.  for i = 1, x do
  9.   for j = 1, y do
  10.    local data = turtle.getItemDetail()
  11.    if data then
  12.     found = true
  13.    else
  14.     found = false
  15.     k = k + 1
  16.    end
  17.    while found == false and k <= 16 do
  18.     turtle.select(k)
  19.     data = turtle.getItemDetail()
  20.     if data then
  21.      found = true
  22.     else
  23.      k = k + 1
  24.     end
  25.    end
  26.    if found == true then
  27.     turtle.placeDown()
  28.     turtle.forward()
  29.     found = false
  30.    end
  31.   end
  32.   turtle.placeDown()
  33.   if turnRight == true then
  34.    turtle.turnRight()
  35.    turtle.forward()
  36.    turtle.turnRight()
  37.    turnRight = false
  38.   else
  39.    turtle.turnLeft()
  40.    turtle.forward()
  41.    turtle.turnLeft()
  42.    turnRight = true
  43.   end
  44.  end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement