SNIClient: Let clients based on SNIClient monitor packages via on_package method (#3093)
This commit is contained in:
parent
07e896508c
commit
3204680662
|
@ -244,6 +244,9 @@ class SNIContext(CommonContext):
|
||||||
# this will no longer be needed.
|
# this will no longer be needed.
|
||||||
async_start(self.send_msgs([{"cmd": "LocationScouts", "locations": list(new_locations)}]))
|
async_start(self.send_msgs([{"cmd": "LocationScouts", "locations": list(new_locations)}]))
|
||||||
|
|
||||||
|
if self.client_handler is not None:
|
||||||
|
self.client_handler.on_package(self, cmd, args)
|
||||||
|
|
||||||
def run_gui(self) -> None:
|
def run_gui(self) -> None:
|
||||||
from kvui import GameManager
|
from kvui import GameManager
|
||||||
|
|
||||||
|
|
|
@ -86,3 +86,7 @@ class SNIClient(abc.ABC, metaclass=AutoSNIClientRegister):
|
||||||
async def deathlink_kill_player(self, ctx: SNIContext) -> None:
|
async def deathlink_kill_player(self, ctx: SNIContext) -> None:
|
||||||
""" override this with implementation to kill player """
|
""" override this with implementation to kill player """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def on_package(self, ctx: SNIContext, cmd: str, args: Dict[str, Any]) -> None:
|
||||||
|
""" override this with code to handle packages from the server """
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue