Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- local currentLevel = 0
- local build = false
- local currentSlot = 1
- local size = 1
- function isEmpty(slot)
- if turtle.getItemCount(slot) > 0 then
- return false
- else
- return true
- end
- end
- function nextSlot()
- currentSlot = currentSlot + 1
- turtle.select(currentSlot)
- end
- function buildColumn()
- while turtle.detectDown() == false do
- turtle.down()
- currentLevel = currentLevel + 1
- end
- if turtle.detectDown() == true then
- for i = 1, currentLevel do
- if isEmpty(currentSlot) == false then
- turtle.up()
- turtle.placeDown()
- else
- nextSlot()
- i = i - 1
- end
- end
- end
- currentLevel = 0
- end
- function buildTwoByTwo()
- buildColumn()
- turtle.forward()
- buildColumn()
- turtle.turnLeft()
- turtle.forward()
- buildColumn()
- turtle.turnLeft()
- turtle.forward()
- buildColumn()
- turtle.turnLeft()
- turtle.forward()
- print("DONE")
- end
- function buildThreeByThree()
- buildColumn()
- turtle.forward()
- buildColumn()
- turtle.forward()
- buildColumn()
- turtle.turnLeft()
- turtle.forward()
- buildColumn()
- turtle.turnLeft()
- turtle.forward()
- buildColumn()
- turtle.forward()
- buildColumn()
- turtle.turnRight()
- turtle.forward()
- buildColumn()
- turtle.turnRight()
- turtle.forward()
- buildColumn()
- turtle.forward()
- buildColumn()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- end
- function buildFourByFour()
- --
- end
- if tArgs[1] == nil then
- print("Building a 1 x 1 column")
- build = true
- else
- if tArgs[1 == "2" or tArgs[1] == "3" or tArgs[1] == "4" then
- build = true
- size = tonumber(tArgs[1])
- else
- print("Invalid Usage.")
- print("Usage:")
- print("column")
- print("column size")
- print(" ")
- print("Valid column sizes: (2) = 2 x 2, (3) = 3 x 3, (4) = 4 x 4")
- end
- end
- if build == true then
- if size == 1 then
- buildColumn()
- print("DONE")
- elseif size == 2 then
- buildTwoByTwo()
- elseif size == 3 then
- buildThreeByThree()
- elseif size == 4 then
- buildFourByFour()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement