Thor_s_Crafter

dragonTurtle2

May 9th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.21 KB | None | 0 0
  1. -- Automatische Drachenfarm - Draconic Evolution --
  2. -- Turtleprogramm von Thor_s_Crafter --
  3. -- Version 1.1--
  4.  
  5. t = turtle
  6.  
  7. local fuel = 0
  8. local anzahl = 0
  9.  
  10. -- å9CberåBCft, wieviel Fuel vorhanden ist
  11. function checkFuel()
  12.     while t.getFuelLevel() < 100 do
  13.         fuelInput()
  14.     end
  15. end
  16.  
  17. -- Fragt den Benutzer, Fuel nachzufuellen
  18. function fuelInput()
  19.     term.clear()
  20.     term.setCursorPos(1,1)
  21.     t.select(16)
  22.     print("Bitte Fuel nachfuellen!")
  23.     print("Fuel bitte in Slot 16 legen")
  24.     write("Enter druecken...")
  25.     local leer = read()
  26.     t.refuel()
  27.     fuel = t.getFuelLevel()
  28. end
  29.  
  30. -- Nimmt die Items aus den Kisten
  31. function takeItems()
  32.     t.turnLeft()
  33.     t.select(5)
  34.     t.suck(1)
  35.     t.turnLeft()
  36.     t.select(6)
  37.     t.suck(1)
  38.     t.turnLeft()
  39.     t.turnLeft()
  40. end
  41.  
  42. function takeCobble()
  43.     t.turnRight()
  44.     t.select(7)
  45.     t.suck()
  46.     t.turnLeft()
  47. end
  48.  
  49. -- Droppt alle Items in die Kiste
  50. function dropItems()
  51.     for i=1,16,1 do
  52.         t.select(i)
  53.         t.dropUp()
  54.     end
  55.     t.select(1)
  56. end
  57.  
  58. -- LåA4uft los
  59. function placeApiary()
  60.     for i=0,7,1 do
  61.         t.forward()
  62.     end
  63.     -- Ei mitnehmen
  64.     t.select(1)
  65.     t.dig()
  66.     -- Apiary platzieren
  67.     t.select(5)
  68.     t.place()
  69.     --Bienen rein tun
  70.     t.select(6)
  71.     t.drop()
  72.     for i=0,7,1 do
  73.         t.back()
  74.     end
  75. end
  76.  
  77.  
  78. function placeCobble()
  79.     for i=0,9,1 do
  80.         t.forward()
  81.     end
  82.     t.select(9)
  83.     t.dig()
  84.     t.down()
  85.     -- Fackel entfernen
  86.     t.select(2)
  87.     t.digDown()
  88.     t.down()
  89.     t.back()
  90.     t.turnRight()
  91.  
  92.     -- Cobblestone setzen
  93.     t.select(7)
  94.     t.placeDown()
  95.     t.forward()
  96.     t.placeDown()
  97.     t.forward()
  98.     t.turnLeft()
  99.  
  100.     for i=0,2,1 do
  101.         for i=0,3,1 do
  102.             t.placeDown()
  103.             t.forward()
  104.         end
  105.         t.placeDown()
  106.         t.turnLeft()
  107.     end
  108.  
  109.     t.forward()
  110.     t.placeDown()
  111.  
  112.     t.turnLeft()
  113.     t.forward()
  114.     t.turnRight()
  115.  
  116.     for i=0,3,1 do
  117.         for i=0,1,1 do
  118.             t.placeDown()
  119.             t.dig()
  120.             t.forward()
  121.         end
  122.         t.turnLeft()
  123.     end
  124.  
  125.     t.forward()
  126.     t.turnLeft()
  127.     t.up()
  128.     t.up()
  129.  
  130.     for i=0,9,1 do
  131.         t.back()
  132.     end
  133. end
  134.  
  135. --function ende()
  136. --  for i=0,7,1 do
  137. --      t.forward()
  138. --  end
  139. --  t.select(9)
  140. --  t.dig()
  141. --  for i=0,7,1 do
  142. --      t.back()
  143. --  end
  144. --end
  145.  
  146. -- Benutzereingabe
  147. function userInput()
  148.     --[[term.clear()
  149.     term.setCursorPos(1,1)
  150.     print("Dieses Programm laesst automatisch Enderdrachen spawnen und toeten.")
  151.     print("Es muss sich um eine Mining Turtle oder Advanced Mining Turtle handeln.")
  152.     print("Dazu ist folgendes Setup notwendig: ")
  153.     print("Es muessen 4 Kisten vorhanden sein.")
  154.     print("Links neben der Turtle muss eine Kiste mit Apiarys sein.")
  155.     print("Hinter der Turtle muss eine Kiste mit Phantasmal-Bienen (Queens) sein.")
  156.     print("Bitte Enter druecken...")
  157.     local leer = read()
  158.     term.clear()
  159.     term.setCursorPos(1,1)
  160.     print("Rechts muss eine Kiste mit einem beliebigen Baumaterial stehen.")
  161.     print("Ueber der Turtle muss eine leere Kiste sein.")
  162.     print("Dort droppt die Turtle alle Items nach einem Durchlauf rein.")
  163.     print("Die Items sollten von dort aus automatisch sortiert werden lassen.")
  164.     print("Enter druecken...")
  165.     leer = read()
  166.   ]]
  167.     term.clear()
  168.     term.setCursorPos(1,1)
  169.     print("Wie viele Runden sollen durchlaufen werden?")
  170.     write("Eingabe: ")
  171.     local input = read()
  172.     anzahl = tonumber(input)
  173. end
  174.  
  175. -- Installiert ein Startup (ggf.)
  176. function install()
  177.     print("-- Drachenfarm-Programm --")
  178.     print("-- von Thor_s_Crafter --")
  179.     print("-- Version 1.1 --")
  180.     print()
  181.     local input
  182.     if not fs.exists("startup") then
  183.         while not (input == "j" or input == "n") do
  184.             term.clear()
  185.             term.setCursorPos(1,1)
  186.             print("Soll das Programm beim Starten automatisch aufgerufen werden (Startup hinzufuegen) (j/n) ?")
  187.             write("Eingabe: ")         
  188.             input = read()
  189.             if input == "j" then
  190.                 local file = fs.open("startup","w")
  191.                 file.writeLine("shell.run(\"rm dragon\")")
  192.                 file.writeLine("shell.run(\"pastebin get wvNt9RfD dragon\")")
  193.                 file.writeLine("shell.run(\"dragon\")")
  194.                 file.close()
  195.             end
  196.         end
  197.     end
  198.    
  199. end
  200.  
  201. install()
  202. userInput()
  203. for i=1,anzahl,1 do
  204.     checkFuel()
  205.     --takeItems()
  206.     --placeApiary()
  207.     --dropItems()
  208.     --rs.setOutput("bottom",true)
  209.     sleep(40)
  210.     --rs.setOutput("bottom",false)
  211.     --while not rs.getInput("left") == true do
  212.         --sleep(1)
  213.     --end
  214.  takeCobble()
  215.     placeCobble()
  216.  dropItems()
  217. end
  218.  
  219. term.clear()
  220. term.setCursorPos(1,1)
  221. print("-- Fertig --")
  222. print("-- Programm beendet --")
Add Comment
Please, Sign In to add comment