SHOW:
|
|
- or go back to the newest paste.
1 | local arg = { ... } | |
2 | local tool = require'import' | |
3 | - | local long = tonumber(arg[1]) |
3 | + | |
4 | - | local larg= tonumber(arg[2]) |
4 | + | local long |
5 | - | local h = tonumber(arg[3]) |
5 | + | local larg |
6 | local h | |
7 | ||
8 | ||
9 | if #arg < 1 then | |
10 | long, larg, h = 1,1,1 | |
11 | - | while not t.forward() do t.dig() end |
11 | + | else |
12 | long = tonumber(arg[1]) | |
13 | - | turtle.digUp() |
13 | + | larg= tonumber(arg[2]) |
14 | h = tonumber(arg[3]) | |
15 | end | |
16 | ||
17 | ||
18 | function fr(long, h) | |
19 | while long>1 do | |
20 | turtle.dig() | |
21 | tool.fd() | |
22 | if h>1 then | |
23 | while t.inspectUp() do t.digUp() end | |
24 | end | |
25 | - | while not t.forward() do t.dig() end |
25 | + | |
26 | end | |
27 | - | turtle.digUp() |
27 | + | |
28 | ||
29 | ||
30 | function virage(turn, h) | |
31 | --0 turn left, 1 turn right | |
32 | if turn == 0 then | |
33 | turtle.turnLeft() | |
34 | - | while not t.forward() do t.dig() end |
34 | + | |
35 | tool.fd() | |
36 | - | turtle.digUp() |
36 | + | |
37 | while t.inspectUp() do t.digUp() end | |
38 | end | |
39 | turtle.turnLeft() | |
40 | turn = 1 | |
41 | else | |
42 | turtle.turnRight() | |
43 | turtle.dig() | |
44 | tool.fd() | |
45 | if h>1 then | |
46 | while t.inspectUp() do t.digUp() end | |
47 | end | |
48 | turtle.turnRight() | |
49 | turn = 0 | |
50 | end | |
51 | return turn | |
52 | - | while not t.forward() do t.dig() end |
52 | + | |
53 | ||
54 | ||
55 | ||
56 | ||
57 | ||
58 | ||
59 | local turn=1 | |
60 | local nh=0 | |
61 | turtle.dig() | |
62 | - | turtle.digUp() |
62 | + | tool.fd() |
63 | - | turtle.up() |
63 | + | |
64 | turtle.digUp() | |
65 | end | |
66 | repeat | |
67 | - | turtle.digUp() |
67 | + | |
68 | - | turtle.up() |
68 | + | |
69 | nh= nh+1 | |
70 | else | |
71 | - | if h>1 then t.digUp() end |
71 | + | |
72 | tool.up() | |
73 | h = h-1 | |
74 | end | |
75 | if h>1 then | |
76 | tool.up() | |
77 | h = h-1 | |
78 | end | |
79 | if h>1 then while t.inspectUp() do t.digUp() end end | |
80 | end | |
81 | ||
82 | l = 0 | |
83 | nh2 = 0 | |
84 | while l<larg do | |
85 | if nh2==0 then | |
86 | nh2=nh2+1 | |
87 | else | |
88 | turn = virage(turn, h) | |
89 | end | |
90 | tool.needR() | |
91 | fr(long, h) | |
92 | l =l+1 | |
93 | end | |
94 | ||
95 | ||
96 | turtle.turnLeft() | |
97 | turtle.turnLeft() | |
98 | until h<=2 | |
99 | ||
100 |