Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local input = {...}
- if #input~=3 then
- print("Usage: rmwater <x> <y> <z>")
- return
- end
- local x = tonumber(input[1])
- local y = tonumber(input[2])
- local z = tonumber(input[3])
- local function checkFuel()
- turtle.select(1)
- if turtle.getFuelLevel()==0 then
- while not turtle.refuel(1) do
- print("Waiting For Fuel...")
- end
- end
- turtle.select(2)
- end
- local function checkItemsAndPlace()
- turtle.select(2)
- local slot = 2
- while turtle.getItemCount()==0 do
- slot = slot + 1
- if slot>16 then
- slot = 2
- end
- turtle.select(slot)
- end
- turtle.placeDown()
- end
- local function span(x,y,z,vert,action)
- for i=1,y do
- for j=1,z do
- for k=1,x do
- action()
- if k~=x then
- checkFuel()
- while not turtle.forward() do end
- end
- end
- if j % 2 == (x % 2 == 1 and 1 or i % 2) then
- turtle.turnRight()
- checkFuel()
- if j~=z then
- while not turtle.forward() do end
- end
- turtle.turnRight()
- else
- turtle.turnLeft()
- checkFuel()
- if j~=z then
- while not turtle.forward() do end
- end
- turtle.turnLeft()
- end
- end
- if i~=y then
- checkFuel()
- while not vert() do end
- end
- end
- end
- span(x,y,z,turtle.up,checkItemsAndPlace)
- checkFuel()
- while not turtle.forward() do end
- turtle.turnRight()
- while not turtle.forward() do end
- turtle.turnLeft()
- span(x-2,y,z-2,turtle.down,turtle.digDown)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement