mirror of
https://github.com/imezx/Warp.git
synced 2025-04-24 15:10:03 +00:00
1.0.8
This commit is contained in:
parent
7519839dd1
commit
5b0d4ee690
4 changed files with 29 additions and 21 deletions
BIN
Warp.rbxm
BIN
Warp.rbxm
Binary file not shown.
|
@ -99,13 +99,12 @@ end
|
|||
function ClientProcess.start()
|
||||
RunService.PostSimulation:Connect(function()
|
||||
for Identifier: string, data: any in unreliableClientQueue do
|
||||
if #data > 0 then
|
||||
if #data == 0 then continue end
|
||||
if clientRatelimit[Identifier](#data) then
|
||||
UnreliableEvent:FireServer(Buffer.revert(Identifier), data)
|
||||
end
|
||||
table.clear(data)
|
||||
end
|
||||
end
|
||||
for Identifier: string, data: any in clientQueue do
|
||||
if #data > 0 then
|
||||
if clientRatelimit[Identifier](#data) then
|
||||
|
@ -131,9 +130,9 @@ function ClientProcess.start()
|
|||
if #queueIn[Identifier] > 0 then
|
||||
for _, packedDatas: any in queueIn[Identifier] do
|
||||
if #packedDatas == 0 then continue end
|
||||
for _, v: any in packedDatas do
|
||||
for _, fn: any in clientCallback[Identifier] do
|
||||
Spawn(fn, table.unpack(v))
|
||||
for i=1,math.min(1e3, #packedDatas) do
|
||||
Spawn(fn, table.unpack(packedDatas[i] or {}))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -142,8 +141,10 @@ function ClientProcess.start()
|
|||
if #queueInRequest[1][Identifier] > 0 then
|
||||
for idx, packetDatas: any in queueInRequest[1][Identifier] do
|
||||
if #packetDatas == 0 then continue end
|
||||
for _, packetData in packetDatas do
|
||||
for _, fn: any in clientCallback[Identifier] do
|
||||
for i=1,math.min(1e3, #packetDatas) do
|
||||
local packetData = packetDatas[i]
|
||||
if not packetData then continue end
|
||||
Spawn(function()
|
||||
local requestReturn = { fn(table.unpack(packetData[2])) }
|
||||
table.insert(queueOutRequest[2][Identifier], { packetData[1], requestReturn })
|
||||
|
@ -157,10 +158,12 @@ function ClientProcess.start()
|
|||
for _, packetDatas: any in queueInRequest[2][Identifier] do
|
||||
for _, packetData in packetDatas do
|
||||
if #packetData == 1 then continue end
|
||||
for idx, clientRequest in clientRequestQueue[Identifier] do
|
||||
for y=1, math.min(1e3, #clientRequestQueue[Identifier]) do
|
||||
local clientRequest = clientRequestQueue[Identifier][y]
|
||||
if not clientRequest then continue end
|
||||
if clientRequest[1] == packetData[1] then
|
||||
Spawn(clientRequest[2], table.unpack(packetData[2]))
|
||||
table.remove(clientRequestQueue[Identifier], idx)
|
||||
table.remove(clientRequestQueue[Identifier], y)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
|
@ -173,9 +173,9 @@ function ServerProcess.start()
|
|||
if #queueIn[Identifier][player] > 0 then
|
||||
for _, packedDatas: any in queueIn[Identifier][player] do
|
||||
if #packedDatas == 0 then continue end
|
||||
for _, v: any in packedDatas do
|
||||
for _, fn: any in serverCallback[Identifier] do
|
||||
Spawn(fn, player, table.unpack(v))
|
||||
for i=1,math.min(1e3, #packedDatas) do
|
||||
Spawn(fn, player, table.unpack(packedDatas[i] or {}))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -184,8 +184,10 @@ function ServerProcess.start()
|
|||
if #queueInRequest[1][Identifier][player] > 0 then
|
||||
for idx, packetDatas: any in queueInRequest[1][Identifier][player] do
|
||||
if #packetDatas == 0 then continue end
|
||||
for _, packetData in packetDatas do
|
||||
for _, fn: any in serverCallback[Identifier] do
|
||||
for i=1,math.min(1e3, #packetDatas) do
|
||||
local packetData = packetDatas[i]
|
||||
if not packetData then continue end
|
||||
Spawn(function()
|
||||
local requestReturn = { fn(player, table.unpack(packetData[2])) }
|
||||
table.insert(queueOutRequest[2][Identifier][player], { packetData[1], requestReturn })
|
||||
|
@ -197,12 +199,15 @@ function ServerProcess.start()
|
|||
end
|
||||
if #queueInRequest[2][Identifier][player] > 0 then
|
||||
for _, packetDatas: any in queueInRequest[2][Identifier][player] do
|
||||
for _, packetData in packetDatas do
|
||||
for idx, packetData in packetDatas do
|
||||
if #packetData == 1 then continue end
|
||||
for idx, serverRequest in serverRequestQueue[Identifier][player] do
|
||||
for y=1, math.min(1e3, #serverRequestQueue[Identifier][player]) do
|
||||
local serverRequest = serverRequestQueue[Identifier][player][y]
|
||||
if not serverRequest then continue end
|
||||
if serverRequest[1] == packetData[1] then
|
||||
Spawn(serverRequest[2], table.unpack(packetData[2]))
|
||||
table.remove(serverRequestQueue[Identifier], idx)
|
||||
table.remove(packetDatas, idx)
|
||||
table.remove(serverRequestQueue[Identifier][player], y)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ local SerInt = 0
|
|||
local Event = require(script.Parent.Parent.Event).Reliable
|
||||
local Assert = require(script.Parent.Assert)
|
||||
|
||||
return function(Identifier: string): string
|
||||
return function(Identifier: string): number
|
||||
Assert(typeof(Identifier) == "string", "Identifier must be a string type.")
|
||||
Assert(SerInt < 255, "reached max 255 identifiers.")
|
||||
if RunService:IsServer() then
|
||||
|
|
Loading…
Reference in a new issue