mirror of
				https://github.com/imezx/Warp.git
				synced 2025-11-03 19:49:16 +00:00 
			
		
		
		
	minor improvement
This commit is contained in:
		
							parent
							
								
									4cd0f3f2cf
								
							
						
					
					
						commit
						0fb349fe0f
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -47,6 +47,9 @@ local queueOutRequest: {
 | 
			
		|||
local logger: {
 | 
			
		||||
	[string]: boolean
 | 
			
		||||
} = {}
 | 
			
		||||
local players: {
 | 
			
		||||
	Player
 | 
			
		||||
} = {}
 | 
			
		||||
 | 
			
		||||
queueInRequest[1] = {}
 | 
			
		||||
queueInRequest[2] = {}
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +61,7 @@ local UnreliableEvent = Event.Unreliable
 | 
			
		|||
local RequestEvent = Event.Request
 | 
			
		||||
 | 
			
		||||
local function initializeEachPlayer(player: Player)
 | 
			
		||||
	players = Players:GetPlayers()
 | 
			
		||||
	if not player then return end
 | 
			
		||||
	if not queueOut[player] then
 | 
			
		||||
		queueOut[player] = {}
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +89,9 @@ local function initializeEachPlayer(player: Player)
 | 
			
		|||
end
 | 
			
		||||
 | 
			
		||||
Players.PlayerAdded:Connect(initializeEachPlayer)
 | 
			
		||||
Players.PlayerRemoving:Connect(function()
 | 
			
		||||
	players = Players:GetPlayers()
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
function ServerProcess.insertQueue(Identifier: string, reliable: boolean, player: Player, ...: any)
 | 
			
		||||
	if not reliable then
 | 
			
		||||
| 
						 | 
				
			
			@ -190,8 +197,8 @@ function ServerProcess.start()
 | 
			
		|||
				table.clear(data)
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
		for _, player: Player in ipairs(Players:GetPlayers()) do
 | 
			
		||||
			if not queueOut[player] then continue end
 | 
			
		||||
		for _, player: Player in ipairs(players) do
 | 
			
		||||
			if not player or not queueOut[player] then continue end
 | 
			
		||||
			for Identifier: string, data: any in queueOut[player] do
 | 
			
		||||
				if #data == 0 then continue end
 | 
			
		||||
				ReliableEvent:FireClient(player, Buffer.revert(Identifier), data)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue