Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- print("1: fuel\n2-16: blocks\n\nEnter x:")
- x = read()
- term.clear()
- print("Enter y:")
- y = read()
- term.clear()
- function refuel()
- local savedSlot = turtle.getSelectedSlot()
- turtle.select(1)
- while(not turtle.refuel(10))
- do
- write("Out of fuel! Place more fuel in slot 1 and press enter.")
- read()
- term
- .clear()
- end
- turtle.select(savedSlot)
- end
- function tryRefuel()
- if turtle.getFuelLevel() < 100 then refuel() end
- end
- function digForward()
- tryRefuel()
- while(turtle.detect())
- do
- turtle.dig()
- end
- turtle.forward()
- end
- function placeBlock()
- if turtle.detectDown() then return end
- local savedSlot = turtle.getSelectedSlot()
- blockSlot = 2
- turtle.select(blockSlot)
- while(not turtle.placeDown())
- do
- blockSlot = blockSlot+1
- if blockSlot == 17
- then
- write("Out of blocks! Place more blocks in slots 2-16 and press enter.")
- read()
- term.clear()
- blockSlot = 2
- end
- turtle.select(blockSlot)
- end
- turtle.select(savedSlot)
- end
- function line()
- placeBlock()
- for i = 1,x
- do
- digForward()
- placeBlock()
- end
- end
- function square()
- for i = 1,y/2
- do
- line()
- turtle.turnRight()
- digForward()
- turtle.turnRight()
- line()
- turtle.turnLeft()
- digForward()
- turtle.turnLeft()
- end
- line()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- while(true)
- do
- square()
- turtle.digDown()
- turtle.down()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement