Advertisement
Marlingaming

Turtle Miner Base (WIP)

Sep 10th, 2021 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. --this program allows any turtle to become a miner
  2. M_StartCord = {...}
  3. TurtleX = 1
  4. TurtleY = 1
  5. TurtleZ = 1
  6. TurtleHeading = 1
  7. TargetCord = {...}
  8. Layer = 1
  9. Dir = 1
  10. local MineMode = 1
  11. start()
  12.  
  13. function start()
  14.  
  15. end
  16.  
  17. function MinerManager()
  18. while true do
  19. if MineMode == 1 then
  20. if TurtleZ < TargetCord[3] then
  21. Move("Forward")
  22. elseif TurtleZ > TargetCord[3] then
  23. Move("Back")
  24. elseif TurtleZ == TargetCord[3] then
  25. Move("Right")
  26. end
  27. if TurtleX == TargetCord[1] and TurtleZ == TargetCord[3] and TurtleY == TargetCord[2] then
  28. MineMode = 3
  29. elseif TurtleX == TargetCord[1] and TurtleZ == TargetCord[3] then
  30. MineMode = 2
  31. end
  32. elseif MineMode == 2 then
  33. if TurtleX > M_StartCord[1] then
  34. Move("Right")
  35. elseif TurtleX < M_StartCord[1] then
  36. Move("Left")
  37. end
  38. if TurtleZ > M_StartCord[2] then
  39. Move("Back")
  40. elseif TurtleZ < M_StartCord[2] then
  41. Move("Forward")
  42. end
  43. end
  44. end
  45. end
  46.  
  47. function Move(Direction)
  48. if Direction == "Forward" then
  49. TurtleZ = TurtleZ + 1
  50. turtle.forward()
  51. elseif Direction == "Back" then
  52. TurtleZ = TurtleZ - 1
  53. turtle.backwards()
  54. elseif Direction == "Right" then
  55. TurtleX = TurtleX + 1
  56. turtle.right()
  57. elseif Direction == "Left" then
  58. TurtleX = TurtleX - 1
  59. turtle.left()
  60. end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement