Guest User

HunterForce

a guest
Sep 2nd, 2014
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. term.write("Current level? ")
  2. level = read()
  3.  
  4. term.write("Length? ")
  5. length = read()
  6.  
  7. term.write("Width? ")
  8. width = read()
  9.  
  10. function goDig()-- Order of Operations
  11.     for i=1, level/3 do
  12.         depth = i
  13.         wide()
  14.         for w=1, 3 do
  15.             while not turtle.down()do
  16.             turtle.digDown()
  17.             end
  18.         end
  19.     end
  20. end
  21.  
  22. function wide()
  23.     for i=1, width / 2 do
  24.     current = i
  25.     goLine()
  26.     turnLeft()
  27.     goLine()
  28.         if turtle.getItemCount(14)>0 then --returns ore if slot 14 is occupied
  29.         turtle.turnLeft()
  30.             for p=1, i do
  31.             turtle.forward()
  32.             end
  33.                 for u=1, depth do
  34.                 turtle.up()
  35.                 end
  36.                     for x=4,16 do
  37.                     turtle.select(x)
  38.                     turtle.drop()
  39.                     end
  40.                 for a=1, depth do
  41.                 turtle.down()
  42.                 end
  43.                 turtle.turnRight()
  44.                 turtle.turnRight()
  45.             for s=1, current do
  46.             turtle.forward()
  47.             end
  48.             turtle.turnRight()
  49.         else turtle.turnRight()
  50.             while not turtle.forward()do
  51.             turtle.dig()
  52.             end
  53.             turtle.turnRight()
  54.         end
  55.     end
  56.     if current==width/2 then
  57.     turtle.turnRight()
  58.         for i=1, current do
  59.         turtle.forward()
  60.         end
  61.     turtle.turnleft()
  62.     end
  63. end
  64.                
  65.  
  66. function goLine()
  67.     for j=1, length do 
  68.     compareToOre()
  69.         while not turtle.forward() do
  70.         turtle.dig()
  71.         end
  72.     dropTrash()
  73.     end
  74. end
  75.  
  76. --FUNCTIONS FOR GOLINE
  77. function compareToOre()--detects ore on ceiling and floor and mines
  78.     for k=1, 3 do
  79.         turtle.select(i)
  80.             if not turtle.compareUp()then
  81.             turtle.digUp()
  82.             end
  83.             if not turtle.compareDown()then
  84.             turtle.digDown()
  85.             end
  86.     end
  87. end
  88.  
  89. function dropTrash()--finds cobble/(slot 1)
  90. turtle.digDown()
  91.     for i=4,16 do
  92.     turtle.select(i)
  93.         if turtle.compareTo(1) then
  94.         turtle.dropDown()
  95.         elseif turtle.compareTo(2)then
  96.         turtle.dropDown()
  97.         elseif turtle.compareTo(3)then
  98.         turtle.dropDown()  
  99.         end
  100.     end  
  101.     for j=1,3 do--sets trash slots to 1
  102.     turtle.select(j)
  103.     turtle.dropDown(turtle.getItemCount(j)-1)
  104.     end                
  105. end
  106.  
  107. function turnLeft()
  108.     turtle.turnLeft()
  109.     while not turtle.forward()do
  110.     turtle.dig()
  111.     end
  112.     turtle.turnLeft()
  113. end
  114.  
  115. function turnRight()
  116.     turtle.turnRight()
  117.     while not turtle.forward()do
  118.     turtle.dig()
  119.     end
  120. end
  121.  
  122. --END FUNCTIONS FOR GOLINE
Advertisement
Add Comment
Please, Sign In to add comment