mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-23 02:28:05 +11:00
update the KOS NEO implementation to comply with new packet repeating behavior
This commit is contained in:
parent
e6e7a6b6b6
commit
7ed7452428
@ -40,10 +40,8 @@ sender: original sender of packet
|
|||||||
data: the actual packet data, duh.
|
data: the actual packet data, duh.
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
local listeners = {}
|
|
||||||
local timers = {}
|
local timers = {}
|
||||||
local hostname = computer.address():sub(1,8)
|
local hostname = computer.address():sub(1,8)
|
||||||
local listener = false
|
|
||||||
local dbug = false
|
local dbug = false
|
||||||
local modems = {}
|
local modems = {}
|
||||||
local port = 4096
|
local port = 4096
|
||||||
@ -112,7 +110,7 @@ local function genPacketID()
|
|||||||
return npID
|
return npID
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sendPacket(packetID,packetType,dest,sender,vport,data)
|
local function sendPacket(packetID,packetType,dest,sender,vport,data,repeatingFrom)
|
||||||
if rcache[dest] then
|
if rcache[dest] then
|
||||||
dprint("Cached", rcache[dest][1],"send",rcache[dest][2],port,packetID,packetType,dest,sender,vport,data)
|
dprint("Cached", rcache[dest][1],"send",rcache[dest][2],port,packetID,packetType,dest,sender,vport,data)
|
||||||
if modems[rcache[dest][1]].type == "modem" then
|
if modems[rcache[dest][1]].type == "modem" then
|
||||||
@ -123,10 +121,14 @@ local function sendPacket(packetID,packetType,dest,sender,vport,data)
|
|||||||
else
|
else
|
||||||
dprint("Not cached", port,packetID,packetType,dest,sender,vport,data)
|
dprint("Not cached", port,packetID,packetType,dest,sender,vport,data)
|
||||||
for k,v in pairs(modems) do
|
for k,v in pairs(modems) do
|
||||||
if v.type == "modem" then
|
-- do not send message back to the wired or linked modem it came from
|
||||||
v.broadcast(port,packetID,packetType,dest,sender,vport,data)
|
-- the check for tunnels is for short circuiting `v.isWireless()`, which does not exist for tunnels
|
||||||
elseif v.type == "tunnel" then
|
if v.address ~= repeatingFrom or (v.type ~= "tunnel" and v.isWireless()) then
|
||||||
v.send(packetID,packetType,dest,sender,vport,data)
|
if v.type == "modem" then
|
||||||
|
v.broadcast(port,packetID,packetType,dest,sender,vPort,data)
|
||||||
|
elseif v.type == "tunnel" then
|
||||||
|
v.send(packetID,packetType,dest,sender,vPort,data)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user