SHOW:
|
|
- or go back to the newest paste.
1 | local length = 61 | |
2 | local width = 61 | |
3 | ||
4 | local function refuel() | |
5 | if turtle.getFuelLevel() < 50 then | |
6 | local prev = turtle.getSelectedSlot() | |
7 | turtle.select(1) | |
8 | if not turtle.refuel(4) then | |
9 | print('Need more fuel') | |
10 | while not turtle.refuel(4) do | |
11 | sleep(3) | |
12 | end | |
13 | end | |
14 | turtle.select(prev) | |
15 | end | |
16 | end | |
17 | ||
18 | local function tryForwards() | |
19 | refuel() | |
20 | while not turtle.forward() do | |
21 | if turtle.detect() then | |
22 | turtle.dig() | |
23 | sleep(.5) | |
24 | while turtle.detect() do | |
25 | turtle.dig() | |
26 | sleep(.5) | |
27 | end | |
28 | elseif turtle.attack() then | |
29 | else | |
30 | sleep(1) | |
31 | end | |
32 | end | |
33 | end | |
34 | ||
35 | - | local function advance() |
35 | + | |
36 | - | if turtle.getSelectedSlot() == 16 then |
36 | + | |
37 | - | print('Need more materials') |
37 | + | |
38 | - | local empty = true |
38 | + | |
39 | - | while empty do |
39 | + | |
40 | - | for n=2, 16 do |
40 | + | |
41 | - | print (n) |
41 | + | |
42 | - | if turtle.getItemCount(n) > 0 then |
42 | + | |
43 | - | empty = false |
43 | + | |
44 | - | turtle.select(n) |
44 | + | |
45 | - | return |
45 | + | |
46 | - | end |
46 | + | |
47 | - | end |
47 | + | |
48 | - | sleep(3) |
48 | + | for i = 1, length-1, 1 do |
49 | for j = 1, width-1, 1 do | |
50 | refuel() | |
51 | - | turtle.select(turtle.getSelectedSlot() + 1) |
51 | + | |
52 | end | |
53 | - | end |
53 | + | |
54 | end |