Guest User

stripmining

a guest
Oct 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.26 KB | None | 0 0
  1. write("1. Slot: Cobblestone\n")
  2. write("2. Slot: Fackeln\n\n")
  3.  
  4. write("Laenge: ")
  5. l = io.read()
  6.  
  7. write("Breite: ")
  8. b = io.read()
  9.  
  10. write("Wiederholungen: ")
  11. w = io.read()
  12.  
  13. write("Rechts oder links: ")
  14. d = read()
  15.  
  16. local f = 0
  17. local fa = 11
  18. local z = 0
  19.  
  20. function vorne()
  21.   while not turtle.forward() do
  22.     turtle.dig()
  23.   end
  24.   turtle.digUp()
  25.   turtle.placeDown()
  26. end
  27.  
  28. function laenge()
  29.   for i=1,l do
  30.     vorne()
  31.     fackel()
  32.   end
  33. end
  34.  
  35. function breite()
  36.   for j=1,b do
  37.     vorne()
  38.     z = z+1
  39.     fackel()
  40.   end
  41. end
  42.  
  43. function drehen()
  44.   if d=="rechts" then
  45.     turtle.turnRight()
  46.     breite()
  47.     turtle.turnRight()
  48.     d = "links"
  49.   else
  50.     turtle.turnLeft()
  51.     breite()
  52.     turtle.turnLeft()
  53.     d = "rechts"
  54.   end
  55. end
  56.  
  57. function fackel()
  58.   if f>=fa then
  59.     turtle.turnRight()
  60.     turtle.turnRight()
  61.     turtle.select(2)
  62.     turtle.place()
  63.     turtle.select(1)
  64.     turtle.turnRight()
  65.     turtle.turnRight()
  66.     f = 0
  67.   else
  68.     f = f+1
  69.   end
  70. end
  71.  
  72. function voll()
  73.   if turtle.getItemCount(13)>0 then
  74.     while not turtle.up() do
  75.       turtle.digUp()
  76.     end
  77.     if d=="rechts" then
  78.       turtle.turnLeft()
  79.     else
  80.       turtle.turnRight()
  81.     end
  82.     for m=1,z do
  83.       while not turtle.forward() do
  84.         turtle.dig()
  85.       end
  86.     end
  87.     if d=="rechts" then
  88.       turtle.turnRight()
  89.     else
  90.       turtle.turnLeft()
  91.     end
  92.     while not turtle.down() do
  93.       turtle.digDown()
  94.     end
  95.     abladen()
  96.     while not turtle.up() do
  97.       turtle.digUp()
  98.     end
  99.     nachfuellen()
  100.     if d=="rechts" then
  101.       turtle.turnRight()
  102.     else
  103.       turtle.turnLeft()
  104.     end
  105.     for m=1,z do
  106.       while not turtle.forward() do
  107.         turtle.dig()
  108.       end
  109.     end
  110.     if d=="rechts" then
  111.       turtle.turnLeft()
  112.     else
  113.       turtle.turnRight()
  114.     end
  115.     while not turtle.down() do
  116.       turtle.digDown()
  117.     end
  118.   end
  119. end
  120.  
  121. function abladen()
  122.   turtle.drop(48)
  123.   for n=3,16 do
  124.     turtle.select(n)
  125.     turtle.drop()
  126.   end
  127.   turtle.select(1)
  128. end
  129.  
  130. function nachfuellen()
  131.   turtle.select(2)
  132.   turtle.drop()
  133.   turtle.suck()
  134.   turtle.suck()
  135.   turtle.select(3)
  136.   turtle.drop()
  137.   turtle.select(1)
  138. end
  139.  
  140. for k=1,w do
  141.   laenge()
  142.   drehen()
  143.   laenge()
  144.   voll()
  145.   drehen()
  146. end
Add Comment
Please, Sign In to add comment