Guest User

Untitled

a guest
Dec 14th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. --first two slots are base mats
  2.  
  3. x,y,z = 0,0,0
  4. local length = 10
  5. local width = 10
  6. local height = 10
  7.  
  8. function ClearLand(length,height)
  9.   --will clear land for building.
  10.   for i=1,length do
  11.     matLeft = turtle.getItemCount(1)
  12.     if matLeft <= 1 then
  13.       turtle.select(2)
  14.     else
  15.       turtle.select(1)
  16.     end
  17.     frontB = turtle.detect()
  18.     upB = turtle.detectUp()
  19.     downB = turtle.detectDown()
  20.     if frontB and i<length then
  21.       turtle.dig()
  22.     end
  23.     if upB then
  24.       turtle.digUp()
  25.       turtle.up()
  26.       y=y+1
  27.  
  28.       local curH = 0
  29.       for p=1,height do
  30.         upB2 = turtle.detectUp()
  31.         curH = curH + 1
  32.         if upB2 then
  33.           turtle.digUp()
  34.           turtle.up()
  35.           y=y+1
  36.         else
  37.           break
  38.         end
  39.       end
  40.       print(curH)
  41.       for q=1,curH do
  42.         turtle.down()
  43.         y=y-1
  44.       end
  45.     end
  46.     if downB == false then
  47.       turtle.placeDown()
  48.     else
  49.       turtle.digDown()
  50.       turtle.placeDown()
  51.     end
  52.     if i < length then  
  53.       turtle.forward()
  54.       x=x+1
  55.     end
  56.   end
  57.   print("Finished column.")
  58. end
  59.  
  60. function main(length,width,height)
  61.   for i=1,width do
  62.     ClearLand(length,height)    
  63.     if i < width and i%2==0 then
  64.       turtle.turnLeft()
  65.       local block = turtle.detect()
  66.       if block then
  67.         turtle.dig()
  68.       end
  69.       turtle.forward()
  70.       turtle.turnLeft()
  71.     else
  72.       turtle.turnRight()
  73.       block = turtle.detect()
  74.       if block then
  75.         turtle.dig()
  76.       end
  77.       turtle.forward()
  78.       turtle.turnRight()
  79.     end
  80.   end  
  81.   print("I'm done.")
  82. end
  83.  
  84. main(length,width,height)
Add Comment
Please, Sign In to add comment