vipaholic

gang

Sep 25th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.68 KB | None | 0 0
  1. --                  ### FUNKTION LICHT ###
  2. function licht()
  3.     turtle.back()
  4.     turtle.select(16)
  5.     turtle.placeUp()
  6.     turtle.forward()
  7. end
  8. --                  ### FUNKTION GRAB ###
  9. function grab()
  10.  
  11.         while turtle.detect() do
  12.             turtle.dig()
  13.             os.sleep(0.5)
  14.         end
  15.  
  16.     turtle.forward()
  17.     lr()
  18.  
  19.         while turtle.detectUp() do
  20.             turtle.digUp()
  21.         end
  22.     turtle.up()
  23.     o()
  24.     lr()
  25. end
  26. --                  ### FUNKTION BOHR ###
  27. function bohr()
  28.  
  29.         while turtle.detect() do
  30.             turtle.dig()
  31.             os.sleep(0.5)
  32.         end
  33.  
  34.     turtle.forward()
  35.     lr()
  36.  
  37.         while turtle.detectUp() do
  38.             turtle.digUp()
  39.             os.sleep(0.5)
  40.         end
  41.  
  42.     turtle.up()
  43.     o()
  44.     lr()
  45.     turtle.down()
  46. end
  47. --                  ### TUNNEL-BREITE ###
  48. function breit()
  49.     turtle.turnLeft()
  50.     bohr()
  51.     bohr()
  52.     bohr()
  53.     turtle.back()
  54.     turtle.select(16)
  55.     turtle.placeUp()
  56.     turtle.forward()
  57.     turtle.turnRight()
  58. end
  59. --                  ### FUNCTION DIG ###
  60. function dig()
  61.     while turtle.detect() do
  62.         turtle.dig()
  63.         os.sleep(0.5)
  64.     end
  65. end
  66. --                  ### FUNCTION GLAS LINKS & RECHTS ###
  67. function lr()
  68.     turtle.turnLeft()
  69.         if not turtle.detect() then
  70.             turtle.select(14)
  71.             turtle.place()
  72.         end
  73.     turtle.turnRight()
  74.     turtle.turnRight()
  75.         if not turtle.detect() then
  76.             turtle.select(14)
  77.             turtle.place()
  78.         end
  79.     turtle.turnLeft()
  80. end
  81. --                  ### FUNCTION GLAS OBEN ###
  82. function o()
  83.     if not turtle.detectUp() then
  84.         turtle.select(15)
  85.         turtle.placeUp()
  86.     end
  87. end
  88. --                  ### FUNCTION GLAS VORNE ###
  89. function v()
  90.     if not turtle.detect() then
  91.         turtle.select(15)
  92.         turtle.place()
  93.     end
  94. end
  95. --                  ### FUNCTION GLAS UNTEN ###
  96. function u()
  97.     if not turtle.detectDown() then
  98.         turtle.select(13)
  99.         turtle.placeDown()
  100.     end
  101. end
  102. --                  ################
  103. --                  ### PROGRAMM ###
  104. --                  ################
  105. local x = 0
  106. local l = 0
  107. local a = 0
  108. local j = 0
  109. local k = 0
  110.  
  111. term.write("NICHT VERGESSEN: Fackeln in Slot 16 !")
  112. x = read()
  113. term.write("NICHT VERGESSEN: Glas in Slot 13,14,15 !")
  114. x = read()
  115. term.write("Wie lange soll der Gang werden ?")
  116. l = read()
  117. term.write("Wieviele Gaenge soll ich graben ?")
  118. a = read()
  119. -- function absolut()
  120. --                  ### EINGANG GRABEN ###
  121. turtle.up()
  122. dig()
  123. turtle.forward()
  124. v()
  125. o()
  126. lr()
  127. dig()
  128. turtle.forward()
  129. v()
  130. o()
  131. lr()
  132. turtle.digDown()
  133. turtle.down()
  134. lr()
  135. v()
  136. u()
  137. --                  ### GANG GRABEN ###
  138. for i = 1, l do
  139.     k = i - 1
  140.     j = k % 4
  141.         if j == 1 then
  142.             licht()
  143.         end
  144.     grab()
  145. end
  146.  
  147. turtle.select(16)
  148. turtle.placeUp()
  149.  
  150. -- ##########           ZURÜCK ZUM START
  151. turtle.turnLeft()
  152. turtle.turnLeft()
  153.     for i = 1, l do
  154.         turtle.forward()
  155.     end
  156. turtle.dig()
  157. turtle.forward()
  158. turtle.forward()
  159. turtle.turnLeft()
  160. turtle.turnLeft()
  161. turtle.select(1)
  162. turtle.place()
  163. -- ##########           AUSGANGSPOSITION
  164. breit()
  165. -- end
  166.  
  167. --  for i = 1, a do
  168. --      absolut()
  169. --  end
Advertisement
Add Comment
Please, Sign In to add comment