Advertisement
Wihad

CC Destruction

May 31st, 2016 (edited)
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.46 KB | None | 0 0
  1. local R=0
  2. print("Turtle starts at Top/Right/Back Corner!")
  3. print("")
  4. print("Starting position, UP/DOWN? 0:No , ..,-2,-1,1,2,..")
  5. local strZ=read()+0
  6. print("Starting position, Forward? 0:No , 1,2,..")
  7. local strX=read()+0
  8. print("Length/Forward? (min. 1)")
  9. local Len=read()+0
  10. print("Width? (min. 1)")
  11. local Wid=read()+0
  12. print("Height/Depth? (min. 1)")
  13. local Dep=read()+0
  14. print("chose: 1 = back to start position")
  15. print("       0 = stay in End position")
  16. local PZ=read()+0
  17. local PX=0
  18. local PY=0
  19. if strZ>0 then
  20.     for a=1, strZ do
  21.         while turtle.detectUp() do
  22.             turtle.digUp()
  23.         end
  24.     turtle.up()
  25.     end
  26. elseif strZ<0 then
  27.     for a=-1, strZ,-1 do
  28.         while turtle.detectDown() do
  29.             turtle.digDown()
  30.         end
  31.         turtle.down()
  32.     end
  33. end
  34. if strX>0 then
  35.     for a=1,strX do
  36.         while turtle.detect() do
  37.             turtle.dig()
  38.         end
  39.         turtle.forward()
  40.     end
  41. end
  42.  
  43. for z=1,Dep do
  44.     for y=1,Wid do
  45.         for x=1,Len do
  46.             if x<Len then
  47.                 while turtle.detect() do
  48.                     turtle.dig()
  49.                 end
  50.                 turtle.forward()
  51.                 if turtle.getFuelLevel()<10 then
  52.                     for a=1,16 do
  53.                         turtle.select(a)
  54.                         turtle.refuel()
  55.                     end
  56.                 end
  57.             else
  58.                 if PX==0 then
  59.                     PX=1
  60.                 else
  61.                     PX=0
  62.                 end
  63.             end
  64.         end
  65.         if y<Wid then  
  66.             if R==0 then
  67.                 turtle.turnLeft()
  68.                 while turtle.detect() do
  69.                     turtle.dig()
  70.                 end  
  71.                 turtle.forward()
  72.                 turtle.turnLeft()
  73.                 R=1
  74.             else
  75.                 turtle.turnRight()
  76.                 while turtle.detect() do
  77.                     turtle.dig()
  78.                 end
  79.                 turtle.forward()
  80.                 turtle.turnRight()
  81.                 R=0
  82.             end
  83.         else
  84.             if PY==0 then
  85.                 PY=1
  86.             else
  87.                 PY=0  
  88.             end
  89.         end
  90.     end
  91.     if z<Dep then
  92.         if turtle.detectDown() then
  93.             turtle.digDown()
  94.         end
  95.         turtle.down()
  96.         turtle.turnLeft()
  97.         turtle.turnLeft()
  98.     end  
  99. end
  100. if PZ==1 then
  101.     for z=2,Dep do
  102.         turtle.up()
  103.     end
  104.     if PX==1 then
  105.         turtle.turnLeft()
  106.         turtle.turnLeft()
  107.         for x=2,Len do
  108.             turtle.forward()
  109.         end
  110.     end
  111.     if PY==1 then
  112.         turtle.turnLeft()
  113.         for y=2,Wid do
  114.             turtle.forward()
  115.         end
  116.         turtle.turnRight()
  117.     end
  118.     for x=1,strX do
  119.         turtle.forward()
  120.     end
  121.     if strZ>0 then
  122.         for z=1,strZ do
  123.             turtle.down()
  124.         end
  125.     elseif strZ<0 then
  126.         for z=-1,strZ,-1 do
  127.             turtle.up()
  128.         end
  129.     end
  130. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement