Advertisement
xKevinn

Dig in pyramid pattern

Sep 15th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.55 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. print("Place chests in slot 1.")
  4. print("Place light sources in slot 2.")
  5. print("")
  6. print("How big would you like the pyramid to be?")
  7. write("-> ")
  8. count=tonumber(read())
  9. count=count-1
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. print("Now running. Make sure to keep chests in slot 1 and light sources in slot 2!")
  13.  
  14. if turtle.getItemCount(2)==0 then
  15.     placeTorches=false
  16. else
  17.     placeTorches=true
  18.     hasTorches=true
  19. end
  20.  
  21. left=0
  22. right=1
  23. turn=right
  24. turtle.select(2)
  25. while count > 0 do
  26.     countHold=count+1
  27.     moves=count+1
  28.     while countHold > 0 do
  29.         countHold=countHold-1
  30.         countAmount=count
  31.         if moves > 0 then
  32.             moves=moves-1
  33.             while countAmount > 0 do
  34.                 turtle.dig()
  35.                 while turtle.detect()==true do
  36.                     turtle.dig()
  37.                 end
  38.                 turtle.forward()
  39.                 countAmount=countAmount-1
  40.             end
  41.         end
  42.        
  43.         if moves > 0 then
  44.             if turn==right then
  45.                 turtle.turnRight()
  46.                 turtle.dig()
  47.                 while turtle.detect()==true do
  48.                     turtle.dig()
  49.                 end
  50.                 turtle.forward()
  51.                 turtle.turnRight()
  52.                 turn=left
  53.             else
  54.                 turtle.turnLeft()
  55.                 turtle.dig()
  56.                 while turtle.detect()==true do
  57.                     turtle.dig()
  58.                 end
  59.                 turtle.forward()
  60.                 turtle.turnLeft()
  61.                 turn=right
  62.             end
  63.         end
  64.        
  65.         if turtle.getItemCount(16) > 0 then
  66.             turtle.select(1)
  67.             turtle.digDown()
  68.             turtle.turnLeft()
  69.             turtle.turnLeft()
  70.             turtle.placeDown()
  71.             times=3
  72.             while times <= 16 do
  73.                 turtle.select(times)
  74.                 turtle.dropDown()
  75.                 times=times+1
  76.             end
  77.             turtle.turnRight()
  78.             turtle.turnRight()
  79.             turtle.select(2)
  80.         end
  81.     end
  82.    
  83.     if turn==left then
  84.         turtle.turnRight()
  85.         turtle.dig()
  86.         turtle.forward()
  87.         if placeTorches==true then
  88.             if hasTorches==true then
  89.                 if turtle.getItemCount(2)==1 then
  90.                     hasTorches=false
  91.                 end
  92.                 turtle.turnLeft()
  93.                 turtle.turnLeft()
  94.                 turtle.dig()
  95.                 turtle.place()
  96.                 turtle.turnRight()
  97.                 turtle.turnRight()
  98.             end
  99.         end
  100.         turtle.turnRight()
  101.         turtle.dig()
  102.         turtle.forward()
  103.         turtle.turnLeft()
  104.         turtle.digDown()
  105.         turtle.down()
  106.         turn=right
  107.     else
  108.         turtle.turnLeft()
  109.         turtle.dig()
  110.         turtle.forward()
  111.         if placeTorches==true then
  112.             if hasTorches==true then
  113.                 if turtle.getItemCount(2)==1 then
  114.                     hasTorches=false
  115.                 end
  116.                 turtle.turnLeft()
  117.                 turtle.turnLeft()
  118.                 turtle.dig()
  119.                 turtle.place()
  120.                 turtle.turnRight()
  121.                 turtle.turnRight()
  122.             end
  123.         end
  124.         turtle.turnLeft()
  125.         turtle.dig()
  126.         while turtle.detect()==true do
  127.             turtle.dig()
  128.         end
  129.         turtle.forward()
  130.         turtle.turnRight()
  131.         turtle.digDown()
  132.         turtle.down()
  133.         turn=left
  134.     end
  135.    
  136.     count=count-2
  137. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement