View difference between Paste ID: Ug5k95gp and pCWUNGaK
SHOW: | | - or go back to the newest paste.
1
local t = turtle
2
3
local function forward(x)
4
	for i = 1, x do
5
		t.forward()
6
	end
7
end
8
9
local function rTurn(x)
10
	for i = 1, x do
11
		t.turnRight()
12
	end
13
end
14
15
local function lTurn(x)
16
	for i = 1, x do
17
		t.turnLeft()
18
	end
19
end
20
21
local function up(x)
22
	for i = 1, x do
23
		t.up()
24
	end
25
end
26
27
local function down(x)
28
	for i = 1, x do
29
		t.down()
30
	end
31
end
32
33
local function back(x)
34
	for i = 1, x do
35
		t.back()
36
	end
37
end
38
39
local fuelAmount = t.getFuelLevel()
40
41
local function fuelCheck()
42
	if fuelAmount < 5000 then
43
		back(3)
44
		os.sleep(5)
45
		rs.setOutput("left", true)
46
		os.sleep(5)
47
		rs.setOutput("left", false)
48
		t.select(3)
49
		t.refuel(all)
50
		forward(3)
51
		print("Gassed up and good to go!")
52
	else
53
		print("Still Rollin!")
54
	end
55
end
56
57
local itemCheck1 = t.getItemCount(1)
58
local itemCheck2 = t.getItemCount(2)
59
60
local function bonemealCheck()
61
	t.select(2)
62-
	if itemCheck2 < 20 then
62+
	if itemCheck2 < 30 then
63
		back(3)
64
		rs.setOutput("back", true)
65-
		os.sleep(15)
65+
		os.sleep(10)
66
		rs.setOutput("back", false)
67
		forward(3)
68
	else
69
		print("Ready to Bone")
70
	end
71
end
72
73
local function saplingCheck()
74
	t.select(1)
75
	if itemCheck1 < 5 then
76
		back(3)
77
		rs.setOutput("right", true)
78
		os.sleep(5)
79
		rs.setOutput("right", false)
80
		forward(3)
81
	else
82
		print("It's time to Lay")
83
	end
84
end
85
86
local function grow()
87
	t.select(2)
88
	while t.place() do
89
		t.place()
90
	end
91
end
92
	
93
94
local function plant()
95
	t.select(1)
96
	t.place()
97
end
98
99
local function harvest()
100
	t.dig()
101
	forward(1)
102
	for i = 1, 15, 1 do
103
		t.digUp()
104
		up(1)
105
	end
106
	down(15)
107
	back(1)
108
end
109
110
while true do
111
	saplingCheck()
112
	bonemealCheck()
113
	fuelCheck()
114
	plant()
115
	grow()
116
	harvest()
117
end