View difference between Paste ID: mCa2a3Wj and qVX1jm91
SHOW: | | - or go back to the newest paste.
1
local args = {...}
2
3-
local stripLength = 33
3+
local stripLength = 35
4
local count = 0
5
local line = 0
6
7
if not #args == 1 then
8
  print("Usage: smine <mines>")
9
  return
10
end
11
12
function strip()
13
  count = 0
14
  for i=1,stripLength do
15
	count = count + 1
16-
    checkFuel(count)
16+
17
    while not turtle.forward() do turtle.dig() end
18
    while turtle.detectUp() do
19
      turtle.digUp()
20
      sleep(0.1)
21-
      sleep(0.2)
21+
22
    while turtle.detectDown() do
23
      turtle.digDown()
24
      sleep(0.1)
25-
      sleep(0.2)
25+
26
    
27
	if line%8 == 0 then
28
    	if i%8 == 0 then
29
     	 turtle.select(16)
30
    	  while not turtle.forward() do turtle.dig() end
31
    	  while turtle.detectDown() do
32
   	     turtle.digDown()
33
  	      sleep(0.1)
34-
  	      sleep(0.2)
34+
35
      if not turtle.back() then
36
        turtle.turnLeft()
37
		turtle.turnLeft()
38
        while not turtle.forward do turtle.dig() end
39
        turtle.turnLeft()
40
		turtle.turnLeft()
41
      end
42
	  turtle.down()
43
	  if not turtle.detectDown() then
44-
	  if not turtle.detectDown() do
44+
45
		 turtle.placeDown()
46
         turtle.select(16)
47
      end
48
	  turtle.up()
49
      turtle.placeDown()
50
      turtle.select(1)
51
    end
52
end
53
  end
54
  
55
  turtle.turnLeft()
56
  turtle.turnLeft()
57
  
58
  for i=1,stripLength do
59
    while not turtle.forward() do turtle.dig() end
60
  end
61
end
62
63
function checkInv()
64-
function checkFuel(count)
64+
65-
  if turtle.getFuelLevel() <= count then
65+
66-
    print("Error: Low fuel")
66+
67
    if turtle.getItemCount(i) == 0 then
68
      isFull = false
69-
      turtle.refuel()
69+
70
  end
71
  
72-
	if turtle.getFuelLevel() <= count then
72+
73
    turtle.select(15)
74-
   		turtle.turnLeft()
74+
75-
		print("returning")
75+
76-
        print(count)
76+
77-
		for i=0,count do
77+
78-
			turtle.forward()
78+
79-
		end
79+
80-
		emptyInv()
80+
81-
		turtle.turnRight()
81+
    sleep(0.1)
82-
	end
82+
83
  end
84
end
85
86
function emptyInv()
87
	turtle.select(15)
88
   	while not turtle.placeDown() do turtle.digDown() end
89
   	for i=1,14 do
90
      	turtle.select(i)
91
      	turtle.dropDown()
92
   	end
93
	turtle.select(15)
94
	turtle.digDown()
95
   	sleep(0.1)
96
	turtle.select(1)
97
end
98
99
for x=1,args[1] do
100
  turtle.turnLeft()
101
  strip()
102
  strip()
103
  turtle.turnRight()
104-
    sleep(0.2)
104+
105
      turtle.select(16)
106
      turtle.placeDown()
107
      turtle.select(1)
108
  end
109
  while not turtle.forward() do turtle.dig() end
110
    while turtle.detectUp() do
111
      turtle.digUp()
112
      sleep(0.1)
113
    end
114
    while turtle.detectDown() do
115
      turtle.digDown()
116
    end
117
  line = line + 1
118-
   	sleep(0.2)
118+
119
end
120
emptyInv()