Whiskee

turtle - build tower

Dec 29th, 2020 (edited)
553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local curLevel = 0
  2. local backStep = 0
  3. local x = 0
  4. local turns = 0
  5.  
  6. local loop = true
  7.  
  8. function shouldPlaceBlock()
  9.     if (curLevel == 4) then
  10.         return true
  11.     elseif (backStep == 1) then
  12.         return true
  13.     end
  14. end
  15.  
  16. while (loop) do
  17.     if ( shouldPlaceBlock() ) then
  18.         turtle.place()
  19.     end
  20.  
  21.     turtle.back()
  22.     backStep = backStep + 1
  23.  
  24.     if ( shouldPlaceBlock() ) then
  25.         turtle.place()
  26.     end
  27.  
  28.     if (turns >= 3) then
  29.         turtle.up()
  30.         curLevel = curLevel + 1
  31.         turns = 0
  32.     end
  33.     if (curLevel > 4) then
  34.         curLevel = 0
  35.     end
  36.    
  37.     if (x == 0 and backStep == 15) then
  38.         x = 1
  39.         turtle.turnLeft()
  40.         backStep = 0
  41.         turns = turns + 1
  42.     elseif (x == 1 and backStep == 22) then
  43.         x = 0
  44.         turtle.turnLeft()
  45.         backStep = 0
  46.         turns = turns + 1
  47.     end
  48. end
Add Comment
Please, Sign In to add comment