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"""
|
"""Handles communication between one WebSocket tunnel and the game"""
|
||||||
|
|
||||||
|
import os
|
||||||
from typing import Callable, Any, TYPE_CHECKING, Awaitable
|
from typing import Callable, Any, TYPE_CHECKING, Awaitable
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
@@ -165,10 +166,12 @@ class ClientController:
|
|||||||
but the game isn't yet started"""
|
but the game isn't yet started"""
|
||||||
if message.type == "ready":
|
if message.type == "ready":
|
||||||
self.player.ready = bool(message.data)
|
self.player.ready = bool(message.data)
|
||||||
|
await self.player.notify_update()
|
||||||
if all(p.ready for p in self.game_controller.game.players):
|
if all(p.ready for p in self.game_controller.game.players):
|
||||||
await self.game_controller.start_game()
|
if ("DEV_MODE" in os.environ) or len(
|
||||||
else:
|
self.game_controller.game.players
|
||||||
await self.player.notify_update()
|
) > 1:
|
||||||
|
await self.game_controller.start_game()
|
||||||
|
|
||||||
@vibe_check(Message)
|
@vibe_check(Message)
|
||||||
async def game_context(self, message: Message) -> None:
|
async def game_context(self, message: Message) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user