Advertisement
Guest User

main

a guest
Jan 22nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 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. --initial()
  73. for i=1,1 do
  74.   bridge()
  75. end
  76. torch()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement