Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNIClient, ALttP: Add "death_text" to SNIContext's handle_deathlink_state #1793

Merged
merged 11 commits into from
Oct 31, 2023
4 changes: 2 additions & 2 deletions SNIClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ def on_deathlink(self, data: typing.Dict[str, typing.Any]) -> None:
self.killing_player_task = asyncio.create_task(deathlink_kill_player(self))
super(SNIContext, self).on_deathlink(data)

async def handle_deathlink_state(self, currently_dead: bool) -> None:
async def handle_deathlink_state(self, currently_dead: bool, death_text: str = "") -> None:
# in this state we only care about triggering a death send
if self.death_state == DeathState.alive:
if currently_dead:
self.death_state = DeathState.dead
await self.send_death()
await self.send_death(death_text)
# in this state we care about confirming a kill, to move state to dead
elif self.death_state == DeathState.killing_player:
# this is being handled in deathlink_kill_player(ctx) already
Expand Down
3 changes: 2 additions & 1 deletion worlds/alttp/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ async def game_watcher(self, ctx):
gamemode = await snes_read(ctx, WRAM_START + 0x10, 1)
if "DeathLink" in ctx.tags and gamemode and ctx.last_death_link + 1 < time.time():
currently_dead = gamemode[0] in DEATH_MODES
await ctx.handle_deathlink_state(currently_dead)
await ctx.handle_deathlink_state(currently_dead,
ctx.player_names[ctx.slot] + " ran out of hearts." if ctx.slot else "")

gameend = await snes_read(ctx, SAVEDATA_START + 0x443, 1)
game_timer = await snes_read(ctx, SAVEDATA_START + 0x42E, 4)
Expand Down
Loading