View difference between Paste ID: 3Y2qXXAu and ngCxpcqA
SHOW: | | - or go back to the newest paste.
1
function sygnal()
2
czyjest, blok=turtle.inspect()
3
4
if blok["name"]=="minecraft:log" then
5
znaleziono = "drewno"
6
elseif blok["name"]=="minecraft:leaves" then
7
znaleziono = "lisc"
8
elseif blok["name"]=="minecraft:tallgrass" then
9
znaleziono = "trawa"
10
elseif blok["name"]=="minecraft:double_plant" then
11
znaleziono = "kwiatek"
12
elseif blok["name"]=="minecraft:yellow_flower" then
13
znaleziono = "kwiatek"
14
else
15
znaleziono = "nic"
16
end
17
return znaleziono
18
19
end
20
21
function ruchpodstawowy()
22
23
while turtle.detectDown()==false do
24
turtle.down()
25
end
26
27
while (turtle.detect()==true) and (sygnal()=="nic") do 
28
turtle.up()
29
end
30
31
if turtle.detect()==false then
32
turtle.forward()
33
end
34
35
end
36
37
function ruchpelny()
38
39
if sygnal()=="nic" then
40
ruchpodstawowy()
41
end
42
43
if sygnal()=="lisc" then
44
turtle.dig()
45
end
46
47
if sygnal()=="trawa" then
48
turtle.dig()
49
end
50
51
if sygnal()=="kwiatek" then
52
turtle.dig()
53
end
54
55
56
if sygnal()=="drewno" then
57
turtle.turnRight()
58
ruchpodstawowy()
59
turtle.turnLeft()
60
end
61
62
end
63
64
function zwrotprawo()
65
turtle.turnRight()
66
end
67
68
function zwrotlewo()
69
turtle.turnLeft()
70
end 
71
72
local arg1, arg2 = ...
73
rr = arg2
74
p=1
75
for p=1,arg1 do
76
ruchpelny()
77
p=p+1
78
end
79
80
p=1
81
zwrotprawo()
82
83
for p=1,arg2 do
84
ruchpelny()
85
p=p+1
86
end