Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function countInventory()
- local total = 0
- for slot = 1, 16 do
- total = total + turtle.getItemCount(slot)
- end
- return total
- end
- function selectAndPlaceDown()
- for slot = 1, 16 do
- if turtle.getItemCount(slot) > 0 then
- turtle.select(slot)
- turtle.placeDown()
- return
- end
- end
- end
- function buildWall(length, height)
- if hare.countInventory() < length * height then
- return false
- end
- turtle.up()
- local movingForward = true
- for currentHeight = 1, height do
- for currentLength = 1, length do
- selectAndPlaceDown()
- if movingForward and currentLength ~= length then
- turtle.forward()
- elseif not movingForward and currentLength ~=length then
- turtle.back()
- end
- end
- if currentHeight ~= height then
- turtle.up()
- end
- movingForward = not movingForward
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement