Advertisement
Guest User

above

a guest
Oct 25th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. --os.loadAPI('Loc')
  2.  
  3. local playerHeight = 1.62
  4. local function printLoc(loc)
  5.   print('('..loc[1]..', '..loc[2]..', '..loc[3]..')')
  6. end
  7. local x,y,z = 1,2,3
  8.  
  9. if rednet.isOpen() ~= true then
  10. rednet.open('back')
  11. end
  12. local proto = 'waypoint'
  13. local host = assert(rednet.lookup(proto))
  14.  
  15. print('please')
  16.  
  17. local previous
  18. while true do
  19.   local pos
  20.   repeat
  21.     pos = {gps.locate(2)}
  22.     --print(pos,pos[1])
  23.     -- loop until we get coords that are not NaN
  24.   until pos[1] and (pos[1] == pos[1]) --and not (pos[1] ~= 0/0)
  25.   --print('.')
  26.  
  27.   -- print(raw[1], raw[2])
  28.   pos = vector.new(unpack(pos))
  29.   pos.y = pos.y - playerHeight + 1
  30.   pos = pos:round()
  31.  
  32.     --for i,coord in ipairs(pos) do
  33.   --  pos[i] = math.floor(coord)
  34.   --end
  35.   if pos ~= previous then
  36.     rednet.send(host, {pos.x,pos.y,pos.z}, proto)
  37.     previous = pos
  38.     ---print('?',pos)
  39.   end
  40.   sleep(0.5)
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement