mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-21 18:23:14 +00:00
Make gps.locate use distance received instead of modem distance.
This commit is contained in:
parent
b121189f36
commit
4ced8429ad
@ -148,8 +148,8 @@ function locate(_nTimeout, _bDebug)
|
||||
local sSide, sChannel, sReplyChannel, tMessage, nDistance = p1, p2, p3, p4, p5
|
||||
if sSide == sModemSide and sChannel == CHANNEL_GPS and sReplyChannel == CHANNEL_GPS and nDistance then
|
||||
-- Received the correct message from the correct modem: use it to determine position
|
||||
if type(tMessage) == "table" and #tMessage == 3 and tonumber(tMessage[1]) and tonumber(tMessage[2]) and tonumber(tMessage[3]) then
|
||||
local tFix = { vPosition = vector.new(tMessage[1], tMessage[2], tMessage[3]), nDistance = nDistance }
|
||||
if type(tMessage) == "table" and #tMessage == 4 and tonumber(tMessage[1]) and tonumber(tMessage[2]) and tonumber(tMessage[3]) and tonumber(tMessage[4]) then
|
||||
local tFix = { vPosition = vector.new(tMessage[1], tMessage[2], tMessage[3]), nDistance = tMessage[4] }
|
||||
if _bDebug then
|
||||
print(tFix.nDistance .. " metres from " .. tostring(tFix.vPosition))
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user