SHARE
TWEET

Stripmine 2.0

DerMarten Apr 14th, 2019 (edited) 18 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Erstellt von DerMarten Web: http://pastebin.com/u/DerMarten
  2. -- Tutrtle Api: http://computercraft.info/wiki/Turtle_(API)
  3. -- Variablen
  4. local lange = 0
  5. -- Funktionen
  6. function dig()
  7.    if turtle.detect() == true then
  8.        turtle.dig()
  9.        os.sleep(0.5)
  10.    end
  11. end
  12. function digUp()
  13.    if turtle.detectUp() == true then
  14.        turtle.digUp()
  15.        os.sleep(0.5)
  16.    end
  17. end
  18. function digDown()
  19.    if turtle.detectDown() == true then
  20.        turtle.digDown()
  21.        os.sleep(0.5)
  22.    end
  23. end
  24. function forward()
  25.  
  26.     while turtle.detect() == true do
  27.       dig()  
  28.     end
  29.       turtle.forward()
  30. end
  31. function goUp()
  32.     while turtle.detectUp() == true do
  33.       digUp()  
  34.     end
  35.     turtle.up()
  36. end
  37. function fuelleel()
  38. shell.run("clear")
  39. write("Fuellevel: ");
  40. turtle.getFuelLevel()
  41. print("");
  42. end
  43. function rednet()
  44. end
  45. function mainstrip()
  46.   dig()
  47.   forward()
  48.   digUp()
  49.   digDown()
  50.   dig()
  51.   forward()
  52.   digUp()
  53.   digDown()
  54.   dig()
  55.   forward()
  56.   digUp()
  57.   digDown()
  58. end
  59. function sidestrip()
  60.     turtle.turnRight()
  61.     -- Rechten Gang graben
  62.     dig()
  63.     forward()--1
  64.     digUp()
  65.     digDown()
  66.     dig()
  67.     forward()--2
  68.     digUp()
  69.     digDown()
  70.     dig()
  71.     forward()--3
  72.     digUp()
  73.     digDown()
  74.     dig()
  75.     forward()--4
  76.     digUp()
  77.     digDown()
  78.     dig()
  79.     forward()--5
  80.     digUp()
  81.     digDown()
  82.     dig()
  83.     forward()--6
  84.     digUp()
  85.     digDown()
  86.     -- Zurueck zum Hauptgang
  87.     turtle.turnRight()
  88.     turtle.turnRight()
  89.     forward()--1
  90.     forward()--2
  91.     turtle.select(16)
  92.     turtle.placeUp()
  93.     turtle.select(1)
  94.     forward()--3
  95.     forward()--4
  96.     forward()--5
  97.     forward()--6
  98.     forward()--7
  99.     -- Linken Gang graben
  100.     digUp()
  101.     digDown()
  102.     dig()
  103.     forward()--1
  104.     digUp()
  105.     digDown()
  106.     --
  107.     dig()
  108.     forward()--2
  109.     digUp()
  110.     digDown()
  111.     --
  112.     dig()
  113.     forward()--3
  114.     digUp()
  115.     digDown()
  116.     --
  117.     dig()
  118.     forward()--4
  119.     digUp()
  120.     digDown()
  121.     --
  122.     dig()
  123.     forward()--5
  124.     digUp()
  125.     digDown()
  126.     -- Zurueck zum Hauptgang
  127.     turtle.turnRight()
  128.     turtle.turnRight()
  129.     forward()--1
  130.     forward()--2
  131.     turtle.select(16)
  132.     turtle.placeUp()
  133.     turtle.select(1)   
  134.     forward()--3
  135.     forward()--4
  136.     forward()--5
  137.     digUp()
  138.     digDown()
  139.     forward()--6
  140.     -- Wider Richtig Stehen
  141.     turtle.turnLeft()
  142. end
  143. function sendmessage()
  144.     rednet.open("right")
  145.     rednet.send(serverid,finishmessage,true)
  146.     rednet.close("right")
  147. end
  148. function setz_kiste()
  149.     digDown()
  150.     turtle.select(15)
  151.     turtle.placeDown()
  152.     turtle.select(1)
  153. end
  154. function in_kiste()
  155.     zahl = 14
  156.     zahl2 = 1
  157.     for i = 1, zahl, 1 do
  158.        turtle.select(zahl2)
  159.        turtle.dropDown()
  160.     end
  161.     turtle.select(1)
  162. end
  163. function fakel()
  164.     turtle.select(16)
  165.     turtle.back()
  166.     turtle.placeUp()
  167.     forward()
  168.     turtle.select(1)
  169. end
  170. function endpos()
  171.    turtle.turnLeft()
  172.    turtle.turnLeft()
  173.    local lange2 = lange * 3
  174.    for i = 1, lange2, 1 do
  175.     forward();
  176.    end
  177.    turtle.turnLeft()
  178.    turtle.turnLeft()
  179.    goUp()
  180.    goUp()
  181. end
  182. function input()
  183.     shell.run("clear")
  184.     --print("Kisten in Slot 15 legen")
  185.     print("Fakeln in Slot 16 legen")
  186.     print("Wie Lang soll der Gang sein ?")
  187.     print("Info: Eine Einheit sind drei Bloecke im Hauptgang und auf beiden Seiten ein Nebengang")
  188.     write("Einheiten: ")
  189.     lange = io.read()
  190. end
  191. function main()
  192.    input()
  193.    for i = 1, lange, 1 do
  194.       shell.run("clear")
  195.       write("Der Turtle ist bei der ")
  196.       write(i)
  197.       print(" Einheit")
  198.       mainstrip()
  199.       fakel()
  200.       sidestrip()
  201.      -- setz_kiste()
  202.      -- in_kiste()
  203.    end
  204.    endpos()
  205. end
  206. main()
  207. --sendmessage()
  208. shell.run("clear")
  209. print("Der Turtle ist Fertig mit dem Stripmine Gang")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top