Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.79 KB | None | 0 0
  1. function Vorne(soll)
  2.  
  3.   x = false
  4.   count = 0
  5.  
  6.   while count < soll do
  7.        
  8.        repeat
  9.        
  10.        turtle.dig()
  11.        x = turtle.forward()
  12.        
  13.        until x == true
  14.        
  15.        count = count + 1
  16.        
  17.    end
  18. end
  19.  
  20. function Oben(soll)
  21.  
  22.   x = false
  23.   count = 0
  24.  
  25.   while count < soll do
  26.        
  27.        repeat
  28.        
  29.        turtle.digUp()
  30.        x = turtle.up()
  31.        
  32.        until x == true
  33.        
  34.        count = count + 1
  35.        
  36.    end
  37. end
  38.  
  39. function Unten(soll)
  40.  
  41.   x = false
  42.   count = 0
  43.  
  44.   while count < soll do
  45.        
  46.        repeat
  47.        
  48.        turtle.digDown()
  49.        x = turtle.down()
  50.        
  51.        until x == true
  52.        
  53.        count = count + 1
  54.        
  55.    end
  56. end
  57.  
  58. function check()
  59.    
  60.     turtle.select(1)
  61.     if true ~= turtle.compareUp() then
  62.            
  63.         turtle.select(2)
  64.         if true ~= turtle.compareUp() then
  65.            
  66.             turtle.select(3)
  67.             if true ~= turtle.compareUp() then
  68.                
  69.                 turtle.digUp()
  70.                
  71.             end
  72.                
  73.         end        
  74.            
  75.     end
  76.  
  77.     turtle.select(1)
  78.     if true ~= turtle.compareDown() then
  79.            
  80.         turtle.select(2)
  81.         if true ~= turtle.compareDown() then
  82.            
  83.             turtle.select(3)
  84.             if true ~= turtle.compareDown() then
  85.                
  86.                 turtle.digDown()
  87.                
  88.             end
  89.                
  90.         end        
  91.            
  92.     end
  93.          
  94.     turtle.turnLeft()
  95.  
  96.     turtle.select(1)
  97.     if true ~= turtle.compare() then
  98.            
  99.         turtle.select(2)
  100.         if true ~= turtle.compare() then
  101.            
  102.             turtle.select(3)
  103.             if true ~= turtle.compare() then
  104.                
  105.                 turtle.dig()
  106.                
  107.             end
  108.  
  109.         end
  110.            
  111.     end
  112.          
  113.     turtle.turnRight()
  114.     turtle.turnRight()
  115.    
  116.     turtle.select(1)
  117.     if true ~= turtle.compare() then
  118.            
  119.         turtle.select(2)
  120.         if true ~= turtle.compare() then
  121.            
  122.             turtle.select(3)
  123.             if true ~= turtle.compare() then
  124.                
  125.                 turtle.dig()
  126.                
  127.             end
  128.                
  129.         end        
  130.            
  131.     end
  132.    
  133.     turtle.turnLeft()
  134.    
  135. end
  136.  
  137. function VorneMine(soll)
  138.    
  139.     x = false
  140.     count = 0
  141.  
  142.     while count < soll do
  143.        
  144.         repeat
  145.        
  146.             turtle.dig()
  147.             x = turtle.forward()
  148.        
  149.         until x == true
  150.        
  151.         check()
  152.        
  153.         count = count + 1
  154.        
  155.     end
  156.    
  157. end
  158.  
  159. function InvLeeren()
  160.    
  161.     slot = 5
  162.    
  163.     turtle.dig()
  164.                
  165.     turtle.select(4)
  166.    
  167.     turtle.place()
  168.      
  169.     repeat
  170.    
  171.         turtle.select(slot)
  172.        
  173.         turtle.drop()
  174.        
  175.         slot = slot + 1
  176.    
  177.     until slot > 16
  178.    
  179.     turtle.dig()
  180.    
  181. end
  182.  
  183. function refuel()
  184.    
  185.     slot = 1
  186.    
  187.     if 5000 > turtle.getFuelLevel() then
  188.        
  189.         repeat
  190.        
  191.             turtle.select(slot)
  192.            
  193.             turtle.refuel()
  194.            
  195.             slot = slot + 1
  196.        
  197.         until slot > 16
  198.     end
  199.        
  200. end
  201.  
  202. function getInPos(ziel)
  203.    
  204.     print("Auf welcher Hoehe ist die Turtle gerade?")
  205.     hoehe = read()
  206.    
  207.     Unten(hoehe - ziel)
  208.    
  209. end
  210.  
  211. function Left()
  212.  
  213.     turtle.turnLeft()
  214.    
  215.     refuel()
  216.     InvLeeren()
  217.    
  218.     VorneMine(5)
  219.    
  220.     turtle.turnLeft()
  221.  
  222. end
  223.  
  224. function Right()
  225.  
  226.     turtle.turnRight()
  227.    
  228.     refuel()
  229.     InvLeeren()    
  230.    
  231.     VorneMine(5)
  232.    
  233.     turtle.turnRight()
  234.  
  235. end
  236.  
  237.  
  238. function one()
  239.    
  240.     VorneMine(15)
  241.    
  242.     Right()
  243.    
  244.     VorneMine(15)
  245.    
  246.     Left()
  247.    
  248.     VorneMine(15)
  249.    
  250.     Right()
  251.    
  252.     VorneMine(15)
  253.    
  254.     Oben(1)
  255.    
  256.     turtle.turnRight()
  257.    
  258.     VorneMine(3)
  259.    
  260.     turtle.turnRight()
  261.  
  262. end
  263.  
  264. function two()
  265.    
  266.     VorneMine(15)
  267.    
  268.     Left()
  269.    
  270.     VorneMine(15)
  271.    
  272.     Right()
  273.    
  274.     VorneMine(15)
  275.    
  276.     Oben(1)
  277.    
  278.     turtle.turnRight()
  279.    
  280.     VorneMine(2)
  281.    
  282.     turtle.turnRight()
  283.  
  284. end
  285.  
  286. function three()
  287.    
  288.     VorneMine(15)
  289.    
  290.     Left()
  291.    
  292.     VorneMine(15)
  293.    
  294.     Right()
  295.    
  296.     VorneMine(15)
  297.    
  298.     Oben(1)
  299.    
  300.     turtle.turnRight()
  301.    
  302.     VorneMine(3)
  303.    
  304.     turtle.turnRight()
  305.    
  306. end
  307.  
  308. function four()
  309.    
  310.     VorneMine(15)
  311.    
  312.     Left()
  313.    
  314.     VorneMine(15)
  315.    
  316.     Right()
  317.    
  318.     VorneMine(15)
  319.    
  320.     Oben(1)
  321.    
  322.     turtle.turnRight()
  323.    
  324.     VorneMine(2)
  325.    
  326.     turtle.turnRight()
  327.    
  328. end
  329.  
  330. function five()
  331.    
  332.     VorneMine(15)
  333.    
  334.     Left()
  335.    
  336.     VorneMine(15)
  337.    
  338.     Right()
  339.    
  340.     VorneMine(15)
  341.    
  342.     Oben(1)
  343.    
  344.     turtle.turnRight()
  345.    
  346.     VorneMine(13)
  347.    
  348.     turtle.turnRight()
  349.    
  350. end
  351.  
  352.  
  353. function Mine()
  354.    
  355.     print("Auf welcher Hรถhe soll die Turtle anfangen zu minen?")
  356.     startHoehe = read()
  357.    
  358.     print("Bis zu welcher Hoehe soll die Turtle minen?")
  359.     zielHoehe = read()
  360.  
  361.     getInPos(zielHoehe)
  362.    
  363.     line = 1
  364.    
  365.     lineC = 1
  366.    
  367.     repeat
  368.        
  369.         if line == 6 then line = 1 end
  370.        
  371.         if line == 1 then
  372.            
  373.             one()
  374.            
  375.         elseif line == 2 then
  376.        
  377.             two()
  378.            
  379.         elseif line == 3 then
  380.        
  381.             three()
  382.            
  383.         elseif line == 4 then
  384.        
  385.             four()
  386.            
  387.         elseif line == 5 then
  388.        
  389.             five()
  390.            
  391.         end
  392.        
  393.         line = line + 1
  394.        
  395.         lineC = lineC + 1
  396.    
  397.     until lineC >= zielHoehe - zielHoehe
  398.  
  399. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement