adamg765

Garden

Jan 9th, 2017
87
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tArgs = { ... }
  2. width, height = tonumber(tArgs[1]), tonumber(tArgs[2])
  3.  
  4. fuel = 1
  5. local function refuel()
  6.     if turtle.getFuelLevel() < 100 then
  7.         local prev = turtle.getSelectedSlot()
  8.         turtle.select(1)
  9.         if not turtle.refuel(1) then
  10.             print('Need more fuel')
  11.             while not turtle.refuel(1) do
  12.                 sleep(1)
  13.             end
  14.         end
  15.         turtle.select(prev)
  16.     end
  17. end
  18.  
  19. local function tryForwards()
  20.     if turtle.detect() then
  21.         turtle.dig()
  22.     end
  23.     while not turtle.forward() do
  24.         sleep(1)
  25.     end
  26. end
  27.  
  28. local function turn(i)
  29.     if (width - i) % 2 == 0 then
  30.         turtle.turnRight()
  31.         tryForwards()
  32.         turtle.turnRight()
  33.     else
  34.         turtle.turnLeft()
  35.         tryForwards()
  36.         turtle.turnLeft()
  37.     end
  38. end
  39. local function dropAndTurn()
  40.     for i = fuel + 1, 16, 1 do
  41.         turtle.select(i)
  42.         if turtle.getItemCount() > 0 and not turtle.drop() then
  43.             turtle.turnLeft()
  44.             turtle.drop()
  45.             turtle.turnRight()
  46.         end
  47.     end
  48.     turtle.turnRight()
  49.     turtle.turnRight()
  50. end
  51. while true do
  52.     tryForwards()
  53.     for i = 1, width, 1 do
  54.         for j = 1, height-1, 1 do
  55.             refuel()
  56.             tryForwards()
  57.         end
  58.         if i ~= width then
  59.             turn(i)
  60.         end
  61.     end
  62.     turtle.forward()
  63.     turtle.turnRight()
  64.     turtle.suck()
  65.     turtle.turnLeft()
  66.  
  67.     dropAndTurn()
  68. 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.

×