View difference between Paste ID: XXx1WCS1 and UNkMQei7
SHOW: | | - or go back to the newest paste.
1
-- Stripmine 2.0
2
3
term.clear()
4
term.setCursorPos(1,1)
5
print("Stripmine 2.0 by subzero22")
6-
print("How long do you want the tunnels?")
6+
print("This code was originally for a new version of CC. It has been edited for an older version to be used in tekkit and so it might have some bugs.")
7
print()
8-
x = tonumber( read() )
8+
9-
print("How wide do you want each strip?")
9+
function long()
10
  print("How long do you want the tunnels?")
11-
w = tonumber( read() )
11+
  write("> ")
12
  x = tonumber( read() )
13
 if x then
14
 else
15
   print("Please enter a number.")
16
   return long()
17
 end
18
end
19
long()
20
21
function wide()
22
  print("How wide do you want each strip?")
23
  write("> ")
24
  w = tonumber( read() )
25
 if w then
26
 else
27
   print("Please enter a number.")
28-
print("If so put ender chest in slot 16")
28+
   return wide()
29
 end
30
end
31
wide()
32
33-
print("If so put torches in slot 15")
33+
34
write("> ")
35
r = tonumber( read() )
36
 
37
-- math to figure if strips is odd or even
38
if r%2 == 1 then
39
rm = "odd"
40
else
41
rm = "even"
42-
tp = 14
42+
43
 
44-
tp = 15
44+
45
write("> ")
46
left = string.lower(read())
47
 
48
--[[
49
print("Does the turtle have ender chest support? (yes/no)")
50
print("If so put ender chest in slot 9")
51
write("> ")
52
ch = string.lower(read())
53
]]
54
55
if ch == yes then
56
print("Would you like it to place torches? (yes/no)")
57
print("If so put torches in slot 8")
58
torch = string.lower(read())
59
else
60
print("Would you like it to place torches? (yes/no)")
61
print("If so put torches in slot 9")
62
torch = string.lower(read())
63
end
64
65
if torch == "yes" then
66
print("How many spaces do you want each torch to be?")
67
ts = tonumber( read() )
68
end
69-
turtle.select(16)
69+
70
if torch == "yes" then
71
tp = 7
72
else
73
tp = 8
74
end
75
76
s = 1
77
w = w + 1
78
rw = w * r
79
tl = 1
80-
turtle.select(16)
80+
81
--[[ 
82
fuel = x * r + w * r + rw
83
flvl = turtle.getFuelLevel()
84
turtle.select(1)
85
86
while turtle.getFuelLevel() <= fuel do
87
print("Turtle has "..flvl.." fuel and needs "..fuel.."fuel to strip this much.")
88
print("Please put fuel in slot 1.")
89
os.pullEvent("turtle_inventory")
90
turtle.refuel(64)
91
end
92
print("Stripmine Starting")
93
print("Turtle will use "..fuel.." fuel.")
94
sleep(1)
95
]]
96
97
function chest()
98
if ch == "yes" then
99
if turtle.getItemCount(tp) > 0 then
100
turtle.select(9)
101
if turtle.placeDown() == false then
102
turtle.digDown()
103
turtle.placeDown()
104
end
105-
    turtle.select(15)
105+
106-
    if turtle.getItemCount(15) < 0 then
106+
107-
      print("Turtle is out of torches. Please place more in slot 14")
107+
108
s = s + 1
109
end
110-
      turtle.select(15)
110+
111
turtle.select(9)
112
turtle.digDown()
113
turtle.select(1)
114
end
115
turtle.select(1)
116
end
117
end
118
 
119
function strip()
120
  chest()
121
  while not turtle.forward() do
122
    turtle.dig()
123
    sleep(0.6)
124
  end
125
  while turtle.detectUp() do
126
    turtle.digUp()
127
    sleep(0.6)
128
  end
129
  while turtle.detectDown() do
130
    turtle.digDown()
131
  end
132
  if torch == "yes" then
133
    tl = tl + 1
134
  end
135
  if tl == ts then
136
    if ch == yes then
137
      to = 8   
138
    else
139
      to = 9
140
    end
141
    if turtle.getItemCount(to) < 0 then
142
      print("Turtle is out of torches. Please place more in slot "..to)
143
      os.pullEvent("turtle_inventory")
144
    else
145
      turtle.select(to)
146
      if turtle.placeDown() == false then
147
        if turtle.placeUp() == false then
148
          turtle.turnLeft()
149
          turtle.turnLeft()
150
          turtle.place()
151
          turtle.turnLeft()
152
          turtle.turnLeft()
153
        end
154
      end
155
    end
156
  turtle.select(1)
157
  tl = 1
158
  end
159
end
160
 
161
function turn()
162
if left == "left" then
163
turtle.turnLeft()
164
for i=1,w do
165
strip()
166
end
167
turtle.turnLeft()
168
left = "right"
169
else
170
turtle.turnRight()
171
for i=1,w do
172
strip()
173
end
174
turtle.turnRight()
175
left = "left"
176
end
177
end
178
 
179
function back()
180
  if rm == "odd" and left == "right" then
181
    turtle.turnLeft()
182
    for i=1,rw do
183
      strip()
184
    end
185
      turtle.turnRight()
186
    for i=1,x do
187
      strip()
188
    end
189
  end
190
  if rm == "odd" and left == "left" then
191
    turtle.turnRight()
192
    for i=1,rw do
193
      strip()
194
    end
195
      turtle.turnLeft()
196
    for i=1,x do
197
        strip()
198
    end
199
  end
200
  if rm == "even" and left == "left" then
201
    turtle.turnRight()
202
    for i=1,rw do
203
      strip()
204
    end
205
  end
206
  if rm == "even" and left == "right" then
207
    turtle.turnLeft()
208
    for i=1,rw do
209
      strip()
210
    end
211
  end
212
end
213
 
214
 
215
for i=1,r do
216
for i=1,x do
217
strip()
218
end
219
turn()
220
end
221
back()
222
print("Turtle has completed it's job.")