Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DumpChestSlot = 1
- FuelChestSlot = 2
- GravityWait = 0.5
- ItemChestSlot = 3
- ItemSlot = 4
- SpaceBegin = 5
- SpaceEnd = 16
- Args = {...}
- L, W, H = tonumber(Args[1]), tonumber(Args[2]), tonumber(Args[3])
- function build()
- if turtle.getItemCount(ItemSlot) == 0 then
- turtle.select(ItemChestSlot)
- turtle.placeDown()
- turtle.select(ItemSlot)
- turtle.suckDown()
- turtle.select(ItemChestSlot)
- turtle.digDown()
- end
- if needSpace() then
- turtle.select(DumpChestSlot)
- turtle.placeDown()
- for slot = SpaceBegin, SpaceEnd do
- turtle.select(slot)
- turtle.dropDown()
- end
- turtle.select(DumpChestSlot)
- turtle.digDown()
- end
- turtle.select(ItemSlot)
- return turtle.placeDown()
- end
- function move()
- turtle.select(SpaceBegin)
- while turtle.dig() do
- os.sleep(GravityWait)
- end
- if needFuel() then
- turtle.select(FuelChestSlot)
- turtle.place()
- turtle.suck()
- turtle.refuel()
- turtle.dig()
- end
- return turtle.forward()
- end
- function moveUp()
- turtle.select(SpaceBegin)
- while turtle.digUp() do
- os.sleep(GravityWait)
- end
- if needFuel() then
- turtle.select(FuelChestSlot)
- turtle.placeUp()
- turtle.suckUp()
- turtle.refuel()
- turtle.digUp()
- end
- return turtle.up()
- end
- function needFuel()
- if (turtle.getFuelLimit() == "unlimited") or (turtle.getFuelLevel() > 0) then
- return false
- end
- return true
- end
- function needSpace()
- for slot = SpaceBegin, SpaceEnd do
- if turtle.getItemCount(slot) == 0 then
- return false
- end
- end
- return true
- end
- function surface()
- return (l == 1 or l == L or w == 1 or l == L or h == 1 or h == H)
- end
- for h = 1, H do
- moveUp()
- for w = 1, W do
- for l = 1, L do
- if surface() then
- build()
- end
- move()
- end
- local turn
- if (w % 2) == 0 then
- turn = turtle.turnRight
- else
- turn = turtle.turnLeft
- end
- turn()
- move()
- turn()
- end
- if (w % 2) == 1 then
- turtle.turnRight()
- turtle.turnRight()
- for l = 1, L do
- move()
- end
- end
- turtle.turnRight()
- for w = 1, W do
- move()
- end
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement