Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xPos,zPos=0,0
- xDir,zDir=0,1
- movement=0
- xUnload=0
- xReFuel=0
- function xPosition()
- if xDir == 0 then
- xPos = xPos + 1
- else
- xPos = xPos - 1
- end
- end
- function zPosition()
- if zDir == 1 then
- zPos = zPos + 1
- else
- zPos = zPos - 1
- end
- end
- function xForward()
- move()
- xPosition()
- end
- function zForward()
- move()
- zPosition()
- end
- function move()
- fuelUp()
- if not turtle.detect() then
- turtle.digUp()
- turtle.forward()
- else
- turtle.dig()
- turtle.digUp()
- turtle.attack()
- turtle.forward()
- end
- end
- function unload()
- for i=2,16 do
- turtle.select(i)
- turtle.drop()
- end
- xUnload = xUnload + 1
- print("unloaded " .. xUnload .. " times")
- turtle.rotateRight()
- turtle.rotateRight()
- if xDir == 1 then
- xDir = 0
- end
- end
- function fuelUp()
- if turtle.getFuelLevel() < 100 then
- turtle.select(1)
- turtle.refuel(1)
- xReFuel = xReFuel + 1
- print("refueled " .. xReFuel .. " times")
- end
- end
- -----------------------------------------------
- turtle.select(1)
- turtle.refuel(2)
- while true do
- turtle.turtleUp()
- for i=1,5 do
- xForward()
- end
- ------------------------------
- function rotateRight()
- turtle.turnRight()
- if zDir == 1 then
- zDir = 0
- end
- end
- ------------
- rotateRight()
- --------------
- for i=1,movement do
- zForward()
- end
- movement = movement + 1
- function rotateLeft()
- turtle.turnLeft()
- if xDir == 1 then
- xDir = 0
- end
- end
- rotateLeft()
- for i=1,20 do
- turtle.digDown()
- xForward()
- end
- function uTurn()
- print("turning arround")
- turtle.turnRight()
- zForward()
- turtle.turnRight()
- if xDir == 1 then
- xDir = 0
- else
- xDir = 1
- end
- print("successfully turned")
- end
- for i=1,20 do
- turtle.digDown()
- xForward()
- end
- rotateRight()
- for i=1,movement do
- zForward()
- end
- rotateLeft()
- for i=1,10 do
- xForward()
- end
- turtle.turtleDown()
- unload()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement