Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- print(type(args[1]))
- print(args[2])
- squaremax=tonumber(args[1])
- numbot=tonumber(args[2])
- distance=0
- distance2=numbot
- height=3
- function suck ()
- turtle.select(4)
- count=0
- for c=1,height do
- if turtle.getItemCount(16)>0 then
- return false
- end
- turtle.suckDown()
- end
- return true
- end
- function fuelUP ()
- if turtle.getFuelLevel()<=16 and turtle.getItemCount(2)>1 then
- turtle.select(2)
- while turtle.getFuelLevel()<=120 and turtle.getItemCount(2)>1 do
- turtle.refuel(1)
- end
- return true
- end
- return false
- end
- function returnback ()
- for x=1,height do
- turtle.up()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- booln = 0
- for dist=distance,0,-1 do
- turtle.forward()
- end
- if distance2>0 then
- turtle.turnLeft()
- for dist2=distance2,0,-1 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- for slot=4,16 do
- turtle.select(slot)
- turtle.drop()
- end
- turtle.select(1)
- turtle.suckUp(turtle.getItemSpace())
- turtle.select(2)
- turtle.suckUp(turtle.getItemSpace())
- turtle.select(3)
- turtle.suckUp(turtle.getItemSpace())
- if distance2 >0 then
- turtle.turnRight()
- for dist2=0,distance2 do
- turtle.forward()
- end
- turtle.turnLeft()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for dist=1,distance do
- fuelUP()
- turtle.forward()
- end
- for x=1,height do
- turtle.down()
- end
- end
- function returnto ()
- for x=1,height do
- turtle.up()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- booln = 0
- for dist=distance,0,-1 do
- turtle.forward()
- end
- if distance2>0 then
- turtle.turnLeft()
- for dist2=distance2,0,-1 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- for slot=4,16 do
- turtle.select(slot)
- turtle.drop()
- end
- turtle.select(1)
- turtle.suckUp(turtle.getItemSpace())
- turtle.select(2)
- turtle.suckUp(turtle.getItemSpace())
- turtle.select(3)
- turtle.suckUp(turtle.getItemSpace())
- end
- while distance2 < squaremax do
- if distance2 >0 then
- turtle.turnRight()
- for dist=distance2,0,-1 do
- for x=1,height do
- if turtle.detectDown() then
- turtle.digDown()
- end
- if turtle.detect() then
- turtle.dig()
- end
- turtle.down()
- end
- for x=1,height do
- turtle.up()
- end
- turtle.forward()
- end
- end
- if distance2 >0 then
- turtle.turnRight()
- end
- while distance< squaremax do
- for x=1,height do
- if turtle.detectDown() then
- turtle.digDown()
- end
- if turtle.detect() then
- turtle.dig()
- end
- turtle.down()
- end
- if distance %10 ==0 then
- if turtle.getItemCount(3)<1 then
- returnback()
- end
- turtle.select(3)
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- if not suck() then
- returnback()
- suck()
- end
- if not turtle.detect() then
- if turtle.getItemCount(1)<2 then
- returnback()
- end
- turtle.select(1)
- turtle.placeDown()
- end
- for x=1,height do
- turtle.up()
- end
- if not fuelUP() and turtle.getFuelLevel()<0 then
- break
- end
- turtle.forward()
- distance=distance+1
- print(distance)
- end
- returnto()
- distance=0
- distance2=distance2+numbot
- end
- print("out of fuel")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement