-
Notifications
You must be signed in to change notification settings - Fork 3
/
obsidian2.cc.lua
62 lines (52 loc) · 1.18 KB
/
obsidian2.cc.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
local args = {...}
help = args[1]
function checkBlock(cmp, dig)
local got = false
for i=1,8 do
turtle.select(i)
if(cmp()) then
if(dig) then
got = dig()
else
got = true
end
end
return got
end
if help == "help" then
print("==== Obsidian Miner v1.3 ====")
print("By Zach Dyer")
print("Just relax let Obsidian Miner mine that pesky obsidian for you.")
print(" ")
print("USAGE: ")
print("1. Place obsidian in the first slot.")
print(" ")
print("2. Set turtle by any corner of an obsidian vein and type 'obsidian'")
else
local done = false
local tries = 0
if(checkBlock(turtle.compare, null))
then
done = true
print("Please add desired block(s) to slots 1 to 8")
end
while done == false do
checkBlock(turtle.compareDown,turtle.digDown)
checkBlock(turtle.compareUp, turtle.digUp)
if(checkBlock(turtle.compare, turtle.dig)) then
turtle.forward()
turtle.turnRight()
tries = 0
else
turtle.turnLeft()
tries = tries + 1
if tries == 5 then
turtle.back()
end
if tries > 8 then
done = true
end
end
end
turtle.select(1)
end