Merge pull request #3 from Bonta0/multiworld_31

MultiClient: fix roominfo sort
This commit is contained in:
Fabian Dill
2020-01-15 03:45:38 +01:00
committed by GitHub
2 changed files with 7 additions and 10 deletions

View File

@@ -39,12 +39,6 @@ class Context:
self.clients = []
self.received_items = {}
def get_room_info(ctx : Context):
return {
'password': ctx.password is not None,
'players': [(client.name, client.team, client.slot) for client in ctx.clients if client.auth]
}
async def send_msgs(websocket, msgs):
if not websocket or not websocket.open or websocket.closed:
return
@@ -100,7 +94,10 @@ async def server(websocket, path, ctx : Context):
ctx.clients.remove(client)
async def on_client_connected(ctx : Context, client : Client):
await send_msgs(client.socket, [['RoomInfo', get_room_info(ctx)]])
await send_msgs(client.socket, [['RoomInfo', {
'password': ctx.password is not None,
'players': [(client.team, client.slot, client.name) for client in ctx.clients if client.auth]
}]])
async def on_client_disconnected(ctx : Context, client : Client):
if client.auth: