This commit is contained in:
Eden Kirin
2023-05-12 20:39:31 +02:00
parent 21a7f111b2
commit afbb3d7436
3 changed files with 12 additions and 14 deletions

View File

@ -179,14 +179,14 @@ class GameEngine:
) )
def on_purchase_timer_tick(time_left) -> None: def on_purchase_timer_tick(time_left) -> None:
logging.info(f"Product selection countdown timer tick, time left: {time_left}") logging.info(
f"Product selection countdown timer tick, time left: {time_left}"
)
def on_purchase_timer_done() -> None: def on_purchase_timer_done() -> None:
logging.info("Ding ding! Product selection countdown timer timeout") logging.info("Ding ding! Product selection countdown timer timeout")
self._purchase_countdown_timer = None self._purchase_countdown_timer = None
asyncio.run( asyncio.run(self.ws_server.send_product_selection_timeout_message())
self.ws_server.send_product_selection_timeout_message()
)
self.game_state = GameState.RUNNING self.game_state = GameState.RUNNING
asyncio.run(self.send_game_dump()) asyncio.run(self.send_game_dump())

View File

@ -14,6 +14,13 @@ BOARD_DUMP_CHARS: dict[ObjectType, str] = {
} }
def create_random_position(board_width: int, board_height: int) -> Position:
return Position(
x=random.randint(0, board_width - 1),
y=random.randint(0, board_height - 1),
)
@dataclass @dataclass
class LayerObject: class LayerObject:
type_: ObjectType type_: ObjectType
@ -102,10 +109,3 @@ class BoardLayout:
) )
) )
return layers return layers
def create_random_position(board_width: int, board_height: int) -> Position:
return Position(
x=random.randint(0, board_width - 1),
y=random.randint(0, board_height - 1),
)

View File

@ -10,9 +10,7 @@ from settings import settings
class InactivityWatchdog(Thread): class InactivityWatchdog(Thread):
def __init__( def __init__(self, players: PlayerList, ws_server: WSServer = None) -> None:
self, players: PlayerList, ws_server: WSServer = None
) -> None:
self.players = players self.players = players
self.ws_server = ws_server self.ws_server = ws_server
self.stop_event = Event() self.stop_event = Event()