Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- facing = 0
- xPos = 0
- yPos = 0
- zPos = 0
- local oldForward = turtle.forward
- function forward()
- if oldForward() then
- if facing == 0 then
- xPos = xPos + 1
- elseif facing == 1 then
- zPos = zPos + 1
- elseif facing == 2 then
- xPos = xPos - 1
- else
- zPos = zPos - 1
- end
- return true
- else
- return false
- end
- end
- local oldLeft = turtle.turnLeft
- function turnLeft()
- oldLeft()
- facing = facing + 1
- facing = facing % 4
- end
- local oldRight = turtle.turnRight
- function turnRight()
- oldRight()
- facing = facing - 1
- facing = facing % 4
- end
- local oldBack = turtle.back
- function back()
- if oldBack() then
- if facing == 0 then
- xPos = xPos - 1
- elseif facing == 1 then
- zPos = zPos - 1
- elseif facing == 2 then
- xPos = xPos + 1
- else
- zPos = zPos + 1
- end
- return true
- else
- return false
- end
- end
- local oldDown = turtle.down
- function down()
- if oldDown() then
- yPos = yPos - 1
- return true
- else
- return false
- end
- end
- local oldUp = turtle.up
- function up()
- if oldUp() then
- yPos = yPos + 1
- return true
- else
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement