Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- if (not tArgs[1]) or (not tArgs[2]) then
- print("Set parameters: <length> <width>")
- return
- end
- local checkArg = tArgs[1]
- local origLong = tonumber(checkArg)
- local long = tonumber(checkArg)-1
- checkArg = tArgs[2]
- local origWide = tonumber(checkArg)
- local wide = tonumber(checkArg)-1
- if tArgs[3] == "-c" then
- ceiling = TRUE
- end
- function goForward()
- while (not turtle.forward()) do
- turtle.dig()
- turtle.attack()
- sleep(0.1)
- end
- end
- function checkItems()
- if turtle.getItemCount() < 1 then
- repeat
- selected = turtle.getSelectedSlot()
- turtle.select(selected+1)
- until (selected == 15) or (turtle.getItemCount() > 0)
- if (turtle.getSelectedSlot() == 16) and (turtle.getItemDetail(16)["name"] == "enderstorage:ender_chest") then
- turtle.place()
- for k = 1,15 do
- turtle.select(k)
- turtle.suck()
- end
- turtle.select(16)
- if turtle.getItemCount(16) > 0 then
- turtle.drop()
- end
- turtle.dig()
- turtle.select(1)
- end
- end
- end
- function place()
- checkItems()
- if tArgs[3] == "-c" then
- turtle.placeUp()
- else
- turtle.placeDown()
- end
- goForward()
- end
- function row()
- for x = 1,(long) do
- place()
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- if tArgs[3] == "-c" then
- print("Your ceiling will be "..origLong.."x"..origWide)
- print("Place turtle on the top right corner BELOW the area to be ceilinged.")
- else
- print("Your floor will be "..origLong.."x"..origWide)
- print("Place turtle on the top right corner ABOVE the area to be floored.")
- end
- io.read()
- local currentRow = 1
- repeat
- row()
- if (currentRow % 2 == 0) then
- turtle.turnRight()
- place()
- turtle.turnRight()
- currentRow = currentRow + 1
- else
- turtle.turnLeft()
- place()
- turtle.turnLeft()
- currentRow = currentRow + 1
- end
- until currentRow > wide
- row()
- if (origWide % 2 == 0) then
- turtle.turnLeft()
- for x = 1,wide do
- place()
- end
- turtle.turnLeft()
- else
- turtle.turnLeft()
- turtle.turnLeft()
- for x = 1,long do
- place()
- end
- turtle.turnLeft()
- for x = 1,wide do
- place()
- end
- turtle.turnLeft()
- end
Add Comment
Please, Sign In to add comment