hilburn

Auto Quarry Boundaries

Aug 5th, 2014
609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local fence_slot=3
  2.  
  3. local function refuel()
  4.     turtle.select(1)
  5.     turtle.dig()
  6.     turtle.place()
  7.     turtle.suck()
  8.     turtle.refuel()
  9.     turtle.dig()
  10. end
  11.  
  12. local function restock()
  13.     turtle.select(2)
  14.     turtle.dig()
  15.     turtle.place()
  16.     for i = 3,15 do
  17.         turtle.select(i)
  18.         turtle.suck()
  19.     end
  20.     turtle.select(2)
  21.     turtle.dig()
  22.     fence_slot=3
  23. end
  24.  
  25. local function placeFence()
  26.     turtle.select(slot)
  27.     while not turtle.placeDown() do
  28.         if slot<15 then
  29.             slot=slot+1
  30.         else
  31.             restock()
  32.         turtle.select(slot)
  33.         end
  34.     end
  35. end
  36.  
  37. local function forward()
  38.     if turtle.getFuelLevel<50 then refuel() end
  39.     turtle.select(16)
  40.     turtle.digDown()
  41.     turtle.dropUp()
  42.     placeFence()
  43.     local moved=true
  44.     while moved and not turtle.forward() do
  45.             moved = turtle.dig() or turtle.attack()
  46.         turtle.dropUp()
  47.     end
  48. end
  49.  
  50. local function setQuarry(a,b)
  51.     for side=1,4 do
  52.         sidelength = a
  53.         if side%2 ==0 then sidelength = b end
  54.         for i=1,sidelength do
  55.             forward()
  56.         end
  57.         turtle.turnLeft()
  58.     end
  59. end
  60.  
  61. setQuarry(500,500)
Advertisement
Add Comment
Please, Sign In to add comment