View difference between Paste ID: cStu536H and zAJphyJ0
SHOW: | | - or go back to the newest paste.
1
--Slot 1: Ender Chest to dumps items into.
2
--Slot 2: Ender Chest to pull Torches From.
3
--Slot 3: Fuel
4
--Slot 4: Torches
5
6
7
--Variables:
8
9
A = 0
10
B = 0
11
C = 0
12
13
14
--Functions
15
16
17
	--refuel
18
 local function refuel()
19
    if turtle.getFuelLevel() < 40 then
20
    turtle.select(3)
21
    turtle.refuel(10)
22
    end
23
    end
24
	
25
26
	--Put Items in Ender Chest
27
local function dumptochest()
28
    if turtle.getItemCount(16) ~= 0 then
29
    turtle.digDown()
30
    turtle.select(1)
31
    turtle.placeDown()
32
    for i = 5,16 do
33
      turtle.select(i)
34
      turtle.dropDown()
35
      end
36
    turtle.select(1)
37
    turtle.digDown()
38
    end
39
    end
40
41
	-- Gets Torches
42
local function gettorches()
43
    if turtle.getItemCount(4) == 0 then
44
    turtle.select(2)
45
    turtle.digDown()
46
    turtle.placeDown()
47
    turtle.select(4)
48
    turtle.suckDown()
49
    turtle.select(2)
50
    turtle.digDown()
51
    end
52
    end
53
	
54
	-- Places Torches
55
    local function torch()
56
    B = B + 1
57
    if B == 5 then
58
    turtle.select(4)
59
    --turtle.turnRight()
60
    --turtle.turnRight()
61
    turtle.placeDown()
62
    --turtle.turnRight()
63
    --turtle.turnRight()
64
    B = 0
65
    end
66
    end
67
68
	-- Mines
69
local function mining()
70
    refuel()
71
    turtle.dig()
72
    local f = turtle.forward()
73
    if f then
74
    A = A + 1
75
    end
76
    turtle.digUp()
77
    turtle.digDown()
78
    sleep(0.2)
79
    end
80
81
	--Returns Home
82
local function gohome()
83
    refuel()
84
    turtle.dig()
85
    local f = turtle.forward()
86
    if f then
87
    A = A + 1
88
    sleep(0.3)
89
    end
90
    end
91
92
	-- Code
93
94
if C == 0 then
95
    write("How Long do you want your tunnels?")
96
    distance = io.read()
97
    distance = tonumber(distance)
98
    end
99
100
101
while A < distance do
102
    dumptochest()
103
    torch()
104
    gettorches()
105
    mining()
106
    end
107
108
turtle.turnLeft()
109
mining()
110
turtle.turnLeft()
111
112
A = 0
113
114
while A < distance do
115
    dumptochest()
116
    mining()
117
    end
118
119
turtle.turnRight()
120
mining()
121
turtle.turnRight()
122
123
A = 0
124
125
while A < distance do
126
    dumptochest()
127
    mining()
128
    end
129
130
turtle.turnLeft()
131
mining()
132
turtle.turnLeft()
133
134
A = 0
135
136
while A < distance do
137
    dumptochest()
138
    --torch()
139
    --gettorches()
140
    mining()
141
    end