-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewMine.lua
77 lines (65 loc) · 1.52 KB
/
NewMine.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require("OreSearch")
function startMining(targetOres)
local returnSteps=0
local torch=0
for i=1, 100 do
if forward() then
returnSteps = returnSteps + 1
checkChildren(targetOres)
while digUp() do
print("Digging up")
end
if torch == 6 then
turnLeft()
turtle.placeUp() --Need to check for torch
turnRight()
torch=0
end
end
torch = torch + 1
end
end
function returnToStart(targetOres)
turnLeft()
turnLeft()
for j=1, returnSteps do
if forward() then
returnSteps = returnSteps - 1
checkChildren(targetOres)
end
if torch == 6 then
turnRight()
turtle.placeDown() --Need to check for torch
turnLeft()
torch=0
end
end
end
function continueMining(targetOres)
print("Should I continue mining? y/n")
local userInput = io.read()
if userInput == "y" then
turnRight()
forward()
forward()
forward()
turnRight()
return true
else
return false
end
end
function stripMine(targetOres)
mine = true
while mine do
startMining(targetOres)
returnToStart(targetOres)
mine = continueMining()
end
end
args = {...}
--targetOres = (args[1])
targetOres={}
targetOres{"minecraft:iron_ore"}=true
targetOres{"minecraft:coal_ore"}=true
stripMine(targetOres)