From 64a218810a19d8e81c680a51ed20e3a6691896fa Mon Sep 17 00:00:00 2001 From: Anavrins Date: Sat, 22 Aug 2020 20:18:07 -0400 Subject: [PATCH] Fix GPS server Was sending 4 replies per nodes and caused resolving to fail --- gps/gpsServer.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gps/gpsServer.lua b/gps/gpsServer.lua index d66b575..6d29d73 100644 --- a/gps/gpsServer.lua +++ b/gps/gpsServer.lua @@ -250,16 +250,15 @@ local function server(mode) end Event.on('modem_message', function(_, side, channel, computerId, message, distance) - if distance and modems[side] then + local modem = modems[side] + if distance and modem then if mode == 'gps' and channel == GPS.CHANNEL_GPS and message == "PING" then - for _, modem in pairs(modems) do - modem.transmit(computerId, GPS.CHANNEL_GPS, { modem.x, modem.y, modem.z }) - end - getPosition(computerId, modems[side], distance) + modem.transmit(computerId, GPS.CHANNEL_GPS, { modem.x, modem.y, modem.z }) + getPosition(computerId, modem, distance) end if mode == 'snmp' and channel == 999 then - getPosition(computerId, modems[side], distance, message) + getPosition(computerId, modem, distance, message) end end end)