DeathLink: add support for the cause field

This commit is contained in:
Fabian Dill 2021-11-06 11:19:49 +01:00
parent 30755b2067
commit 720ef936da
2 changed files with 5 additions and 1 deletions

View File

@ -263,6 +263,11 @@ class CommonContext():
def on_deathlink(self, data: dict):
"""Gets dispatched when a new DeathLink is triggered by another linked player."""
self.last_death_link = max(data["time"], self.last_death_link)
text = data.get("cause", "")
if text:
logger.info(f"DeathLink: {text}")
else:
logger.info(f"DeathLink: Received from {data['source']}")
async def send_death(self):
self.last_death_link = time.time()

View File

@ -148,7 +148,6 @@ class Context(CommonContext):
snes_buffered_write(self, WRAM_START + 0x0373, bytes([8]))
asyncio.create_task(snes_flush_writes(self))
self.death_state = True
snes_logger.info(f"Received DeathLink from {data['source']}")
super(Context, self).on_deathlink(data)