View difference between Paste ID: hrQkvkda and m7mSPUdX
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.refuelAll()
50
		forward(3)
51
		t.print("Gassed up and good to go!")
52
	else
53
		t.print("Still Rollin!")
54
	end
55
end
56
57
local itemCheck = t.getItemCount()
58
59
local function bonemealCheck()
60
	t.select(2)
61
	if itemCheck < 10 then
62
		back(3)
63
		rs.setOutput("back", true)
64
		os.sleep(15)
65
		rs.setOutput("back", false)
66
		forward(3)
67
	else
68
		t.print("Ready to Bone")
69
	end
70
end
71
72
local function saplingCheck()
73
	t.select(1)
74
	if itemCheck < 5 then
75
		back(3)
76
		rs.setOutput("right", true)
77
		os.sleep(5)
78
		rs.setOutput("right", false)
79
		forward(3)
80
	else
81
		t.print("It's time to Lay")
82
	end
83
end
84
85
local function readyCheck()
86
	saplingCheck()
87
	bonemealCheck()
88
	fuelCheck()
89
end
90
91
local function grow()
92
	t.select(2)
93
	while t.place() do
94
		t.place()
95
	end
96
end
97
	
98
99
local function plant()
100
	t.select(1)
101
	t.place()
102
103
local function harvest()
104
	t.dig()
105
	for i = 1, 15, 1 do
106
		t.digUp()
107
		up(1)
108
	end
109
	down(15)
110
	back(1)
111
end
112
113
while true do
114
	readyCheck()
115
	plant()
116
	grow()
117
	Harvest()
118
end