View difference between Paste ID: 32ZsBV9B and 9vPiiykm
SHOW: | | - or go back to the newest paste.
1-
--initialisierung
1+
local y = 0
2-
turtle.select(1)
2+
local x = 0
3-
turtle.refuel()
3+
local z = 0
4-
turtle.select(16)
4+
local i = 0
5-
richtung=true
5+
local a = 0
6-
run=true
6+
local groesseX = 10
7
local groesseY = 10
8
local groesseZ = 30
9-
  while turtle.detectUp() == true do
9+
local richtung = false
10-
    turtle.digUp()
10+
11
function fGRABEN()
12-
  if turtle.detectDown()==true then
12+
  if turtle.detect()==true then
13-
    turtle.digDown()
13+
14-
    turtle.placeDown()
14+
15
  turtle.forward()
16-
  if turtle.detect() == true then
16+
17
18
function fSEITE()
19
  if richtung==true then
20-
  if turtle.detectDown() == true then
20+
    turtle.turnRight()
21-
    turtle.placeDown()
21+
22
    turtle.turnRight()
23
    richtung = false
24
  else
25-
while true do
25+
    turtle.turnLeft()
26-
  for i=1,10 do
26+
27
    turtle.turnLeft()
28
    richtung = true
29
  end
30-
      turtle.turnLeft()
30+
  y = y + 1
31
end
32-
      turtle.turnLeft()
32+
33-
      richtung=false
33+
fKOHLE()
34-
    else
34+
  if turtle.getFuelLevel()<=y + x + z then
35-
      turtle.turnRight()
35+
    fBACK()
36
  else
37-
      turtle.turnRight()
37+
    if fSTOCK() == true then
38-
      richtung=true
38+
      fBACK()
39
    end
40
  end
41
end
42
43
function fSTOCK()
44
  for i=1,16 do
45
    if turtle.getItemCount(i)==0 then
46
      a = a + 1
47
    end
48
  end
49
  if a <= 11 then
50
    return true
51
  end
52
end
53
54
function fBACK()
55
  turtle.turnLeft()
56
  for b=1,y-1 do
57
    turtle.forward()
58
  end
59
  turtle.turnLeft()
60
  for b=1, 16 do
61
    turtle.select(b) 
62
    turtle.drop()
63
  end
64
  turtle.turnRight()
65
  turtle.forward()
66
  turtle.forward()
67
  turtle.turnLeft()
68
  turtle.select(1)
69
  turtle.suck(64) 
70
  turtle.turnRight()
71
  turtle.turnRight()
72
  for f=1,y do
73
    turtle.forward()
74
  end
75
end
76
77
function fMAIN()
78
  for j=1, groesseX do
79
    for i=1,groesseY do
80
      fGRABEN()
81
    end
82
    fSEITE()
83
    if y == 2 then
84
       y = 0
85
       fKOHLE()
86
    end
87
    x = x + 1
88
  end
89
end