Advertisement
akaFrancis

Untitled

Aug 24th, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. --replaces block in direction
  2. function replaceBlock(slot, dir)
  3. turtle.select(slot)
  4. if dir == "up" then
  5. turtle.digUp()
  6. turtle.placeUp()
  7. elseif dir == "front" then
  8. turtle.dig()
  9. turtle.place()
  10. elseif dir == "down" then
  11. turtle.digDown()
  12. turtle.placeDown()
  13. end
  14. end
  15.  
  16. --places light in the middle
  17. function placeLight(lslot)
  18. turtle.digDown()
  19. turtle.select(lslot)
  20. turtle.placeDown()
  21. end
  22.  
  23. --places tracks
  24. function placeTrack(count, railslot)
  25. if count == 13 then
  26. turtle.select(16)
  27. turtle.place()
  28. turtle.turnLeft()
  29. turtle.turnLeft()
  30. turtle.select(railslot)
  31. turtle.place()
  32. turtle.turnRight()
  33. elseif count == 14 then
  34. turtle.select(15)
  35. turtle.place()
  36. turtle.turnLeft()
  37. turtle.turnLeft()
  38. turtle.place()
  39. turtle.turnRight()
  40. elseif count == 15 then
  41. turtle.select(railslot)
  42. turtle.place()
  43. turtle.turnLeft()
  44. turtle.turnLeft()
  45. turtle.select(16)
  46. turtle.place()
  47. turtle.turnRight()
  48. else
  49. turtle.select(railslot)
  50. turtle.place()
  51. turtle.turnLeft()
  52. turtle.turnLeft()
  53. turtle.place()
  54. turtle.turnRight()
  55. end
  56. end
  57.  
  58. --fuel check
  59. function checkFuel()
  60. if turtle.getFuelLevel() < 12 then
  61. turtle.refuel(1)
  62. end
  63. end
  64.  
  65. --creates 1 new slice of tunnel
  66. function newSlice(count, lcount, slot, railslot)
  67. turtle.turnRight()
  68. turtle.forward()
  69. if turtle.compareDown(slot) == false then
  70. replaceBlock(slot, "down")
  71. end
  72. if turtle.compare(slot) == false then
  73. replaceBlock(slot, "front")
  74. end
  75. turtle.up()
  76. if turtle.compare(slot) == false then
  77. replaceBlock(slot, "front")
  78. end
  79. if turtle.compareUp(slot) == false then
  80. replaceBlock(slot, "up")
  81. end
  82. turtle.turnLeft()
  83. turtle.turnLeft()
  84. turtle.forward()
  85. if turtle.compareUp(slot) == false then
  86. replaceBlock(slot, "up")
  87. end
  88. turtle.forward()
  89. if turtle.compareUp(slot) == false then
  90. replaceBlock(slot, "up")
  91. end
  92. if turtle.compare(slot) == false then
  93. replaceBlock(slot, "front")
  94. end
  95. turtle.down()
  96. if turtle.compare(slot) == false then
  97. replaceBlock(slot, "front")
  98. end
  99. if turtle.compareDown(slot) == false then
  100. replaceBlock(slot, "down")
  101. end
  102. turtle.turnRight()
  103. turtle.turnRight()
  104. turtle.forward()
  105.  
  106. if lcount == 8 then
  107. placeLight(14)
  108. else
  109. if turtle.compareDown(slot) == false then
  110. replaceBlock(slot, "down")
  111. end
  112. end
  113. placeTrack(count, railslot)
  114. turtle.forward()
  115. end
  116.  
  117.  
  118. loopCounter = 0
  119. count = 0
  120. lcount = 0
  121. ccount = 0
  122. slot = 1
  123. railslot = 10
  124. --turtle.refuel(1)
  125.  
  126. while loopCounter <= 96 do
  127. print(count)
  128. if turtle.getItemCount(slot) < 10 then
  129. if slot < 10 then
  130. slot = slot + 1
  131. else
  132. os.exit()
  133. end
  134. end
  135. if turtle.getItemCount(railslot) < 2 then
  136. if railslot < 13 then
  137. railslot = railslot + 1
  138. else
  139. os.exit()
  140. end
  141. end
  142. --[[
  143. if ccount == 4 then
  144. turtle.select(1)
  145. turtle.refuel(1)
  146. end
  147. ]]
  148. newSlice(count, lcount, slot, railslot)
  149.  
  150. lcount = lcount + 1
  151. count = count + 1
  152. ccount = ccount + 1
  153. if lcount > 8 then
  154. lcount = 0
  155. end
  156. if count > 15 then
  157. count = 0
  158. end
  159. --[[
  160. if ccount > 4 then
  161. ccount = 0
  162. end
  163. ]]
  164. loopCounter = loopCounter + 1
  165. end
  166. os.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement