View difference between Paste ID: wXqYH6RT and yrqMXf3m
SHOW: | | - or go back to the newest paste.
1
--Notes
2
3
--Slot 1 = Fuel
4-
for slot = 2,16 do
4+
--Slot 2 = Torch (Not yet Used)
5
--Slot 3-16 = Cobble
6-
    turtle.select(slot)
6+
7-
    break
7+
8
9
--Find slot with something in it. Cobble.
10
--Needs to be enhanced
11
function findBlock()
12-
function move()
12+
	for slot = 3,16 do
13-
    turtle.forward()
13+
14
			turtle.select(slot) 
15-
    findBlock()
15+
			break
16
    end
17
	end
18
end
19
20
--Simple detect block in front, if false then move one block forward
21
function moveForward()
22
	if turtle.detect() == false then
23
		place()
24
		turtle.forward()
25
  end
26-
    findBlock()
26+
27
28-
    turtle.forward()
28+
--detect if block below and place
29
function place()
30
    if turtle.detectDown() == false then
31
    turtle.placeDown()
32
	end
33
end
34-
    findBlock()
34+
35
--refuel from slot 1
36-
    turtle.forward()
36+
37
    turtle.select(1)
38
    turtle.refuel()
39
    
40
end
41-
function run()
41+
42
--turn right
43-
    for i=1,59 do
43+
44-
        
44+
45-
    if turtle.getFuelLevel() < 1 then
45+
		turtle.forward()
46
		turtle.placeDown()
47-
    else 
47+
		turtle.turnRight()
48-
        move()
48+
49-
        end
49+
--turn left
50
function turnLeft()
51
    turtle.turnLeft()
52
		turtle.forward()
53-
while true do
53+
		turtle.placeDown()
54
		turtle.turnLeft()
55-
findBlock()
55+
56-
run()
56+
57-
turnRight()
57+
--Main Loop check fuel check inventory and begin movement
58-
run()
58+
function mainLoop()  
59-
turnLeft()
59+
  if turtle.getFuelLevel() <= 1 then
60
        refuel()
61-
        
61+
    elseif turtle.getItemCount() <= 1 then
62
        findBlock()
63
    elseif (turtle.getFuelLevel()>0) and (turtle.getItemCount()>0) then
64
        moveForward()
65
  end
66
end
67
  
68
repeat mainLoop()
69
    repeat turnRight()
70
		until turtle.detect() == false
71
until turtle.detect() == true
72
73
74