adamg765

bottomFloor

Mar 8th, 2017
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local length = 61
  2. local width = 61
  3.  
  4. local function refuel()
  5.     if turtle.getFuelLevel() < 50 then
  6.         local prev = turtle.getSelectedSlot()
  7.         turtle.select(1)
  8.         if not turtle.refuel(4) then
  9.             print('Need more fuel')
  10.             while not turtle.refuel(4) do
  11.                 sleep(3)
  12.             end
  13.         end
  14.         turtle.select(prev)
  15.     end
  16. end
  17.  
  18. local function tryBackwards()
  19.     refuel()
  20.     turtle.back()
  21. end
  22.  
  23. local function advance()
  24.     if turtle.getSelectedSlot() == 16 then
  25.         print('Need more materials')
  26.         local empty = true
  27.         while empty do
  28.             for n=2, 16 do
  29.                 print (n)
  30.                 if turtle.getItemCount(n) > 0 then
  31.                     empty = false
  32.                     turtle.select(n)
  33.                     return
  34.                 end
  35.             end
  36.             sleep(3)
  37.         end
  38.     else
  39.         turtle.select(turtle.getSelectedSlot() + 1)
  40.     end
  41. end
  42.  
  43. local function placeBlock()
  44.     for i = 0, 2, 1 do
  45.         if not turtle.place() or turtle.getItemCount() == 0 then
  46.             while turtle.getItemCount() == 0 do
  47.                 advance()
  48.             end
  49.         end
  50.     end
  51. end
  52.  
  53. local function turnAround(i)
  54.     if i%2 == 1 then
  55.         turtle.turnRight()
  56.         tryBackwards()
  57.         placeBlock()
  58.         turtle.turnRight()
  59.     else
  60.         turtle.turnLeft()
  61.         tryBackwards()
  62.         placeBlock()
  63.         turtle.turnLeft()
  64.     end
  65. end
  66. turtle.select(2)
  67. for i = 1, length, 1 do
  68.     for j = 1, width-1, 1 do
  69.         refuel()
  70.         tryBackwards()
  71.         placeBlock()
  72.     end
  73.     turnAround(i)
  74. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×