@@ -7,6 +7,7 @@ local isfunction = isfunction
77local ProtectedCall = ProtectedCall
88
99pace .StreamQueue = pace .StreamQueue or {}
10+ pace .MaxStreamQueue = 32 -- Max queued outfits per player
1011
1112timer .Create (" pac_check_stream_queue" , 0.1 , 0 , function ()
1213 local item = table.remove (pace .StreamQueue )
@@ -294,18 +295,22 @@ end
294295
295296-- Inserts the given part into the StreamQueue
296297function pace .SubmitPart (data , filter , callback )
297- if istable (data .part ) then
298- pac .dprint (" queuing part %q from %s" , data .part .self .Name , tostring (data .owner ))
299- table.insert (pace .StreamQueue , {
300- data = data ,
301- filter = filter ,
302- callback = callback
303- })
304-
305- return " queue"
298+ if not (istable (data .part ) and IsValid (data .owner )) then return end
299+ local owner = data .owner
300+ local count = 0
301+ for _ , v in ipairs (pace .StreamQueue ) do
302+ if v .data .owner == owner then
303+ if count == pace .MaxStreamQueue then return end
304+ count = count + 1
305+ end
306306 end
307307
308- return pace .SubmitPartNow (data , filter )
308+ pac .dprint (" queuing part %q from %s" , data .part .self .Name , tostring (data .owner ))
309+ table.insert (pace .StreamQueue , {
310+ data = data ,
311+ filter = filter ,
312+ callback = callback
313+ })
309314end
310315
311316-- Inserts the given part into the StreamQueue, and notifies when it completes
407412function pace .ClearOutfit (ply )
408413 local uid = pac .Hash (ply )
409414
410- pace .SubmitPart ({part = " __ALL__" , uid = pac .Hash (ply ), owner = ply })
415+ pace .RemovePart ({part = " __ALL__" , uid = pac .Hash (ply ), owner = ply })
411416 pace .CallHook (" RemoveOutfit" , ply )
412417end
413418
0 commit comments