Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --os.loadAPI('Loc')
- local playerHeight = 1.62
- local function printLoc(loc)
- print('('..loc[1]..', '..loc[2]..', '..loc[3]..')')
- end
- local x,y,z = 1,2,3
- if rednet.isOpen() ~= true then
- rednet.open('back')
- end
- local proto = 'waypoint'
- local host = assert(rednet.lookup(proto))
- print('please')
- local previous
- while true do
- local pos
- repeat
- pos = {gps.locate(2)}
- --print(pos,pos[1])
- -- loop until we get coords that are not NaN
- until pos[1] and (pos[1] == pos[1]) --and not (pos[1] ~= 0/0)
- --print('.')
- -- print(raw[1], raw[2])
- pos = vector.new(unpack(pos))
- pos.y = pos.y - playerHeight + 1
- pos = pos:round()
- --for i,coord in ipairs(pos) do
- -- pos[i] = math.floor(coord)
- --end
- if pos ~= previous then
- rednet.send(host, {pos.x,pos.y,pos.z}, proto)
- previous = pos
- ---print('?',pos)
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement