Advertisement
Guest User

main

a guest
Jan 22nd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. local blockIdx = 1
  2. local slabIdx = 5
  3. local wallIdx = 9
  4. local torchIdx = 13
  5.  
  6. function selectOrDie(idx)
  7.   turtle.select(idx)
  8.   if turtle.getItemCount() <= 0 then
  9.     error("Out of items at idx: "..idx)
  10.   end
  11. end
  12.  
  13. function initial()
  14.   turtle.up()
  15.   selectOrDie(slabIdx)
  16.   turtle.placeDown()
  17.   turtle.turnRight()
  18.   turtle.forward()
  19.   turtle.turnLeft()
  20.   turtle.placeDown()
  21. end
  22.  
  23. function bridge()
  24.   turtle.forward()
  25.   selectOrDie(blockIdx)
  26.   turtle.placeDown()
  27.   turtle.turnRight()
  28.   turtle.forward()
  29.   selectOrDie(wallIdx)
  30.   turtle.placeDown()
  31.   turtle.up()
  32.   turtle.placeDown()
  33.   turtle.turnLeft()
  34.   turtle.turnLeft()
  35.   turtle.forward()
  36.   turtle.down()
  37.   turtle.forward()
  38.   selectOrDie(blockIdx)
  39.   turtle.placeDown()
  40.   turtle.forward()
  41.   selectOrDie(wallIdx)
  42.   turtle.placeDown()
  43.   turtle.up()
  44.   turtle.placeDown()
  45.   turtle.turnRight()
  46.   turtle.turnRight()
  47.   turtle.forward()
  48.   turtle.down()
  49.   turtle.forward()
  50.   turtle.turnLeft()
  51. end
  52.  
  53. function turnAround()
  54.   turtle.turnRight()
  55.   turtle.turnRight()
  56. end
  57.  
  58. function torch()
  59.   selectOrDie(torchIdx)
  60.   turtle.up()
  61.   turtle.turnRight()
  62.   turtle.place()
  63.   turnAround()
  64.   turtle.forward()
  65.   turtle.place()
  66.   turnAround()
  67.   turtle.forward()
  68.   turtle.turnLeft()
  69.   turtle.down()
  70. end
  71.  
  72. local len = 1
  73.  
  74. -- Entrance
  75. initial()
  76. bridge()
  77. torch()
  78.  
  79. for i=1,50 do
  80.   bridge()
  81.   if len % 15 == 0 then
  82.     torch()
  83.   end
  84.   len = len + 1
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement