-
Notifications
You must be signed in to change notification settings - Fork 3
/
eztower.cc.lua
47 lines (42 loc) · 916 Bytes
/
eztower.cc.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
aArgs = {...}
local width = tonumber(aArgs[1])
local length = tonumber(aArgs[2])
local height = tonumber(aArgs[3])
local slot = 1
turtle.select(slot)
local function slotChecker()
if turtle.getItemCount(slot) == 0 then
slot = slot + 1
turtle.select(slot)
print("Switching to " .. slot)
end
end
local function placeRow(dir)
local distance = 0
if dir == "length" then
distance = length
elseif dir == "width" then
distance = width
end
for i = 1, distance, 1 do
slotChecker()
turtle.placeDown()
if i < width then
turtle.forward()
else
turtle.turnRight()
end
end
end
for j = 1, height, 1 do
turtle.up()
placeRow("length")
placeRow("width")
placeRow("length")
placeRow("width")
end
turtle.turnLeft()
turtle.forward()
for j = 1, height, 1 do
turtle.down()
end