-
Notifications
You must be signed in to change notification settings - Fork 0
/
mining_2x3.lua
72 lines (68 loc) · 1.3 KB
/
mining_2x3.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
function move_front ()
turtle.dig()
while (not turtle.forward()) do
turtle.dig()
end
turtle.digDown()
turtle.digUp()
end
function unload_inventory ()
turtle.turnRight()
turtle.turnRight()
while (turtle.forward()) do
end
for i = 2, 16 do
turtle.select(i)
turtle.drop(64)
end
turtle.select(1)
turtle.turnRight()
turtle.turnRight()
while (turtle.forward()) do
end
end
function mining (distance)
for i = 1, distance do
move_front()
if i%10 == 0 then
turtle.placeDown()
end
end
turtle.turnRight()
move_front()
turtle.turnRight()
for j = 1, distance do
move_front()
end
end
function init_mining ()
move_front()
turtle.turnRight()
move_front()
turtle.turnLeft()
move_front()
turtle.turnLeft()
move_front()
turtle.turnRight()
move_front()
turtle.turnRight()
move_front()
turtle.turnRight()
turtle.turnRight()
move_front()
turtle.turnRight()
end
if turtle.getFuelLevel() < 132 then
print("Not enought fuel")
else
init_mining()
turtle.placeDown()
turtle.turnLeft()
mining(30)
move_front()
mining(30)
turtle.forward()
turtle.turnRight()
turtle.forward()
unload_inventory()
end