@@ -24,6 +24,27 @@ local maxPlayers = GlobalState.MaxPlayers
2424local  playerPositions  =  {}
2525local  queueSize  =  0 
2626
27+ --- @param  license  string 
28+ local  function  enqueue (license )
29+     queueSize  +=  1 
30+     playerPositions [license ] =  queueSize 
31+ end 
32+ 
33+ --- @param  license  string 
34+ local  function  dequeue (license )
35+     local  pos  =  playerPositions [license ]
36+ 
37+     queueSize  -=  1 
38+     playerPositions [license ] =  nil 
39+ 
40+     --  decrease the positions of players who are after the current player in queue
41+     for  k , v  in  pairs (playerPositions ) do 
42+         if  v  >  pos  then 
43+             playerPositions [k ] -=  1 
44+         end 
45+     end 
46+ end 
47+ 
2748--- Map of player licenses that passed the queue and are downloading server content.
2849--- Needs to be saved because these players won't be part of regular player counts such as `GetNumPlayerIndices`.
2950--- @type  table<string ,  true> 
@@ -46,27 +67,6 @@ local function removePlayerJoining(license)
4667    joiningPlayers [license ] =  nil 
4768end 
4869
49- --- @param  license  string 
50- local  function  enqueue (license )
51-     queueSize  +=  1 
52-     playerPositions [license ] =  queueSize 
53- end 
54- 
55- --- @param  license  string 
56- local  function  dequeue (license )
57-     local  pos  =  playerPositions [license ]
58- 
59-     queueSize  -=  1 
60-     playerPositions [license ] =  nil 
61- 
62-     --  decrease the positions of players who are after the current player in queue
63-     for  k , v  in  pairs (playerPositions ) do 
64-         if  v  >  pos  then 
65-             playerPositions [k ] -=  1 
66-         end 
67-     end 
68- end 
69- 
7070--- @param  source  Source 
7171--- @param  license  string 
7272--- @param  deferrals  Deferrals 
0 commit comments