Advertisement
Guest User

quarry

a guest
Dec 7th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. miningPlot = {6,6,4}
  2. -- NO NEGATIVES PLEASE ^
  3.  
  4. pos = {0,0,0}
  5. -- +for/back- , -left/Right+ , +Up/Down-
  6.  
  7. --Preconditon: chest behind area to min in front
  8.  
  9.  
  10. direction = 0
  11. -- 0 = ^ , 1 = > , 2 = v , 3 = <,4 = up ,5 down
  12. function increment(dir)--dir is where going
  13.     if dir == 0 then
  14.         pos[0] = post[0] + 1
  15.     elseif dir == 1 then
  16.         pos[1] = pos[1] + 1
  17.    
  18.     elseif dir == 2 then
  19.         pos[0] = pos[0] - 1
  20.     elseif dir == 3 then
  21.         pos[1] = pos[1] - 1
  22.        
  23.     elseif dir == 4 then
  24.         pos[2] = pos[2] + 1
  25.     elseif dir == 5 then
  26.         pos[2] = pos[2] - 1
  27.        
  28.     end
  29. end
  30.  
  31. function left(x)
  32.     turtle.turnLeft()
  33.     forward(x)
  34.     turtle.turnRight()
  35. end
  36.  
  37. function right(x)
  38.     turtle.turnRight()
  39.     forward(x)
  40.     turtle.turnLeft()
  41. end
  42.  
  43. function back(z)
  44.     for i=0,z do
  45.         turtle.back()
  46.     end
  47. end
  48.  
  49. function forward(y)
  50.     for i=0, y do
  51.         turtle.dig()
  52.         turtle.suck()
  53.         turtle.forward()
  54.        
  55.     end
  56. end
  57.  
  58.  
  59. --precondition: turtle within left lowest corner facing towards to be mined space
  60. --postcondition: back in positon & direction
  61. function plane()    
  62.     for x=0, miningPlot[1] do
  63.         if x%2 ~= 0 then
  64.             forward(miningPlot[0])
  65.         else
  66.             back(miningPlot[0])
  67.         end
  68.         right(1)
  69.     end
  70.    
  71.     --going back to positon
  72.     if pos[0] >0 then
  73.         back(pos[0])
  74.     end
  75.     if pos[1] > 0 then
  76.         left(pos[1])
  77.     end          
  78. end
  79.  
  80. plane()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement