Advertisement
Alex21039

Glowstonesetzer

Sep 15th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.78 KB | None | 0 0
  1. -------- Untere Linke Ecke des Raumes ist der Start --------
  2. -------- Wie soll der Raum aussehen --------
  3. digX=10  --Nach vorne
  4. digY=10  --Nach Rechts
  5.  
  6. ReplaceUp=0
  7. ReplaceDown=0
  8.  
  9.  
  10. RefuelOnStartUp=1
  11.  
  12. print("Version 0.5 (15.09.2019)")
  13.  
  14. -------- Ab hier Finger weg --------
  15. -------- PROGRAMM START --------
  16.  
  17. function checkReplace(posX,posY,posZ)
  18.     if posX  == digX then
  19.         if ReplaceFront==1 then
  20.             API.replace()
  21.         end
  22.     end
  23.  
  24.     if posX == 0 then
  25.         if ReplaceBack==1 then
  26.             API.replaceBack()
  27.         end
  28.     end
  29.  
  30.     if posY == 0 then
  31.         if ReplaceLeft==1 then
  32.             API.replaceLeft()
  33.         end
  34.     end
  35.  
  36.     if posY == digY-1 then
  37.         if ReplaceRight==1 then
  38.             API.replaceRight()
  39.         end
  40.     end
  41.  
  42.     if posZ == 0 then
  43.         if ReplaceDown==1 then
  44.             API.replaceDown()
  45.         end
  46.     end
  47.  
  48.     if posZ == digZ-1 then
  49.         if ReplaceUp==1 then
  50.             API.replaceUp()
  51.         end
  52.     end
  53. end
  54.  
  55.  
  56. -------- PROGRAMM START --------
  57. os.loadAPI("API")
  58. API.Version()
  59.  
  60. ReplaceLeft=0
  61. ReplaceRight=0
  62. ReplaceFront=0
  63. ReplaceBack=0
  64. digZ = 1
  65.  
  66.  
  67. print("Raum der Laenge")
  68. print(digX)
  69. print("Raum der Breite")
  70. print(digY)
  71. print("Raum der Hoehe")
  72. print(digZ)
  73.  
  74. print("Replace:")
  75. if ReplaceFront==1 then
  76.     print("Vorn")
  77. end
  78. if ReplaceBack==1 then
  79.     print("Hinten")
  80. end
  81. if ReplaceLeft==1 then
  82.     print("Links")
  83. end
  84. if ReplaceRight==1 then
  85.     print("Rechts")
  86. end
  87. if ReplaceDown==1 then
  88.     print("Unten")
  89. end
  90. if ReplaceUp==1 then
  91.     print("Oben")
  92. end
  93. if ReplaceUp ==0 then
  94.     if ReplaceDown == 0 then
  95.         print("Es wird nichts gesetzt")
  96.     end
  97. end
  98.  
  99. read()
  100. if RefuelOnStartUp==1 then
  101.     for N = 1, 16, 1 do
  102.         turtle.select(N)
  103.         turtle.refuel()
  104.     end
  105.  
  106.     gesammt = 2*digX*digY*digZ
  107.     fuel = turtle.getFuelLevel()
  108.     if gesammt>fuel then
  109.         print("Nicht genug Fuel")
  110.         API.fuel(gesammt)
  111.     end
  112. end
  113.  
  114. digX=digX/2
  115. digY=digY/2
  116.  
  117. digX=digX-1
  118.  
  119. turtle.forward()
  120. turtle.turnRight()
  121. turtle.forward()
  122. turtle.turnLeft()
  123. checkReplace(0,0,0)
  124.  
  125. for variableY = 1, digY, 1 do
  126.     yleft=digY-variableY+1
  127.     write("Noch ")
  128.     write(yleft-1)
  129.     print(" Felder nach Rechts")
  130.     for variableZ = 1, digZ, 1 do
  131.         for variableX = 1, digX, 1 do
  132.                 API.forward(2)
  133.                 checkReplace(variableX,variableY-1,variableZ-1)
  134.         end
  135.         API.homeX()
  136.         if variableZ<digZ then
  137.             API.up()
  138.             checkReplace(0,variableY-1,variableZ)
  139.         end
  140.     end
  141.     API.homeZ()
  142.     if variableY<digY then
  143.         API.right(2)
  144.         checkReplace(0,variableY,0)
  145.     end
  146. end
  147. API.homeY()
  148.  
  149. turtle.back()
  150. turtle.turnRight()
  151. turtle.back()
  152. turtle.turnLeft()
  153. print("Fertig")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement