fix disconnect on character selection

This commit is contained in:
Alberto Xamin 2020-12-26 10:48:59 +01:00
parent 07f30c36e6
commit 637f05e37f
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
2 changed files with 6 additions and 1 deletions

View File

@ -83,6 +83,8 @@ def get_me(sid, room):
de_games[0].notify_all()
sio.emit('role', room=sid, data=json.dumps(bot.role, default=lambda o: o.__dict__))
bot.notify_self()
if len(bot.available_characters) > 0:
bot.set_available_character(bot.available_characters)
else: #spectate
de_games[0].spectators.append(sio.get_session(sid))
sio.get_session(sid).game = de_games[0]

View File

@ -374,7 +374,10 @@ class Game:
if self.disconnect_bot and self.started:
player.is_bot = True
eventlet.sleep(15) # he may reconnect
player.bot_spin()
if player.is_bot:
if len(player.available_characters) > 0:
player.set_available_character(player.available_characters)
player.bot_spin()
else:
self.player_death(player=player, disconnected=True)
# else: