View difference between Paste ID: CDd0epE4 and mHMYWxeC
SHOW: | | - or go back to the newest paste.
1
local top = 46
2
local bottom = 7
3
local width = 63
4
5-
local xSep = 2
5+
6-
local ySep = 4
6+
7
local torchCounter = 0
8
9
local xStartRow = 4
10
local xSpacing = 6
11
local yStartRow = {8, 3}
12
local ySpacing = 9
13
14
local function refuel()
15
    if turtle.getFuelLevel() == 0 then
16
        local prev = turtle.getSelectedSlot()
17
        turtle.select(1)
18
        if not turtle.refuel(1) then
19
            print('Need more fuel')
20
            while not turtle.refuel(1) do
21
                sleep(1)
22
            end
23
        end
24
        turtle.select(prev)
25
    end
26
end
27
28
local function advance()
29
    if turtle.getSelectedSlot() == 16 then
30-
                if turtle.getItemCount(n) > 0 and turtle.getItemDetail(n).name ~= 'chisel:marble' then
30+
31
        local empty = true
32
        while empty do
33
            for n=3, 16 do
34
                if turtle.getItemCount(n) > 0 and turtle.getItemDetail(n).name == 'chisel:marble' then
35
                    empty = false
36
                    turtle.select(n)
37
					return
38
                end
39
           	end
40
			sleep(5)
41
        end
42
   	else
43
        turtle.select(turtle.getSelectedSlot() + 1)
44
   	end
45
end
46
47
local function replace()
48
    while turtle.detect() do
49
        turtle.dig()
50
		sleep(.5)
51
    end
52
	local data = turtle.getItemDetail()
53-
	
53+
54
		advance()
55
    end
56
    turtle.place()
57
end
58
59
local function returnToFloor()
60
    turtle.turnRight()
61
	while not turtle.forward() do
62
		turtle.dig()
63
		sleep(.5)
64
	end
65
    turtle.turnLeft()
66-
	if x % 6 == xSep then
66+
67-
		if x % 2 == 0 then
67+
68-
			print(y)
68+
69-
			if (y-1) % 6 == ySep then
69+
	print(torchCounter)
70
	if x%xSpacing == xStartRow then
71-
				turtle.select(torches)
71+
		if torchCounter % 2 == 0 then
72-
				if not turtle.placeUp() then
72+
			if y%ySpacing == yStartRow[1] then
73-
					print 'Need more torches'
73+
74-
					while not turtle.placeUp() do
74+
                turtle.select(torches)
75-
						sleep(5)
75+
                if not turtle.placeUp() then
76-
					end
76+
                    print 'Need more torches'
77
                    while not turtle.placeUp() do
78-
				turtle.select(prev)
78+
                        sleep(5)
79
                    end
80
                end
81-
			if (y-1) % 6 == ySep then
81+
                turtle.select(prev)
82
				torchCounter = torchCounter + 1
83-
				turtle.select(torches)
83+
84-
				if not turtle.placeUp() then
84+
85-
					print 'Need more torches'
85+
			if y%ySpacing == yStartRow[2] then
86-
					while not turtle.placeUp() do
86+
87-
						sleep(5)
87+
                turtle.select(torches)
88-
					end
88+
                if not turtle.placeUp() then
89
                    print 'Need more torches'
90-
				turtle.select(prev)
90+
                    while not turtle.placeUp() do
91
                        sleep(5)
92
                    end
93
                end
94
                turtle.select(prev)
95
				torchCounter = torchCounter + 1
96
			end
97
		end
98-
	 local success, data = turtle.inspect()
98+
99
end
100
			
101
turtle.select(3)
102
for i = 1, width, 1 do
103-
        else
103+
	local success, data = turtle.inspect()
104-
            replace()
104+
	if success then
105
		if data.name ~= 'chisel:marble' then
106-
    for j = bottom, top - 2, 1 do
106+
107
		end
108
	else
109
		replace()
110
	end
111
112
    for j = bottom + 1, top - 1, 1 do
113
        refuel()
114
		if i % 2 == 1 then
115
			while not turtle.up() do
116
				if turtle.detect() then
117
					turtle.digUp()
118
				elseif turtle.attack() then
119
				else
120
					sleep(1)
121
				end
122
			end
123
		else
124
			while not turtle.down() do
125
				if turtle.detect() then
126
					turtle.digDown()
127
				elseif turtle.attack() then
128
				else
129
					sleep(1)
130
				end
131
			end
132
		end
133
        local success, data = turtle.inspect()
134
        if success then
135
            if data.name ~= 'chisel:marble' then
136
                replace()
137
			end
138
		else
139
			replace()
140
        end
141
		checkForTorch(i,j)
142
    end
143
	torchCounter = 0
144
    returnToFloor()
145
end