diff --git a/TODO.md b/TODO.md index e69de29..a20ee93 100644 --- a/TODO.md +++ b/TODO.md @@ -0,0 +1,2 @@ +# Credits +- Byron Knoll \ No newline at end of file diff --git a/server/game/lobby.py b/server/game/lobby.py index 589d475..e43021c 100644 --- a/server/game/lobby.py +++ b/server/game/lobby.py @@ -153,10 +153,15 @@ class LobbyManager(ClientManager): extras["youBet"] = False if message: + print("Creating game task...") game = asyncio.create_task(self.maybe_start_game()) + print("Sending message...") await self.send(sender, message, extras) + print("Awaiting game...") await game + print("LOBBY: Message handled.") + def which_player(self, sid) -> Player: sender: Optional[Player] = None for name, metadata in self.metadata.items(): @@ -169,6 +174,18 @@ class LobbyManager(ClientManager): async def send_waiting_for(self, player: Player): game = self.game_with(player) + # FIXME: Seems to block here, game doesn't move past Asking for... + # BET + # MSGIN| c38442e3785f4c2eb13e95368bfaa151 (Sumatran Elephant): BET. + # Lobby| Player Sumatran Elephant just announced bet=Ace of ♥|Ace of ♣|Ace of ♦|Ace of ♠. + # LOBBY: Message handled. + # received event "message" from c38442e3785f4c2eb13e95368bfaa151 [/] + # INFO: received event "message" from c38442e3785f4c2eb13e95368bfaa151 [/] + # INFO: 127.0.0.1:51452 - "POST /socket.io/?EIO=3&transport=polling&t=N6J1ZS7&sid=3c5e8962c4db465aaf2fd916bea2acc9 HTTP/1.1" 200 OK + # [WS] Message MENTEUR + # MSGIN| 3c5e8962c4db465aaf2fd916bea2acc9 (Chihuahua): MENTEUR. + # LOBBY: Message handled. + # received await self.send(player, MessageToPlayer.YourTurn, extras={"bet": game.current_bet.json()}) for p in [p for p in game.players if p != player]: await self.send(p, MessageToPlayer.Waiting, extras={"waitingFor": p.name}) diff --git a/server/ws.py b/server/ws.py index 6d67f95..ce65b4a 100644 --- a/server/ws.py +++ b/server/ws.py @@ -26,6 +26,7 @@ class ClientPlayer(Player): print(f"Asking Client {self.name} for announce...") while not metadata.last_announce and metadata.fresh_announce: + print("While, send_waiting_for") await lobby.send_waiting_for(self) print(f"Still waiting for {self.name}'s announce...") sleep(2)