SHOW:
|
|
- or go back to the newest paste.
1 | tArgs = {...} | |
2 | ||
3 | local currentLevel = 0 | |
4 | local build = false | |
5 | local currentSlot = 1 | |
6 | local size = 1 | |
7 | ||
8 | function isEmpty(slot) | |
9 | if turtle.getItemCount(slot) > 0 then | |
10 | return false | |
11 | else | |
12 | return true | |
13 | end | |
14 | end | |
15 | ||
16 | function nextSlot() | |
17 | currentSlot = currentSlot + 1 | |
18 | turtle.select(currentSlot) | |
19 | end | |
20 | ||
21 | function buildColumn() | |
22 | while turtle.detectDown() == false do | |
23 | turtle.down() | |
24 | currentLevel = currentLevel + 1 | |
25 | end | |
26 | ||
27 | if turtle.detectDown() == true then | |
28 | for i = 1, currentLevel do | |
29 | if isEmpty(currentSlot) == false then | |
30 | turtle.up() | |
31 | turtle.placeDown() | |
32 | else | |
33 | nextSlot() | |
34 | i = i - 1 | |
35 | end | |
36 | end | |
37 | end | |
38 | currentLevel = 0 | |
39 | end | |
40 | ||
41 | function buildTwoByTwo() | |
42 | buildColumn() | |
43 | turtle.forward() | |
44 | buildColumn() | |
45 | turtle.turnLeft() | |
46 | turtle.forward() | |
47 | buildColumn() | |
48 | turtle.turnLeft() | |
49 | turtle.forward() | |
50 | buildColumn() | |
51 | turtle.turnLeft() | |
52 | turtle.forward() | |
53 | print("DONE") | |
54 | end | |
55 | ||
56 | function buildThreeByThree() | |
57 | buildColumn() | |
58 | turtle.forward() | |
59 | buildColumn() | |
60 | turtle.forward() | |
61 | buildColumn() | |
62 | turtle.turnLeft() | |
63 | turtle.forward() | |
64 | - | turtle.buildColumn() |
64 | + | |
65 | turtle.turnLeft() | |
66 | turtle.forward() | |
67 | buildColumn() | |
68 | turtle.forward() | |
69 | buildColumn() | |
70 | turtle.turnRight() | |
71 | turtle.forward() | |
72 | buildColumn() | |
73 | turtle.turnRight() | |
74 | turtle.forward() | |
75 | buildColumn() | |
76 | turtle.forward() | |
77 | buildColumn() | |
78 | turtle.turnRight() | |
79 | turtle.turnRight() | |
80 | turtle.forward() | |
81 | turtle.forward() | |
82 | turtle.forward() | |
83 | end | |
84 | ||
85 | function buildFourByFour() | |
86 | -- | |
87 | end | |
88 | ||
89 | if tArgs[1] == nil then | |
90 | print("Building a 1 x 1 column") | |
91 | build = true | |
92 | else | |
93 | - | if tArgs[2] == "2" or tArgs[2] == "3" or tArgs[2] == "4" then |
93 | + | if tArgs[1 == "2" or tArgs[1] == "3" or tArgs[1] == "4" then |
94 | build = true | |
95 | size = tonumber(tArgs[1]) | |
96 | else | |
97 | print("Invalid Usage.") | |
98 | print("Usage:") | |
99 | print("column") | |
100 | print("column size") | |
101 | print(" ") | |
102 | print("Valid column sizes: (2) = 2 x 2, (3) = 3 x 3, (4) = 4 x 4") | |
103 | end | |
104 | end | |
105 | ||
106 | if build == true then | |
107 | if size == 1 then | |
108 | buildColumn() | |
109 | print("DONE") | |
110 | elseif size == 2 then | |
111 | buildTwoByTwo() | |
112 | elseif size == 3 then | |
113 | buildThreeByThree() | |
114 | elseif size == 4 then | |
115 | buildFourByFour() | |
116 | end | |
117 | end |