Advertisement
AkaZombie

Branch Mine ComputerCraft

Dec 15th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. --Branch Mine Version 1.0 By AkaZombie
  2.  
  3. -- Variables
  4. turtle.select(1)
  5. local tArgs = { ... }
  6. local togo = tonumber(tArgs[1])
  7. togo = togo or 1
  8. print("Going Boss!")
  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 turnaround()
  20.   turtle.turnRight()
  21.   turtle.turnRight()
  22. end
  23.  
  24. function uandd()
  25.   if turtle.detectUp() then
  26.    turtle.digUp()
  27.   end
  28.   if turtle.detectDown() then
  29.    turtle.digDown()
  30.   end
  31. end
  32.  
  33. -- Starting Out
  34. for i = 1, togo do
  35.   tfuel(1)
  36.   if turtle.detect() then
  37.    repeat
  38.     turtle.dig()
  39.     sleep(0.25)
  40.    until turtle.detect() == false
  41.    turtle.forward()
  42.    uandd()
  43.   else
  44.    turtle.forward()
  45.    uandd()
  46.   end
  47.   if togo >= 10 then
  48.    if (i % 10 == 0) then
  49.     turtle.placeDown()
  50.    end
  51.   end
  52. end
  53.  
  54. --Lets assume that worked and he made it
  55. turnaround()
  56. for r = 1, togo do
  57.  tfuel(1)
  58.  turtle.forward()
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement