Fix GPS server

Was sending 4 replies per nodes and caused resolving to fail
This commit is contained in:
Anavrins
2020-08-22 20:18:07 -04:00
parent 7f880b1563
commit 64a218810a

View File

@@ -250,16 +250,15 @@ local function server(mode)
end end
Event.on('modem_message', function(_, side, channel, computerId, message, distance) 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 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 }) modem.transmit(computerId, GPS.CHANNEL_GPS, { modem.x, modem.y, modem.z })
end getPosition(computerId, modem, distance)
getPosition(computerId, modems[side], distance)
end end
if mode == 'snmp' and channel == 999 then if mode == 'snmp' and channel == 999 then
getPosition(computerId, modems[side], distance, message) getPosition(computerId, modem, distance, message)
end end
end end
end) end)