Skip to content

Commit aefa3b8

Browse files
committed
Add a version of obsidian2 script
1 parent b4d798b commit aefa3b8

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

obsidian2.cc.lua

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

0 commit comments

Comments
 (0)