Advertisement
le_Fish

Floorbuilder v1

Aug 12th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. local select_slot = 0
  2.  
  3. local ender_chest_slot = 1
  4.  
  5. local forward_motion = 0
  6. local left_motion = 0
  7.  
  8. local left_right = "right"
  9.  
  10. term.write("Insert Length: ")
  11. Length = tonumber(read()) - 1
  12. print(" ")
  13.  
  14. term.write("Insert Width: ")
  15. Width = tonumber(read())
  16. print(" ")
  17.  
  18. local Length = Length
  19. local Width = Width
  20.  
  21. function strip()
  22.     if left_motion % 2 == 0 then
  23.         while forward_motion ~= Length do
  24.             selectSlot()
  25.             turtle.placeDown()
  26.             turtle.forward()
  27.             forward_motion = forward_motion + 1
  28.         end        
  29.     else
  30.         while forward_motion ~= 0 do
  31.             selectSlot()
  32.             turtle.placeDown()
  33.             turtle.forward()
  34.             forward_motion = forward_motion - 1
  35.         end    
  36.     end
  37. end
  38.  
  39. function turn()
  40.     if left_motion % 2 == 0 then
  41.         turtle.turnRight()
  42.         turtle.placeDown()
  43.         turtle.forward()
  44.         left_motion = left_motion + 1
  45.         turtle.turnRight()
  46.     else
  47.         turtle.turnLeft()
  48.         turtle.placeDown()
  49.         turtle.forward()
  50.         left_motion = left_motion + 1
  51.         turtle.turnLeft()
  52.     end
  53. end
  54.  
  55. function selectSlot()
  56.     for q=1,16 do
  57.         local item_detail = turtle.getItemDetail(q)
  58.         if item_detail then
  59.             select_slot = q
  60.             break
  61.         end
  62.     end
  63.     turtle.select(select_slot)
  64. end
  65.  
  66. print("STARTING")
  67. while left_motion ~= Width do
  68.     strip()
  69.     turn()
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement