From 7a69b6ae00980829c60bb857eca5f4cdb413029d Mon Sep 17 00:00:00 2001 From: Matthew Wilbern <39929480+fatboychummy@users.noreply.github.com> Date: Sat, 11 Nov 2023 02:34:40 -0700 Subject: [PATCH] Allow clients to fallback to default GPS usage for 'old' hosts. --- .../src/main/resources/data/computercraft/lua/rom/apis/gps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua index 13b1f7163..badeaac48 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/apis/gps.lua @@ -149,7 +149,7 @@ function locate(_nTimeout, _bDebug) 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 == 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] } + local tFix = { vPosition = vector.new(tMessage[1], tMessage[2], tMessage[3]), nDistance = tonumber(tMessage[4]) and tMessage[4] or nDistance } if _bDebug then print(tFix.nDistance .. " metres from " .. tostring(tFix.vPosition)) end