Player state

This commit is contained in:
Eden Kirin
2023-03-30 13:09:23 +02:00
parent 8a48d61dc9
commit ecffdc5d1e
11 changed files with 84 additions and 25 deletions

View File

@ -42,5 +42,6 @@ class Settings:
board: BoardSettings
inacivity_watchdog: InactivityWatchdogSettings
ws_server: WSServerSettings
purchase_timeout: int = 10 # seconds
log_level: int = logging.INFO
debug: Optional[DebugSettings] = None

View File

@ -3,6 +3,8 @@ import uuid
from dataclasses import dataclass, field
from typing import Optional
from hopper.enums import PlayerState
@dataclass
class Position:
@ -20,9 +22,9 @@ class Player:
last_seen: datetime.datetime = field(
default_factory=lambda: datetime.datetime.now()
)
state: PlayerState = PlayerState.CREATED
active: bool = True
can_be_deactivated: bool = True
reached_destination: bool = False
def reset_timeout(self) -> None:
self.last_seen = datetime.datetime.now()

View File

@ -16,7 +16,7 @@ class LayerDto(BaseModel):
objects: list[LayerObjectDto]
class GameDumpPlayerDto(PlayerDto):
reached_destination: bool
...
class GameDumpDto(BaseModel):