mirror of
https://github.com/LDDestroier/CC/
synced 2025-05-05 16:34:06 +00:00
Added third "recipient" argument to send
This commit is contained in:
parent
79b3e2822c
commit
78b190d4a2
17
disknet.lua
17
disknet.lua
@ -93,7 +93,7 @@ disknet.closeAll = function()
|
|||||||
openChannels = {}
|
openChannels = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
disknet.send = function(channel, message)
|
disknet.send = function(channel, message, recipient)
|
||||||
local valid, grr = checkValidChannel(channel)
|
local valid, grr = checkValidChannel(channel)
|
||||||
if valid then
|
if valid then
|
||||||
if not fs.exists(fs.combine(disknet.mainPath, tostring(channel))) then
|
if not fs.exists(fs.combine(disknet.mainPath, tostring(channel))) then
|
||||||
@ -109,6 +109,7 @@ disknet.send = function(channel, message)
|
|||||||
uniqueID = uniqueID,
|
uniqueID = uniqueID,
|
||||||
messageID = math.random(1, 2^31 - 1),
|
messageID = math.random(1, 2^31 - 1),
|
||||||
channel = channel,
|
channel = channel,
|
||||||
|
recipient = recipient,
|
||||||
message = message,
|
message = message,
|
||||||
}
|
}
|
||||||
if #contents > maximumBufferSize then
|
if #contents > maximumBufferSize then
|
||||||
@ -172,13 +173,15 @@ disknet.receive = function(channel)
|
|||||||
if not output then
|
if not output then
|
||||||
for look = 1, #contents do
|
for look = 1, #contents do
|
||||||
if (contents[look].uniqueID ~= uniqueID) and (not msgCheckList[contents[look].messageID]) then
|
if (contents[look].uniqueID ~= uniqueID) and (not msgCheckList[contents[look].messageID]) then
|
||||||
if getTime() - (contents[look].time or 0) <= 0.001 then
|
if (not conetnts[look].recipient) or contents[look].recipient == yourID then
|
||||||
msgCheckList[contents[look].messageID] = true
|
if getTime() - (contents[look].time or 0) <= 0.001 then
|
||||||
output = {}
|
msgCheckList[contents[look].messageID] = true
|
||||||
for k,v in pairs(contents[look]) do
|
output = {}
|
||||||
output[k] = v
|
for k,v in pairs(contents[look]) do
|
||||||
|
output[k] = v
|
||||||
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user