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