View difference between Paste ID: bU2bKEqz and FjRs8Cd3
SHOW: | | - or go back to the newest paste.
1
---Strip Mine---
2
3
--fuel in 1, Chests in 2
4
5
-- Create the function for refueling
6
function checkFuel()
7
  if turtle.getFuelLevel() <= 10 then
8
    turtle.select(1)
9
    turtle.refuel(1)
10
    turtle.select(1)
11
  end --if
12
end --checkFuel()
13
14
-- Create the function for unloading
15
function unload()
16
  for slot = 3, 16 do
17
    turtle.select(slot)
18
    turtle.dropDown()
19
  end --for
20
end --unload()
21
22
-- Create the function for checkingInventory
23-
function checkInv(number steps)
23+
function checkInv(steps)
24
  goBack = false
25
  for slot = 3, 16 do
26
    if turtle.getItemCount() > 0 then
27
      goBack = true
28
    end --if
29
  end --for
30
  if goBack == true then
31
    turtle.turnLeft()
32
    turtle.turnLeft()
33
    for i = 1, steps do
34
      checkFuel()
35
      turtle.forward()
36
    end --for
37
  end --if
38
  unload()
39
end --checkInv()
40
41
-- Create the function for mining one
42-
function digOne(number steps)
42+
function digOne(steps)
43
  checkInv(steps)
44
  turtle.dig()
45
  checkFuel()
46
  turtle.forward()
47
  turtle.digUp()
48
end --digOne()
49
50
function run(number_tunnel, length_tunnel)
51
for tunnel = 1,number_tunnel do
52
  turtle.digDown()
53
  turtle.select(1)
54
  turtle.placeDown()
55
  vorwaerts = 0
56
  for steps = 0, length_tunnel do
57
    digOne()
58
    vorwaerts = vorwaerts + 1
59
  end --for
60
  turtle.turnLeft()
61
  turtle.turnLeft()
62
  for k = 0, vorwaerts do
63
    checkFuel()
64
    turtle.forward()
65
  end --for
66
  unload()
67
  turtle.turnRight()
68
  digOne()
69
  digOne()
70
  digOne()
71
  turnRight()
72
end --for
73
end --function
74
75
-- Main script
76
print("Input tunnel length:")
77
local length = read()
78
print("Tunnel quantity")
79
local quantity = read()
80
print("starting excavation...")
81
run(quantity, length)