Advertisement
RikoHusky

ChunkMiner

Nov 26th, 2022 (edited)
890
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.55 KB | Gaming | 0 0
  1. --Written by Jacob Christensen, 11/26/2022
  2. --Program Description: This program will mine out a 16x16 chunk starting from (0,16).
  3.  
  4. --Program Start--
  5. print("Mmm I'm so hungry, let my feast begin!")
  6.  
  7. --Function Definition--
  8.  
  9. --LeftProcess - Turn Left: When the turtle is at the end of a line and needs to turn left. Turtle will turn left, mine, move forward, turn left again.
  10. function LeftProcess()
  11.     turtle.turnLeft()
  12.     turtle.dig()
  13.     turtle.forward()
  14.     turtle.turnLeft()
  15. end
  16.  
  17. --RightProcess - Turn Right: When the turtle is at the end of a line and needs to turn right. Turtle will turn right, mine, move forward, turn right again.
  18. function RightProcess()
  19.     turtle.turnRight()
  20.     turtle.dig()
  21.     turtle.forward()
  22.     turtle.turnRight()
  23. end
  24.  
  25. --MineLineProcess - Mine 15 blocks: This is where the turtle will mine out the line in front of it. Looping through mine, move forward 15 times.
  26. function MineLineProcess()
  27.     for i=15,1,-1 do
  28.         turtle.dig()
  29.         turtle.forward()
  30.     end
  31. end
  32.  
  33. --EndOfLayerProcess - 180 and mine: This is where the turtle is at the end of the layer, it will turn around, mine down one block and be ready for next layer start.
  34. function EndOfLayerProcess()
  35.     turtle.turnRight()
  36.     turtle.turnRight()
  37.     turtle.digDown()
  38.     turtle.down()
  39. end
  40.  
  41. --StartingProcess - Mine/Move Down turn left: This is where the turtle starts. It will mine one block down and move there it will then turn left and be ready to begin.
  42. function StartingProcess()
  43.     turtle.digDown()
  44.     turtle.down()
  45.     turtle.turnLeft()
  46. end
  47.  
  48. --LayerOneProcess: This process will have the turtle make it's first turn right & last turn right.
  49. function LayerOneProcess()
  50.     MineLineProcess()
  51.     for i=7,1,-1 do
  52.         RightProcess()
  53.         MineLineProcess()
  54.         LeftProcess()
  55.         MineLineProcess()
  56.     end
  57.     RightProcess()
  58.     MineLineProcess()
  59.     EndOfLayerProcess()
  60. end
  61.  
  62. --LayerTwoProcess: This process will have the turtle make it's first turn left & last turn left.
  63. function LayerTwoProcess()
  64.     MineLineProcess()
  65.     for i=7,1,-1 do
  66.         LeftProcess()
  67.         MineLineProcess()
  68.         RightProcess()
  69.         MineLineProcess()
  70.     end
  71.     LeftProcess()
  72.     MineLineProcess()
  73.     EndOfLayerProcess()
  74. end
  75.  
  76. --End of function defintions--
  77.  
  78. --Starting Sequence--
  79.  
  80. StartingProcess()
  81.  
  82. --Turtle will go down 128 blocks with current i value, feel free to change. (Future program upgrade, prompt turtle to ask for i value.)
  83. for i=64,1,-1 do
  84.     LayerOneProcess()
  85.     LayerTwoProcess()
  86. end
  87.  
  88. --End of program--
Advertisement
Comments
  • RikoHusky
    1 year
    # text 0.25 KB | 0 0
    1. It would be smart to load the turtle's inventory with materials that you'd like to keep. IE if you want only to pickup Iron, fill all slots with iron ore. If this is not done the turtle's inventory will fill up with random blocks and not pick up ores.
Add Comment
Please, Sign In to add comment
Advertisement