9551

Untitled

May 19th, 2021 (edited)
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. local arg = {...}
  2. local t = turtle
  3. local ends = true
  4. doneval = 0
  5. rednet.open("right")
  6. turtle.refuel(1)
  7. local receives = 0
  8. local function digs(bloc)
  9. for is = 0, bloc - 1 do
  10. t.dig()
  11. t.forward()
  12. t.digUp()
  13. end
  14. end
  15. function digLeft(valu)
  16. digs(1)
  17. t.turnLeft()
  18. digs(valu - 1)
  19. t.turnRight()
  20. end
  21. function digRight(value)
  22. digs(1)
  23. t.turnRight()
  24. digs(value - 1)
  25. t.turnLeft()
  26. end
  27. local function dig(vals)
  28. for action = 0, (vals / 2) - 1 do
  29. digRight(vals)
  30. digLeft(vals)
  31. if receives > 0 then
  32. doneval = doneval + 1
  33. rednet.broadcast(doneval * 2)
  34. end
  35. end
  36. end
  37. if arg[1] == "w" then
  38. a, b, c = rednet.receive()
  39. end
  40. while ends == true do
  41. if arg[1] == "w" then
  42. print("wireless mode: active")
  43. if b ~= nil then
  44. res = b
  45. end
  46. save = arg[1]
  47. arg[1] = tonumber(res)
  48. if arg[2] == "%" then
  49. receives = 1
  50. print("percentage mode: active")
  51. end
  52. end
  53. if t.getFuelLevel() < 50 then
  54. repeat
  55. turtle.refuel(1)
  56. until t.getFuelLevel() > 50
  57. end
  58. dig(arg[1])
  59. sleep(3)
  60. ends = false
  61. end
  62. if save == "w" then
  63. rednet.broadcast("FINISHED")
  64. shell.run("dig w %")
  65. end
  66.  
Add Comment
Please, Sign In to add comment