SHOW:
|
|
- or go back to the newest paste.
1 | local tArgs = { ... } | |
2 | if #tArgs ~= 1 then | |
3 | print( "Usage: quarry size <length>" ) | |
4 | print( "Place blocks in slots 1 - 14, place landmarks in 16" ) | |
5 | return | |
6 | end | |
7 | ||
8 | -- Set length with user input | |
9 | local length = tonumber( tArgs[1] ) | |
10 | if length < 1 then | |
11 | print( "Side length must be positive" ) | |
12 | return | |
13 | end | |
14 | local curSlot = 1 | |
15 | function putblockdown() | |
16 | if not (turtle.detectDown()) then | |
17 | - | while turtle.getItemCount(curSlot) == 0 and curSlot < 16 do |
17 | + | while turtle.getItemCount(curSlot) == 0 and curSlot < 15 do |
18 | curSlot = curSlot + 1 | |
19 | end | |
20 | turtle.select(curSlot) | |
21 | turtle.placeDown() | |
22 | end | |
23 | end | |
24 | ||
25 | -- Place Landmark in front | |
26 | function placelmf() | |
27 | if not (turtle.detect()) then | |
28 | putblockdown() | |
29 | turtle.back() | |
30 | turtle.select(16) | |
31 | turtle.place() | |
32 | end | |
33 | end | |
34 | ||
35 | -- Place Landmark left and right | |
36 | function placelmb() | |
37 | if not (turtle.detect()) then | |
38 | turtle.turnRight() | |
39 | turtle.forward() | |
40 | putblockdown() | |
41 | turtle.back() | |
42 | turtle.select(16) | |
43 | turtle.place() | |
44 | turtle.turnLeft() | |
45 | turtle.turnLeft() | |
46 | turtle.forward() | |
47 | putblockdown() | |
48 | turtle.back() | |
49 | turtle.select(16) | |
50 | turtle.place() | |
51 | turtle.turnRight() | |
52 | end | |
53 | end | |
54 | ||
55 | ||
56 | ||
57 | function backhome() | |
58 | x = length | |
59 | while x > 0 do | |
60 | -- putblockdown() | |
61 | turtle.back() | |
62 | x = x - 1 | |
63 | - | -- Move forward <length> times |
63 | + | |
64 | end | |
65 | -- Move length to place first Landmark and return home | |
66 | local i = 0 | |
67 | while i < length do | |
68 | turtle.forward() | |
69 | i = i + 1 | |
70 | end | |
71 | ||
72 | placelmf() | |
73 | backhome() | |
74 | turtle.back() | |
75 | turtle.turnLeft() | |
76 | ||
77 | -- Build platform for quarries and power | |
78 | ||
79 | local i = 0 | |
80 | while i < 11 do | |
81 | putblockdown() | |
82 | turtle.forward() | |
83 | i = i + 1 | |
84 | end | |
85 | ||
86 | turtle.turnRight() | |
87 | turtle.forward() | |
88 | turtle.forward() | |
89 | turtle.turnRight() | |
90 | turtle.forward() | |
91 | ||
92 | local i = 0 | |
93 | while i < 11 do | |
94 | putblockdown() | |
95 | - | -- That's all, folks! |
95 | + | |
96 | i = i + 1 | |
97 | end | |
98 | ||
99 | turtle.turnRight() | |
100 | turtle.forward() | |
101 | turtle.turnRight() | |
102 | ||
103 | -- Move length and place Landmarks on both sides then return home | |
104 | ||
105 | local i = 0 | |
106 | while i < length do | |
107 | putblockdown() | |
108 | turtle.forward() | |
109 | i = i + 1 | |
110 | end | |
111 | ||
112 | placelmb() | |
113 | backhome() | |
114 | turtle.turnLeft() | |
115 | turtle.forward() | |
116 | ||
117 | -- Move length and place landmark for 2nd quarry then return home | |
118 | ||
119 | local i = 0 | |
120 | while i < length do | |
121 | turtle.forward() | |
122 | i = i + 1 | |
123 | end | |
124 | ||
125 | placelmf() | |
126 | backhome() | |
127 | ||
128 | -- Fin | |
129 | print("Quarry setup") | |
130 | return |