View difference between Paste ID: 81AVhysL and 32ZsBV9B
SHOW: | | - or go back to the newest paste.
1
local y = 0
2
local x = 0
3
local z = 0
4
local i = 0
5
local a = 0
6
local groesseX = 10
7
local groesseY = 10
8
local groesseZ = 30
9
local richtung = false
10
11
function fGRABEN()
12
  if turtle.detect()==true then
13
    turtle.dig()
14
  end
15
  turtle.forward()
16
end
17
18
function fSEITE()
19
  if richtung==true then
20
    turtle.turnRight()
21
    fGRABEN()
22
    turtle.turnRight()
23
    richtung = false
24
  else
25
    turtle.turnLeft()
26
    fGRABEN()
27
    turtle.turnLeft()
28
    richtung = true
29
  end
30
  y = y + 1
31
end
32
33-
fKOHLE()
33+
function fKOHLE()
34
  if turtle.getFuelLevel()<=y + x + z then
35
    fBACK()
36
  else
37
    if fSTOCK() == true then
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