hide bad rooms

This commit is contained in:
Alberto Xamin 2021-06-19 14:00:42 +02:00
parent 87896298f3
commit 1ac37f9039
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
2 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,7 @@ games: List[Game] = []
online_players = 0
def advertise_lobbies():
sio.emit('lobbies', room='lobby', data=[{'name': g.name, 'players': len(g.players), 'locked': g.password != ''} for g in games if not g.started and len(g.players) < 10])
sio.emit('lobbies', room='lobby', data=[{'name': g.name, 'players': len(g.players), 'locked': g.password != ''} for g in games if not g.started and len(g.players) < 10 and not g.is_hidden])
sio.emit('spectate_lobbies', room='lobby', data=[{'name': g.name, 'players': len(g.players), 'locked': g.password != ''} for g in games if g.started])
@sio.event
@ -253,6 +253,11 @@ def chat_message(sid, msg):
eventlet.sleep(0.3)
else:
sio.emit('chat_message', room=sid, data={'color': f'','text':f'{msg} bad format'})
elif '/hide' in msg:
cmd = msg.split()
ses.game.is_hidden = not ses.game.is_hidden
advertise_lobbies()
sio.emit('chat_message', room=sid, data={'color': f'','text':f'{msg} room hidden: {ses.game.is_hidden}'})
elif '/ddc' in msg and ses.game.started: # debug destroy cards usage: [/ddc *] [/ddc username]
cmd = msg.split()
if len(cmd) == 2:

View File

@ -44,6 +44,7 @@ class Game:
self.characters_to_distribute = 2 # personaggi da dare a inizio partita
self.debug = self.name == 'debug'
self.is_changing_pwd = False
self.is_hidden = False
def reset(self):
print('resetting lobby')