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