befort: if a player is disconnected he doesn't have an object after: he have un object with a socket == None
22 lines
520 B
Python
22 lines
520 B
Python
from __future__ import annotations
|
|
|
|
class Position:
|
|
|
|
def __init__(self, position = 0, time: int = 0) -> None:
|
|
self.time = time
|
|
self.position = position
|
|
|
|
def copy(self):
|
|
return Position(self.position, self.time)
|
|
|
|
def to_dict(self):
|
|
|
|
data: dict = {
|
|
"position": self.position,
|
|
"time": self.time,
|
|
}
|
|
|
|
return data
|
|
|
|
def __eq__(self, __value: Position) -> bool:
|
|
return (self.position == __value.position) |