mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Merge branch 'wip' into testing
This commit is contained in:
@@ -29,10 +29,12 @@ end
|
|||||||
|
|
||||||
--- This is used to update all the guis of conected players, good idea to use our thread system as it as nested for loops
|
--- This is used to update all the guis of conected players, good idea to use our thread system as it as nested for loops
|
||||||
-- @usage Gui.left.update()
|
-- @usage Gui.left.update()
|
||||||
-- @tparam string frame this is the name of a frame if you only want to update one
|
-- @tparam[opt] string frame this is the name of a frame if you only want to update one
|
||||||
function left.update(frame)
|
-- @param[opt] players the player to update for, if not given all players are updated, can be one player
|
||||||
|
function left.update(frame,players)
|
||||||
if not Server or not Server._thread then
|
if not Server or not Server._thread then
|
||||||
for _,player in pairs(game.connected_players) do
|
local players = is_type(players,'table') and #players > 0 and {unpack(players)} or is_type(players,'table') and {players} or game.connected_players
|
||||||
|
for _,player in pairs(players) do
|
||||||
local frames = Gui._get_data('left') or {}
|
local frames = Gui._get_data('left') or {}
|
||||||
if frame then frames = {[frame]=frames[frame]} or {} end
|
if frame then frames = {[frame]=frames[frame]} or {} end
|
||||||
for name,left in pairs(frames) do
|
for name,left in pairs(frames) do
|
||||||
@@ -45,8 +47,9 @@ function left.update(frame)
|
|||||||
else
|
else
|
||||||
local frames = Gui._get_data('left') or {}
|
local frames = Gui._get_data('left') or {}
|
||||||
if frame then frames = {[frame]=frames[frame]} or {} end
|
if frame then frames = {[frame]=frames[frame]} or {} end
|
||||||
|
local players = is_type(players,'table') and #players > 0 and {unpack(players)} or is_type(players,'table') and {players} or game.connected_players
|
||||||
Server.new_thread{
|
Server.new_thread{
|
||||||
data={players=game.connected_players,frames=frames}
|
data={players=players,frames=frames}
|
||||||
}:on_event('tick',function(thread)
|
}:on_event('tick',function(thread)
|
||||||
if #thread.data.players == 0 then thread:close() return end
|
if #thread.data.players == 0 then thread:close() return end
|
||||||
local player = table.remove(thread.data.players,1)
|
local player = table.remove(thread.data.players,1)
|
||||||
|
|||||||
Reference in New Issue
Block a user