lso44

SimpleMiner For ComputerCraft

Oct 14th, 2021 (edited)
237
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- https://pastebin.com/R75JpeYu by p0ancf_36
  2.  
  3. turtle.refuel(1);
  4. print(turtle.getFuelLevel())
  5.  
  6. local X = 0
  7. local Y = 0
  8. local Z = 0
  9.  
  10. local xBase = 0
  11. local yBase = 0
  12. local zBase = 0
  13.  
  14. local t_dir = {
  15.     TOP = 0,
  16.     RIGHT = 1,
  17.     BOTTOM = 2,
  18.     LEFT = 3
  19. }
  20. local dir = t_dir.TOP
  21.  
  22. function forward()
  23.     turtle.forward()
  24.     if (dir == 0) then X = X + 1
  25.     elseif (dir == 1) then Z = Z + 1
  26.     elseif (dir == 2) then X = X - 1
  27.     elseif (dir == 3) then Z = Z - 1
  28.     end
  29. end
  30.  
  31. while (true) do
  32.     local baseVector = vector.new(xBase, yBase, zBase)
  33.     local ownVector = vector.new(X, Y, Z)
  34.     local distance = own - baseVector
  35.  
  36.     if (math.abs(distance) > turtle.getFuelLevel()) then
  37.         print("Out of fuel!")
  38.     end
  39.  
  40.     turtle.dig()
  41.     forward()
  42.     turtle.digUp()
  43.     turtle.digDown()
  44. end
  45.  
RAW Paste Data