mortimore

Mortimore's MineOs1.2

Jul 28th, 2014
3,515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.44 KB | None | 0 0
  1. -- Bitte stehle diesen Code nicht!
  2. -- Do not steal this scripts!
  3.  
  4. -- #####################
  5. -- #   MineOS - v1.2   #
  6. -- #    by Mortimore   #
  7. -- #####################
  8.  
  9. function Kiste(s)
  10.   for i=1,s do
  11.     turtle.select(i)
  12.     turtle.drop()
  13.   end
  14. end
  15.  
  16. function Dig()
  17.     turtle.select(1)
  18.     turtle.dig()
  19.     if  turtle.detect()==true then
  20.         while turtle.detect()==true do
  21.             turtle.dig()
  22.             db = db + 1
  23.             term.setCursorPos(1,6)
  24.             term.clearLine()
  25.             print("Bloecke abgebaut:" .. db)
  26.             sleep(0.5)
  27.         end
  28.     end
  29. end
  30.  
  31. function DigUp()
  32.     turtle.select(1)
  33.     turtle.digUp()
  34.     if turtle.detectUp()==true then
  35.         while turtle.detectUp()==true do
  36.             turtle.digUp()
  37.             term.setCursorPos(1,6)
  38.             term.clearLine()
  39.             print("Bloecke abgebaut:" .. db)
  40.             sleep(0.5)
  41.         end
  42.     end
  43. end
  44.  
  45. function Place()
  46.     for n=1,14 do
  47.         if turtle.getItemCount(n) > 0 then
  48.             turtle.select(n)
  49.             while turtle.detect()==false and turtle.getItemCount(n) > 0 do
  50.                 turtle.place()
  51.                 sleep(0.5)
  52.             end
  53.         end
  54.     end
  55. end
  56.  
  57. function PlaceUp()
  58.     for n=1,14 do
  59.         if turtle.getItemCount(n) > 0 then
  60.             turtle.select(n)
  61.             turtle.placeUp()
  62.         end
  63.     end
  64. end
  65.  
  66. function PlaceDown()
  67.     if turtle.detectDown()==false then
  68.         for n=1,14 do
  69.             if turtle.getItemCount(n) > 0 then
  70.                 turtle.select(n)
  71.                 tester = 0
  72.                 while turtle.detectDown()==false and turtle.getItemCount(n) > 0 and tester == 1 do
  73.                     if turtle.placeDown()==false then
  74.                         tester = 1
  75.                     end
  76.                     sleep(0.5)
  77.                 end
  78.             end
  79.         end
  80.     end
  81. end
  82.  
  83. function Vor()
  84.   while turtle.forward()==false do
  85.     Dig()
  86.     turtle.attack()
  87.   end
  88.   PlaceDown()
  89. end
  90.  
  91. function Turn()
  92.   turtle.turnLeft()
  93.   turtle.turnLeft()
  94. end
  95.  
  96. function Back()
  97.   if turtle.back()==false then
  98.     Turn()
  99.     Vor()
  100.     Turn()
  101.   end
  102. end
  103.  
  104. function Forward()
  105.   Dig()
  106.   Vor()
  107.   DigUp()
  108. end
  109.  
  110. function Fackel()
  111.     if turtle.getItemCount(15) > 0 then
  112.         fg = fg + 1
  113.         term.setCursorPos(1,7)
  114.         term.clearLine()
  115.         print("Fackeln gesetzt:" .. fg)
  116.         turtle.select(15)
  117.         turtle.placeUp()
  118.         sleep(0.5)
  119.         if turtle.detectUp()==false then
  120.             turtle.up()
  121.             turtle.turnLeft()
  122.             Place()
  123.             turtle.turnRight()
  124.             Place()
  125.             Dig()
  126.             turtle.turnRight()
  127.             Place()
  128.             turtle.turnRight()
  129.             Place()
  130.             Dig()
  131.             PlaceUp()
  132.             turtle.down()
  133.             turtle.select(16)
  134.             turtle.placeUp()
  135.             Turn()
  136.         end
  137.     elseif turtle.getItemCount(16) > 0 then
  138.         fg = fg + 1
  139.         term.setCursorPos(1,7)
  140.         term.clearLine()
  141.         print("Fackeln gesetzt:" .. fg)
  142.         turtle.select(16)
  143.         turtle.placeUp()
  144.         sleep(0.5)
  145.         if turtle.detectUp()==false then
  146.             turtle.up()
  147.             turtle.turnLeft()
  148.             Place()
  149.             turtle.turnRight()
  150.             Place()
  151.             Dig()
  152.             turtle.turnRight()
  153.             Place()
  154.             turtle.turnRight()
  155.             PlaceUp()
  156.             turtle.down()
  157.             turtle.select(16)
  158.             turtle.placeUp()
  159.             Turn()
  160.         end
  161.     end
  162. end
  163.  
  164. function Seitengang(l)
  165.     for i=1,l * 5 do
  166.         Forward()
  167.     end
  168.     Turn()
  169.     for i=1,l do
  170.         Fackel()
  171.         for j=1,5 do
  172.             Vor()
  173.         end
  174.     end
  175. end
  176.  
  177.  
  178. fg = 0
  179. f = 0
  180. db = 0
  181. ganganzahl = 0
  182. ganglaenge = 0
  183. c = 0
  184. a = 0
  185. b = 0
  186. kiste = 0
  187. j = 0
  188. et = 0
  189.  
  190. shell.run("clear")
  191. textutils.slowPrint("MineOs - v1.2")
  192. textutils.slowPrint("- von Mortimore -")
  193. sleep(1.5)
  194.  
  195. shell.run("clear")
  196. print("MineOS-1.2 - Gangoptionen           1/4")
  197. print("=======================================")
  198. write("Anzahl der Gaenge: ")
  199. ganganzahl = tonumber(read())
  200.  
  201. write("Laenge eines Gangs (x5): ")
  202. ganglaenge = tonumber(read())
  203. print("=======================================")
  204.  
  205. e = ""
  206. while e == "" or e == "r" do
  207.     shell.run("clear")
  208.     print("MineOS-1.2 - Kraftstoffverwaltung   2/4")
  209.     print("=======================================")
  210.     print("Kraftstoff: " .. turtle.getFuelLevel())
  211.     if (turtle.getFuelLevel() < 15 * ganglaenge * ganganzahl) then
  212.         print("!Kraftstoff-Level-Warnung!")
  213.     end
  214.     zs = 0
  215.     for i=1,16 do
  216.         zs = turtle.getItemCount(i) + zs
  217.     end
  218.     print("!Auffuellung um " .. zs .. " Einheiten!")
  219.     print("")
  220.     print("Druecke 'Enter' zum aktuallisieren!")
  221.     print("Schreibe 'r' zum auffuellen!")
  222.     print("Schreibe etwas anderes zum fortfahren!")
  223.     write("> ")
  224.     e = read()
  225.     if e == "r" then
  226.         for i=1,16 do
  227.             turtle.select(i)
  228.             turtle.refuel(64)
  229.         end
  230.     end
  231. end
  232.  
  233. e = ""
  234. while e == "" or e == "s" do
  235.     shell.run("clear")
  236.     print("MineOS-1.2 - Ausruestung            3/4")
  237.     print("=======================================")
  238.     print("EINE Truhe in Feld 14!")
  239.     print("Fackeln in Feld 15+16!")
  240.     print("=======================================")
  241.     f = turtle.getItemCount(15) + turtle.getItemCount(16)
  242.     print("Fackeln: " .. f)
  243.     write("Truhe: ")
  244.     if turtle.getItemCount(14) == 1 then
  245.         if et == 1 then
  246.             print("Endertruhe")
  247.         else
  248.             print("Ja")
  249.         end
  250.     else
  251.         print("Nein")
  252.     end
  253.     print("")
  254.     print("Druecke 'Enter' zum aktuallisieren!")
  255.     print("Schreibe 's' um die Truhe umzustellen!")
  256.     print("Schreibe etwas, um fortzufahren!")
  257.     write("> ")
  258.     e = read()
  259.     if e == "s" then
  260.         if et == 0 then
  261.             et = 1
  262.         elseif et == 1 then
  263.             et = 0
  264.         end
  265.     end
  266. end
  267.  
  268.  
  269. shell.run("clear")
  270. print("MineOS-1.2 - Uebersicht             4/4")
  271. print("=======================================")
  272. print("Ganglaenge: " .. ganglaenge * 5)
  273. print("Ganganzahl: " .. ganganzahl)
  274. vg = ganganzahl - a
  275. print("Verbleibende Gaenge: " .. vg)
  276.  
  277. if (turtle.getItemCount(14) == 1) then
  278.     if et == 0 then
  279.         turtle.turnLeft()
  280.         Dig()
  281.         Vor()
  282.         DigUp()
  283.         Back()
  284.         turtle.select(14)
  285.         turtle.place()
  286.         turtle.turnRight()
  287.     end
  288.     kiste = 1
  289. end
  290.  
  291. for j=0,ganganzahl - 1 do
  292.   a = a + 1
  293.   for k=1,3 do
  294.     Forward()
  295.     if kiste == 1 then
  296.       c = c + 1
  297.     end
  298.   end
  299.   turtle.turnLeft()
  300.   Seitengang(ganglaenge)
  301.   Seitengang(ganglaenge)
  302.   turtle.turnRight()
  303.   vg = ganganzahl - a
  304.   term.setCursorPos(1,5)
  305.   term.clearLine()
  306.   print("Verbleibende Gaenge: " .. vg)
  307.  
  308.   if a ~= ganganzahl then
  309.       if c == 6 and et == 0 then
  310.         for k=0,j * 3 + 2 do
  311.           Back()
  312.         end
  313.         turtle.turnLeft()
  314.         Kiste(14)
  315.         turtle.turnRight()
  316.         for k=0,j * 3 + 2 do
  317.           Vor()
  318.         end
  319.       c = 0
  320.       elseif c == 6 and et == 1 then
  321.         Dig()
  322.         turtle.select(14)
  323.         turtle.place()
  324.         Kiste(13)
  325.         turtle.select(14)
  326.         turtle.dig()
  327.       end
  328.   end
  329.  
  330.   if a == ganganzahl then
  331.     for k=0,a * 3 do
  332.       Back()
  333.     end
  334.     DigUp()
  335.     turtle.turnLeft()
  336.     Dig()
  337.     Vor()
  338.     DigUp()
  339.     Fackel()
  340.     turtle.turnRight()
  341.     if kiste == 1 then
  342.         if et == 0 then
  343.             Kiste(16)
  344.         elseif et == 1 then
  345.             Dig()
  346.             turtle.select(14)
  347.             turtle.place()
  348.             Kiste(16)
  349.             turtle.select(14)
  350.             turtle.dig()
  351.         end
  352.     end
  353.     turtle.turnRight()
  354.     print("")
  355.     print("!Fertig!")
  356.   end
  357. end
Advertisement
Add Comment
Please, Sign In to add comment