Advertisement
mauza

turtle_floor

Jun 14th, 2021 (edited)
1,096
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1.  
  2.  
  3. function place()
  4.     slot = turtle.getSelectedSlot()
  5.     slot_count = turtle.getItemCount()
  6.     if slot_count == 0 then
  7.         slot = slot + 1
  8.         if slot == 17 then
  9.             print("You are out of building material")
  10.             os.exit()
  11.         end
  12.         turtle.select(slot)
  13.     end
  14.     turtle.placeDown()
  15. end
  16.  
  17. continuing = true
  18. turning_integer = 0
  19. while continuing do
  20.     while turtle.forward() do
  21.         place()
  22.     end
  23.     if turning_integer % 2 == 0 then
  24.         turn = turtle.turnLeft
  25.     else
  26.         turn = turtle.turnRight
  27.     end
  28.     turn()
  29.     continuing = turtle.forward()
  30.     place()
  31.     turn()
  32.     turning_integer = turning_integer + 1
  33. end
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement