Advertisement
mortimore

Mortimore's MineOs1.3

Aug 24th, 2014
21,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.71 KB | None | 0 0
  1. -- Bitte stehle diesen Code nicht !
  2. -- Do not steel this scripts !
  3.  
  4. -- #####################
  5. -- #   MineOS - v1.3   #
  6. -- #    by Mortimore   #
  7. -- #####################
  8.  
  9. version = "1.3"
  10.  
  11. -- Abkuerzungen --
  12. function p(...) print(...) end
  13. function w(...) write(...) end
  14. function sp(...) textutils.slowPrint(...) end
  15. function sw(...) textutils.slowWrite(...) end
  16. function scp(...) term.setCursorPos(...) end
  17. function stc(...) term.setTextColor(...) end
  18. function sbc(...) term.setBackgroundColor(...) end
  19. function s(...) sleep(...) end
  20. function ts(...) turtle.select(...) end
  21.  
  22. function wp(wpt,wppX,wppY,wptc,wpbc)
  23.     scp(wppX,wppY)
  24.     stc(wptc)
  25.     sbc(wpbc)
  26.     w(wpt)
  27.     -- wpt  = writePosText
  28.     -- wppX = writePosPositionX
  29.     -- wppY = writePosPositionY
  30.     -- wptc = writePosTextColor
  31.     -- wpbc = writePosBackgroundColor
  32. end
  33.  
  34. function pp(ppt,pppX,pppY,pptc,ppbc)
  35.     scp(pppX,pppY)
  36.     stc(pptc)
  37.     sbc(ppbc)
  38.     p(ppt)
  39.     -- ppt  = printPosText
  40.     -- pppX = printPosPositionX
  41.     -- pppY = printPosPositionY
  42.     -- pptc = printPosTextColor
  43.     -- ppbc = printPosBackgroundColor
  44. end
  45.  
  46. function screen(...)
  47.     sbc(...)
  48.     for o=1,19 do
  49.         for p=1,39 do
  50.             scp(p,o)
  51.             w(" ")
  52.         end
  53.     end
  54. end
  55.  
  56. function line()
  57.     sbc(colors.black)
  58.     stc(colors.white)
  59.     p("---------------------------------------")
  60. end
  61. ------------------
  62.  
  63. -- Funktionen --
  64. function Kiste(s)
  65.   for i=1,s do
  66.     ts(i)
  67.     turtle.drop()
  68.   end
  69. end
  70.  
  71. function Dig()
  72.     ts(1)
  73.     if turtle.dig()==true then
  74.         db = db + 1
  75.         scp(1,6)
  76.         term.clearLine()
  77.         p("Bloecke abgebaut:" .. db)
  78.     end
  79.     if  turtle.detect()==true then
  80.         while turtle.detect()==true do
  81.             turtle.dig()
  82.             db = db + 1
  83.             scp(1,6)
  84.             term.clearLine()
  85.             p("Bloecke abgebaut:" .. db)
  86.             s(0.5)
  87.         end
  88.     end
  89. end
  90.  
  91. function DigUp()
  92.     turtle.select(1)
  93.     if turtle.digUp()==true then
  94.         db = db + 1
  95.         term.setCursorPos(1,6)
  96.         term.clearLine()
  97.         print("Bloecke abgebaut:" .. db)
  98.     end
  99.     if turtle.detectUp()==true then
  100.         while turtle.detectUp()==true do
  101.             turtle.digUp()
  102.             term.setCursorPos(1,6)
  103.             term.clearLine()
  104.             print("Bloecke abgebaut:" .. db)
  105.             sleep(0.5)
  106.         end
  107.     end
  108. end
  109.  
  110. function Place()
  111.     if turtle.detect()==false then
  112.         for n=1,13 do
  113.             if turtle.getItemCount(n) > 0 then
  114.                 ts(n)
  115.                 tester = 0
  116.                 while turtle.detect()==false and turtle.getItemCount(n) > 0 and tester == 0 do
  117.                     if turtle.place()==false then
  118.                         tester = 1
  119.                     else
  120.                         bg = bg + 1
  121.                         scp(1,8)
  122.                         term.clearLine()
  123.                         p("Bloecke gesetzt:" .. bg)
  124.                     end
  125.                     s(0.5)
  126.                 end
  127.             end
  128.         end
  129.     end
  130. end
  131.  
  132. function PlaceUp()
  133.     for n=1,13 do
  134.         if turtle.getItemCount(n) > 0 then
  135.             ts(n)
  136.             turtle.placeUp()
  137.             bg = bg + 1
  138.             scp(1,8)
  139.             term.clearLine()
  140.             p("Bloecke gesetzt:" .. bg)
  141.         end
  142.     end
  143. end
  144.  
  145. function PlaceDown()
  146.     if turtle.detectDown()==false then
  147.         for n=1,13 do
  148.             if turtle.getItemCount(n) > 0 then
  149.                 ts(n)
  150.                 tester = 0
  151.                 while turtle.detectDown()==false and turtle.getItemCount(n) > 0 and tester == 0 do
  152.                     if turtle.placeDown()==false then
  153.                         tester = 1
  154.                     else
  155.                         bg = bg + 1
  156.                         scp(1,8)
  157.                         term.clearLine()
  158.                         p("Bloecke gesetzt:" .. bg)
  159.                     end
  160.                     s(0.5)
  161.                 end
  162.             end
  163.         end
  164.     end
  165. end
  166.  
  167. function Vor()
  168.   while turtle.forward()==false do
  169.     Dig()
  170.     turtle.attack()
  171.   end
  172.   PlaceDown()
  173. end
  174.  
  175. function Turn()
  176.   turtle.turnLeft()
  177.   turtle.turnLeft()
  178. end
  179.  
  180. function Back()
  181.   if turtle.back()==false then
  182.     Turn()
  183.     Vor()
  184.     Turn()
  185.   end
  186. end
  187.  
  188. function Up()
  189.     while turtle.up()==false do
  190.         turtle.digUp()
  191.         turtle.attackUp()
  192.     end
  193. end
  194.  
  195. function Down()
  196.     while turtle.down()==false do
  197.         turtle.attackDown()
  198.         turtle.digDown()
  199.     end
  200. end
  201.  
  202. function Forward()
  203.   Dig()
  204.   Vor()
  205.   DigUp()
  206. end
  207.  
  208. function Fackel()
  209.     if turtle.getItemCount(15) > 0 then
  210.         fg = fg + 1
  211.         scp(1,7)
  212.         term.clearLine()
  213.         p("Fackeln gesetzt:" .. fg)
  214.         ts(15)
  215.         turtle.placeUp()
  216.         s(0.5)
  217.         if turtle.detectUp()==false then
  218.             turtle.up()
  219.             turtle.turnLeft()
  220.             Place()
  221.             turtle.turnRight()
  222.             Place()
  223.             Dig()
  224.             turtle.turnRight()
  225.             Place()
  226.             if  a == ganganzahl then
  227.                 Dig()
  228.             end
  229.             turtle.turnRight()
  230.             Place()
  231.             Dig()
  232.             PlaceUp()
  233.             Down()
  234.             ts(15)
  235.             turtle.placeUp()
  236.             Turn()
  237.         end
  238.     elseif turtle.getItemCount(16) > 0 then
  239.         fg = fg + 1
  240.         scp(1,7)
  241.         term.clearLine()
  242.         p("Fackeln gesetzt:" .. fg)
  243.         ts(16)
  244.         turtle.placeUp()
  245.         s(0.5)
  246.         if turtle.detectUp()==false then
  247.             turtle.up()
  248.             turtle.turnLeft()
  249.             Place()
  250.             turtle.turnRight()
  251.             Place()
  252.             Dig()
  253.             turtle.turnRight()
  254.             Place()
  255.             if  a == ganganzahl then
  256.                 Dig()
  257.             end
  258.             turtle.turnRight()
  259.             Place()
  260.             Dig()
  261.             PlaceUp()
  262.             Down()
  263.             ts(16)
  264.             turtle.placeUp()
  265.             Turn()
  266.         end
  267.     end
  268. end
  269.  
  270. function Leiter()
  271.     if turtle.getItemCount(15) > 0 then
  272.         ts(15)
  273.         turtle.place()
  274.         if turtle.detect()==false then
  275.             Vor()
  276.             turtle.turnLeft()
  277.             Place()
  278.             turtle.turnRight()
  279.             Place()
  280.             turtle.turnRight()
  281.             Place()
  282.             while turtle.back==false do
  283.                 Turn()
  284.                 Dig()
  285.                 turtle.attack()
  286.                 Turn()
  287.             end
  288.             ts(15)
  289.             turtle.place()
  290.         end
  291.     elseif turtle.getItemCount(16) > 0 then
  292.         ts(16)
  293.         turtle.place()
  294.         if turtle.detect()==false then
  295.             Vor()
  296.             turtle.turnLeft()
  297.             Place()
  298.             turtle.turnRight()
  299.             Place()
  300.             turtle.turnRight()
  301.             Place()
  302.             while turtle.back==false do
  303.                 Turn()
  304.                 Dig()
  305.                 turtle.attack()
  306.                 Turn()
  307.             end
  308.             ts(16)
  309.             turtle.place()
  310.         end
  311.     end
  312. end
  313.  
  314. function Seitengang(l)
  315.     for i=1,l * 5 do
  316.         Forward()
  317.     end
  318.     Turn()
  319.     for i=1,l do
  320.         Fackel()
  321.         for j=1,5 do
  322.             Vor()
  323.         end
  324.     end
  325. end
  326. ---------------
  327.  
  328. -- Variablen --
  329. bg = 0
  330. fg = 0
  331. lg = 0
  332. f = 0
  333. db = 0
  334. ganganzahl = 0
  335. ganglaenge = 0
  336. c = 0
  337. a = 0
  338. b = 0
  339. kiste = 0
  340. j = 0
  341. et = 0
  342. m = 0
  343. ---------------
  344.  
  345. shell.run("clear")
  346. sp("MineOs - v" .. version)
  347. sp("- von Mortimore -")
  348. s(1.5)
  349.  
  350. -- Moduswahl --
  351. key = 0
  352. while key ~= 28 do
  353.     screen(colors.black)
  354.     shell.run("clear")
  355.     stc(colors.white)
  356.     sbc(colors.black)
  357.     p("MineOS-".. version .." - Moduswahl              1/?")
  358.     line()
  359.     if m == 0 then
  360.         wp(" Gang graben ",13,4,colors.black,colors.white)
  361.         wp(" Schacht graben ",12,6,colors.white,colors.black)
  362.     end
  363.     if m == 1 then
  364.         wp(" Gang graben ",13,4,colors.white,colors.black)
  365.         wp(" Schacht graben ",12,6,colors.black,colors.white)
  366.         wp(" Die GUI ist noch fehlerhaft! ",5,19,colors.black,colors.white)
  367.     end
  368.    
  369.     mode, key = os.pullEvent("key")
  370.     if mode == "key" then
  371.         if key == 200 and m == 1 then
  372.             m = 0
  373.         elseif key == 208 and m == 0 then
  374.             m = 1
  375.         end
  376.     end
  377. end
  378. stc(colors.white)
  379. sbc(colors.black)
  380. -------------------
  381.  
  382. -- Modus "Gang mit Seitengängen graben" --
  383.  
  384. if m == 0 then
  385. -- Gangoptionen alt --
  386.     shell.run("clear")
  387.     p("MineOS-1.3 - Gangoptionen           2/5")
  388.     line()
  389.     w("Anzahl der Gaenge: ")
  390.     ganganzahl = tonumber(read())
  391.  
  392.     w("Laenge eines Gangs (x5): ")
  393.     ganglaenge = tonumber(read())
  394.     line()
  395. -----------------------
  396.  
  397. -- Gangoptionen neu --
  398. -- key = 0
  399. -- taste = "+A"
  400. -- goa = 0
  401. -- gol = 0
  402. -- while key ~= 28 or taste ~= "weiter" do
  403.     -- screen(colors.black)
  404.     -- shell.run("clear")
  405.     -- stc(colors.white)
  406.     -- sbc(colors.black)
  407.     -- p("MineOS-".. version .." - Gangoptionen           2/5")
  408.     -- line()
  409.    
  410.     -- if taste == "-A" then
  411.         -- wp("   ",18,4,colors.black,colors.white)
  412.         -- wp("-",16,4,colors.black,colors.white)
  413.         -- wp(goa,18,4,colors.black,colors.white)
  414.         -- wp("+",22,4,colors.white,colors.black)
  415.         -- wp("-",16,6,colors.white,colors.black)
  416.         -- wp(gol,18,6,colors.white,colors.black)
  417.         -- wp("+",22,6,colors.white,colors.black)
  418.         -- wp("Weiter",18,8,colors.white,colors.black)
  419.     -- elseif taste == "+A" then
  420.         -- wp("   ",18,4,colors.black,colors.white)
  421.         -- wp("-",16,4,colors.white,colors.black)
  422.         -- wp(goa,18,4,colors.black,colors.white)
  423.         -- wp("+",22,4,colors.black,colors.white)
  424.         -- wp("-",16,6,colors.white,colors.black)
  425.         -- wp(gol,18,6,colors.white,colors.black)
  426.         -- wp("+",22,6,colors.white,colors.black)
  427.         -- wp("Weiter",18,8,colors.white,colors.black)
  428.     -- elseif taste == "-L" then
  429.         -- wp("   ",18,6,colors.black,colors.white)
  430.         -- wp("-",16,4,colors.white,colors.black)
  431.         -- wp(goa,18,4,colors.white,colors.black)
  432.         -- wp("+",22,4,colors.white,colors.black)
  433.         -- wp("-",16,6,colors.black,colors.white)
  434.         -- wp(gol,18,6,colors.black,colors.white)
  435.         -- wp("+",22,6,colors.white,colors.black)
  436.         -- wp("Weiter",18,8,colors.white,colors.black)
  437.     -- elseif taste == "+L" then
  438.         -- wp("   ",18,6,colors.black,colors.white)
  439.         -- wp("-",16,4,colors.white,colors.black)
  440.         -- wp(goa,18,4,colors.white,colors.black)
  441.         -- wp("+",22,4,colors.white,colors.black)
  442.         -- wp("-",16,6,colors.white,colors.black)
  443.         -- wp(gol,18,6,colors.black,colors.white)
  444.         -- wp("+",22,6,colors.black,colors.white)
  445.         -- wp("Weiter",18,8,colors.white,colors.black)
  446.     -- elseif taste == "weiter" then
  447.         -- wp("-",16,4,colors.white,colors.black)
  448.         -- wp(goa,18,4,colors.white,colors.black)
  449.         -- wp("+",22,4,colors.white,colors.black)
  450.         -- wp("-",16,6,colors.white,colors.black)
  451.         -- wp(gol,18,6,colors.white,colors.black)
  452.         -- wp("+",22,6,colors.white,colors.black)
  453.         -- wp("Weiter",18,8,colors.black,colors.white)
  454.     -- end
  455.    
  456.     -- wp(" Die Ganglaenge zaehlt 5-fach !! ",3,19,colors.black,colors.white)
  457.    
  458.     -- mode, key = os.pullEvent("key")
  459.     -- if mode == "key" then
  460.         -- if taste == "-A" then
  461.             -- if key == 208 then
  462.                 -- taste = "-L"
  463.             -- elseif key == 205 then
  464.                 -- taste = "+A"
  465.             -- end
  466.         -- elseif taste == "+A" then
  467.             -- if key == 203 then
  468.                 -- taste = "-A"
  469.             -- elseif key == 208 then
  470.                 -- taste = "+L"
  471.             -- end
  472.         -- elseif taste == "-L" then
  473.             -- if key == 200 then
  474.                 -- taste = "-A"
  475.             -- elseif key == 205 then
  476.                 -- taste = "+L"
  477.             -- elseif key == 208 then
  478.                 -- taste = "weiter"
  479.             -- end
  480.         -- elseif taste == "+L" then
  481.             -- if key == 200 then
  482.                 -- taste = "+A"
  483.             -- elseif key == 203 then
  484.                 -- taste = "-L"
  485.             -- elseif key == 208 then
  486.                 -- taste = "weiter"
  487.             -- end
  488.         -- elseif taste == "weiter" then
  489.             -- if taste == 200 then
  490.                 -- taste = "-L"
  491.             -- end
  492.         -- elseif key == 28 then
  493.             -- if taste == "-A" and goa > 0 then
  494.                 -- goa = goa - 1
  495.             -- elseif taste == "+A" and goa < 999 then
  496.                 -- goa = goa + 1
  497.             -- elseif taste == "-L" and gol > 4 then
  498.                 -- gol = gol - 5
  499.             -- elseif taste == "+L" and gol < 246 then
  500.                 -- gol = gol + 5
  501.             -- end
  502.         -- end
  503.     -- end
  504. -- end
  505. -- ganganzahl = goa + 0
  506. -- ganglaenge = gol / 5
  507.  
  508. -- stc(colors.white)
  509. -- sbc(colors.black)
  510. ----------------------
  511.  
  512.     e = ""
  513.     while e == "" or e == "r" do
  514.         shell.run("clear")
  515.         p("MineOS-1.3 - Kraftstoffverwaltung   3/5")
  516.         line()
  517.         p("Kraftstoff: " .. turtle.getFuelLevel())
  518.         if (turtle.getFuelLevel() < 15 * ganglaenge * ganganzahl) then
  519.             p("!Kraftstoff-Level-Warnung!")
  520.         end
  521.         zs = 0
  522.         for i=1,16 do
  523.             zs = turtle.getItemCount(i) + zs
  524.         end
  525.         p("!Auffuellung um " .. zs .. " Einheiten!")
  526.         p("")
  527.         p("Druecke 'Enter' zum aktuallisieren!")
  528.         p("Schreibe 'r' zum auffuellen!")
  529.         p("Schreibe etwas anderes zum fortfahren!")
  530.         w("> ")
  531.         e = read()
  532.         if e == "r" then
  533.             for i=1,16 do
  534.                 ts(i)
  535.                 turtle.refuel(64)
  536.             end
  537.         end
  538.     end
  539.  
  540.     e = ""
  541.     while e == "" or e == "s" do
  542.         shell.run("clear")
  543.         p("MineOS-1.3 - Ausruestung            4/5")
  544.         line()
  545.         p("EINE Truhe in Feld 14!")
  546.         p("Fackeln in Feld 15+16!")
  547.         line()
  548.         f = turtle.getItemCount(15) + turtle.getItemCount(16)
  549.         p("Fackeln: " .. f)
  550.         w("Truhe: ")
  551.         if turtle.getItemCount(14) == 1 then
  552.             if et == 1 then
  553.                 p("Endertruhe")
  554.             else
  555.                 p("Ja")
  556.             end
  557.         else
  558.             p("Nein")
  559.         end
  560.         p("")
  561.         p("Druecke 'Enter' zum aktuallisieren!")
  562.         p("Schreibe 's' um die Truhe umzustellen!")
  563.         p("Schreibe etwas, um fortzufahren!")
  564.         w("> ")
  565.         e = read()
  566.         if e == "s" then
  567.             if et == 0 then
  568.                 et = 1
  569.             elseif et == 1 then
  570.                 et = 0
  571.             end
  572.         end
  573.     end
  574.  
  575.  
  576.     shell.run("clear")
  577.     p("MineOS-1.3 - Uebersicht             5/5")
  578.     line()
  579.     p("Ganglaenge: " .. ganglaenge * 5)
  580.     p("Ganganzahl: " .. ganganzahl)
  581.     vg = ganganzahl - a
  582.     p("Verbleibende Gaenge: " .. vg)
  583.  
  584.     if (turtle.getItemCount(14) == 1) then
  585.         if et == 0 then
  586.             turtle.turnLeft()
  587.             Dig()
  588.             Vor()
  589.             DigUp()
  590.             Back()
  591.             turtle.select(14)
  592.             turtle.place()
  593.             turtle.turnRight()
  594.         end
  595.         kiste = 1
  596.     end
  597.  
  598.     for j=0,ganganzahl - 1 do
  599.       a = a + 1
  600.       for k=1,3 do
  601.         Forward()
  602.         if kiste == 1 then
  603.           c = c + 1
  604.         end
  605.       end
  606.       turtle.turnLeft()
  607.       Seitengang(ganglaenge)
  608.       Seitengang(ganglaenge)
  609.       turtle.turnRight()
  610.       vg = ganganzahl - a
  611.       term.setCursorPos(1,5)
  612.       term.clearLine()
  613.       print("Verbleibende Gaenge: " .. vg)
  614.      
  615.       if turtle.getFuelLevel() < a * 3 + 10 * ganglaenge + 100 then
  616.         for k=0,j * 3 + 3 do
  617.             Back()
  618.         end
  619.         turtle.turnLeft()
  620.         Dig()
  621.         Vor()
  622.         DigUp()
  623.         Turn()
  624.         while turtle.getFuelLevel() < (ganganzahl - a) * (10 * ganglaenge + 30) do
  625.             e = ""
  626.             while e == "" or e == "r" do
  627.                 shell.run("clear")
  628.                 print("MineOS-" .. version .. " - !Kraftstoffwarnung!      !")
  629.                 line()
  630.                 print("Kraftstoff: " .. turtle.getFuelLevel())
  631.                 zs = 0
  632.                 for i=1,16 do
  633.                     zs = turtle.getItemCount(i) + zs
  634.                 end
  635.                 print("!Auffuellung um " .. zs .. " Einheiten!")
  636.                 print("")
  637.                 print("Druecke 'Enter' zum aktuallisieren!")
  638.                 print("Schreibe 'r' zum auffuellen!")
  639.                 print("Schreibe etwas anderes zum fortfahren!")
  640.                 write("> ")
  641.                 e = read()
  642.                 if e == "r" then
  643.                     for i=1,16 do
  644.                         turtle.select(i)
  645.                         turtle.refuel(64)
  646.                     end
  647.                 end
  648.             end
  649.         end
  650.        
  651.         shell.run("clear")
  652.         print("MineOS-" .. version .. " - Uebersicht             5/5")
  653.         line()
  654.         print("Ganglaenge: " .. ganglaenge * 5)
  655.         print("Ganganzahl: " .. ganganzahl)
  656.         vg = ganganzahl - a
  657.         print("Verbleibende Gaenge: " .. vg)
  658.        
  659.         Vor()
  660.         turtle.turnLeft()
  661.         for k=0,j * 3 + 3 do
  662.             Vor()
  663.         end
  664.       end
  665.      
  666.       if a ~= ganganzahl then
  667.           if c == 6 and et == 0 then
  668.             for k=0,j * 3 + 2 do
  669.               Back()
  670.             end
  671.             turtle.turnLeft()
  672.             Kiste(14)
  673.             turtle.turnRight()
  674.             for k=0,j * 3 + 2 do
  675.               Vor()
  676.             end
  677.           c = 0
  678.           elseif c == 6 and et == 1 then
  679.             Dig()
  680.             turtle.select(14)
  681.             turtle.place()
  682.             Kiste(13)
  683.             turtle.select(14)
  684.             turtle.dig()
  685.           end
  686.       end
  687.      
  688.       if a == ganganzahl then
  689.         for k=0,a * 3 do
  690.           Back()
  691.         end
  692.         DigUp()
  693.         turtle.turnLeft()
  694.         Dig()
  695.         Vor()
  696.         DigUp()
  697.         Fackel()
  698.         turtle.turnRight()
  699.         if kiste == 1 then
  700.             if et == 0 then
  701.                 Kiste(16)
  702.             elseif et == 1 then
  703.                 Dig()
  704.                 turtle.select(14)
  705.                 turtle.place()
  706.                 Kiste(16)
  707.                 turtle.select(14)
  708.                 turtle.dig()
  709.             end
  710.         end
  711.         turtle.turnRight()
  712.         print("")
  713.         print("!Fertig!")
  714.       end
  715.     end
  716. end
  717.  
  718. -- Modus Gang mit Seitengängen graben: ENDE --
  719.  
  720. -- Modus Schacht graben --
  721.  
  722. if m == 1 then
  723.     shell.run("clear")
  724.     print("MineOS-" .. version .. " - Schachtoptionen        2/4")
  725.     line()
  726.     write("Laenge des Schachts: ")
  727.     schachtlaenge = tonumber(read())
  728.  
  729.     write("Tiefe des Schachts: ")
  730.     schachttiefe = tonumber(read())
  731.     line()
  732.    
  733.     e = ""
  734.     while e == "" or e == "r" do
  735.         shell.run("clear")
  736.         print("MineOS-" .. version .. " - Kraftstoffverwaltung   3/4")
  737.         line()
  738.         print("Kraftstoff: " .. turtle.getFuelLevel())
  739.         if (turtle.getFuelLevel() < (schachtlaenge * schachtlaenge * schachttiefe) + 50) then
  740.             print("!Kraftstoff-Level-Warnung!")
  741.         end
  742.         zs = 0
  743.         for i=1,16 do
  744.             zs = turtle.getItemCount(i) + zs
  745.         end
  746.         print("!Auffuellung um " .. zs .. " Einheiten!")
  747.         print("")
  748.         print("Druecke 'Enter' zum aktuallisieren!")
  749.         print("Schreibe 'r' zum auffuellen!")
  750.         print("Schreibe etwas anderes zum fortfahren!")
  751.         write("> ")
  752.         e = read()
  753.         if e == "r" then
  754.             for i=1,16 do
  755.                 turtle.select(i)
  756.                 turtle.refuel(64)
  757.             end
  758.         end
  759.     end
  760.    
  761.     e = ""
  762.     while e == "" do
  763.         shell.run("clear")
  764.         print("MineOS-" .. version .. " - Ausruestung            4/4")
  765.         line()
  766.         print("EINE Truhe in Feld 14!")
  767.         print("Leitern in Feld 15+16!")
  768.         line()
  769.         f = turtle.getItemCount(15) + turtle.getItemCount(16)
  770.         print("Leitern: " .. f)
  771.         write("Truhe: ")
  772.         if turtle.getItemCount(14) == 1 then
  773.             print("Ja")
  774.         else
  775.             print("Nein")
  776.         end
  777.         print("")
  778.         print("Druecke 'Enter' zum aktuallisieren!")
  779.         print("Schreibe etwas, um fortzufahren!")
  780.         write("> ")
  781.         e = read()
  782.     end
  783.    
  784.     shell.run("clear")
  785.    
  786.     if (turtle.getItemCount(14) == 1) then
  787.         if et == 0 then
  788.             turtle.turnLeft()
  789.             Dig()
  790.             Vor()
  791.             DigUp()
  792.             Back()
  793.             turtle.select(14)
  794.             turtle.place()
  795.             turtle.turnRight()
  796.         end
  797.         kiste = 1
  798.     end
  799.    
  800.     for i=0,schachttiefe - 1 do
  801.         turtle.digDown()
  802.         Down()
  803.         c = c + 1
  804.         sr = "rechts"
  805.         for j=0,schachtlaenge - 1 do
  806.             for k=0,(schachtlaenge) - 2 do
  807.                 Vor()
  808.             end
  809.             if j ~= schachtlaenge - 1 then
  810.                 if sr == "rechts" then
  811.                     turtle.turnRight()
  812.                     Vor()
  813.                     turtle.turnRight()
  814.                     sr = "links"
  815.                 elseif sr == "links" then
  816.                     turtle.turnLeft()
  817.                     Vor()
  818.                     turtle.turnLeft()
  819.                     sr = "rechts"
  820.                 end
  821.             end
  822.         end
  823.         if sr == "rechts" then
  824.             turtle.turnLeft()
  825.             for k=0,schachtlaenge - 2 do
  826.                 Vor()
  827.             end
  828.             turtle.turnLeft()
  829.             for k=0,schachtlaenge - 2 do
  830.                 Vor()
  831.             end
  832.             if c == 2 then
  833.                 turtle.turnRight()
  834.             elseif i == schachttiefe then
  835.             else
  836.                 Turn()
  837.             end
  838.         elseif sr == "links" then
  839.             turtle.turnRight()
  840.             for k=0,schachtlaenge - 2 do
  841.                 Vor()
  842.             end
  843.             if c ~= 2 then
  844.                 turtle.turnRight()
  845.             elseif i == schachttiefe then
  846.                 turtle.turnLeft()
  847.             end
  848.         end
  849.        
  850.         if kiste == 1 and c == 2 and i ~= schachttiefe then
  851.             if et == 0 then
  852.                 for j = 0,i do
  853.                     Up()
  854.                 end
  855.                 Kiste(14)
  856.                 turtle.turnRight()
  857.                 for j = 0,i do
  858.                     Down()
  859.                 end
  860.             end
  861.             c = 0
  862.         end
  863.     end
  864.     Turn()
  865.     for i=0,schachttiefe - 1 do
  866.         Dig()
  867.         Leiter()
  868.         Up()
  869.     end
  870.     Vor()
  871.     turtle.turnRight()
  872.     Vor()
  873.     if kiste == 1 then
  874.         turtle.turnRight()
  875.         Kiste(16)
  876.         turtle.turnRight()
  877.     else
  878.         Turn()
  879.     end
  880.    
  881.     print("")
  882.     print("Fertig!")
  883. end
  884.  
  885. -- Modus Schacht graben: ENDE --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement