Neopherus

Logger for Panda

Feb 6th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. -- Vars
  3. local tArgs = { ... }
  4. local togo = tonumber(tArgs[1])
  5. local width = tonumber(tArgs[2])
  6. togo = togo or 1
  7. width = width or togo
  8.  
  9.  
  10. -- Functions
  11. function tfuel(amount)
  12.  if turtle.getFuelLevel() < 5 then
  13.   turtle.select(16)
  14.   turtle.refuel(amount)
  15.   turtle.select(1)
  16.  end
  17. end
  18.  
  19. function upuntil()
  20.  local upc = 0
  21.  for u = 1, 5 do
  22.   repeat
  23.    tfuel(1)
  24.    turtle.digUp()
  25.    turtle.dig()
  26.    if turtle.up() then
  27.     upc = upc + 1
  28.    end
  29.    sleep(0.25)
  30.   until turtle.detectUp() == false
  31.  end
  32.  for dc = 1, upc do
  33.   tfuel(1)
  34.   turtle.down()
  35.  end
  36. end
  37.  
  38. function turnaround()
  39.   turtle.turnRight()
  40.   turtle.turnRight()
  41. end
  42.  
  43. -- Main Script
  44. for i = 1, width do
  45.  for j = 1, togo do
  46.   tfuel(1)
  47.   if turtle.detect() then
  48.    repeat
  49.     turtle.dig()
  50.     sleep(0.5)
  51.    until turtle.detect() == false
  52.    turtle.forward()
  53.    upuntil()
  54.   else
  55.    turtle.forward()
  56.    upuntil()
  57.   end
  58.  end
  59.  turnaround()
  60.  for j = 1, togo do
  61.   tfuel(1)
  62.   turtle.forward()
  63.  end
  64.  turtle.turnLeft()
  65.  if turtle.detect() then
  66.   repeat
  67.    turtle.dig()
  68.    sleep(0.5)
  69.   until turtle.detect() == false
  70.  end
  71.  turtle.forward()
  72.  turtle.turnLeft()
  73. end
Advertisement
Add Comment
Please, Sign In to add comment