Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local directions = {north = "N", south = "S", east = "E", west = "W"}
- local facing = "N"
- local pos = {gps.locate()}
- local pos_moving = pos
- local action = {}
- action.forward = {function (times)
- for i = 0, times, 1 do
- turtle.forward()
- end
- if (facing == directions.north) then
- pos[3] = pos[3] - times
- elseif (facing == directions.south) then
- pos[3] = pos[3] + times
- elseif (facing == directions.east) then
- pos[1] = pos[1] + times
- elseif (facing == directions.west) then
- pos[1] = pos[1] - times
- end
- print("New pos: " .. pos)
- end}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement