hide bad rooms
This commit is contained in:
parent
87896298f3
commit
1ac37f9039
@ -31,7 +31,7 @@ games: List[Game] = []
|
|||||||
online_players = 0
|
online_players = 0
|
||||||
|
|
||||||
def advertise_lobbies():
|
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.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
|
@sio.event
|
||||||
@ -253,6 +253,11 @@ def chat_message(sid, msg):
|
|||||||
eventlet.sleep(0.3)
|
eventlet.sleep(0.3)
|
||||||
else:
|
else:
|
||||||
sio.emit('chat_message', room=sid, data={'color': f'','text':f'{msg} bad format'})
|
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]
|
elif '/ddc' in msg and ses.game.started: # debug destroy cards usage: [/ddc *] [/ddc username]
|
||||||
cmd = msg.split()
|
cmd = msg.split()
|
||||||
if len(cmd) == 2:
|
if len(cmd) == 2:
|
||||||
|
@ -44,6 +44,7 @@ class Game:
|
|||||||
self.characters_to_distribute = 2 # personaggi da dare a inizio partita
|
self.characters_to_distribute = 2 # personaggi da dare a inizio partita
|
||||||
self.debug = self.name == 'debug'
|
self.debug = self.name == 'debug'
|
||||||
self.is_changing_pwd = False
|
self.is_changing_pwd = False
|
||||||
|
self.is_hidden = False
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
print('resetting lobby')
|
print('resetting lobby')
|
||||||
|
Loading…
Reference in New Issue
Block a user