Advertisement
Imgoodisher

build floor v2

Jun 16th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local tArgs = {...}
  2. local halfslabs = string.lower(tArgs[1] or "") == "true"
  3.  
  4. local left = true
  5. local selected = 1
  6.  
  7. turtle.select(selected)
  8.  
  9. local function placeDown()
  10.     if turtle.detectDown() then
  11.         turtle.digDown()
  12.     end
  13.     turtle.placeDown()
  14. end
  15.  
  16. local function place()
  17.     while turtle.getItemCount(selected) == 0 do
  18.         selected = selected + 1
  19.         turtle.select(selected)
  20.     end
  21.     placeDown()
  22.     while turtle.getItemCount(selected) == 0 do
  23.         selected = selected + 1
  24.     turtle.select(selected)
  25.     end
  26.     if halfslabs then placeDown() end
  27. end
  28.  
  29. while true do
  30.     while not turtle.detect() do
  31.         place()
  32.         turtle.forward()
  33.     end
  34.     place()
  35.     if left then
  36.         turtle.turnLeft()
  37.         turtle.forward()
  38.         turtle.turnLeft()
  39.     else
  40.         turtle.turnRight()
  41.         turtle.forward()
  42.         turtle.turnRight()
  43.     end
  44.     left = not left
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement