Archived
Prevent games from starting with only one player
release-tag / release-image (push) Successful in 17s
release-tag / release-image (push) Successful in 17s
Disabled with DEV_MODE=TRUE env var Fixes #9
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""Handles communication between one WebSocket tunnel and the game"""
|
||||
|
||||
import os
|
||||
from typing import Callable, Any, TYPE_CHECKING, Awaitable
|
||||
from pydantic import ValidationError
|
||||
|
||||
@@ -165,10 +166,12 @@ class ClientController:
|
||||
but the game isn't yet started"""
|
||||
if message.type == "ready":
|
||||
self.player.ready = bool(message.data)
|
||||
await self.player.notify_update()
|
||||
if all(p.ready for p in self.game_controller.game.players):
|
||||
await self.game_controller.start_game()
|
||||
else:
|
||||
await self.player.notify_update()
|
||||
if ("DEV_MODE" in os.environ) or len(
|
||||
self.game_controller.game.players
|
||||
) > 1:
|
||||
await self.game_controller.start_game()
|
||||
|
||||
@vibe_check(Message)
|
||||
async def game_context(self, message: Message) -> None:
|
||||
|
||||
Reference in New Issue
Block a user