change callback to filter by player instead of client

This commit is contained in:
2024-04-20 09:20:33 +02:00
parent 792f18e274
commit e400a7e770
6 changed files with 18 additions and 38 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ from controller import GameControllerInterface, ClientControllerInterface
from netcode.models import Message, LoginMessage
from model import Player
from model import Player, Team
def vibe_check(t):
@@ -69,9 +69,9 @@ class ClientController(ClientControllerInterface):
self,
notification_type: str,
data: dict,
client_filter: Callable[["ClientController"], Any] = lambda x: True,
player_filter: Callable[[Player], Any] = lambda x: True,
):
if client_filter(self):
if hasattr(self, "player") is False or player_filter(self.player):
await self.send(
Message(type=notification_type, data_type="object", data=data)
)