SNIClient, ALttP: expose death_text to SNI client, add message to alttp (#1793)
This commit is contained in:
parent
5f5c48e17b
commit
d2c541c51c
|
@ -207,12 +207,12 @@ class SNIContext(CommonContext):
|
||||||
self.killing_player_task = asyncio.create_task(deathlink_kill_player(self))
|
self.killing_player_task = asyncio.create_task(deathlink_kill_player(self))
|
||||||
super(SNIContext, self).on_deathlink(data)
|
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
|
# in this state we only care about triggering a death send
|
||||||
if self.death_state == DeathState.alive:
|
if self.death_state == DeathState.alive:
|
||||||
if currently_dead:
|
if currently_dead:
|
||||||
self.death_state = DeathState.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
|
# in this state we care about confirming a kill, to move state to dead
|
||||||
elif self.death_state == DeathState.killing_player:
|
elif self.death_state == DeathState.killing_player:
|
||||||
# this is being handled in deathlink_kill_player(ctx) already
|
# this is being handled in deathlink_kill_player(ctx) already
|
||||||
|
|
|
@ -520,7 +520,8 @@ class ALTTPSNIClient(SNIClient):
|
||||||
gamemode = await snes_read(ctx, WRAM_START + 0x10, 1)
|
gamemode = await snes_read(ctx, WRAM_START + 0x10, 1)
|
||||||
if "DeathLink" in ctx.tags and gamemode and ctx.last_death_link + 1 < time.time():
|
if "DeathLink" in ctx.tags and gamemode and ctx.last_death_link + 1 < time.time():
|
||||||
currently_dead = gamemode[0] in DEATH_MODES
|
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)
|
gameend = await snes_read(ctx, SAVEDATA_START + 0x443, 1)
|
||||||
game_timer = await snes_read(ctx, SAVEDATA_START + 0x42E, 4)
|
game_timer = await snes_read(ctx, SAVEDATA_START + 0x42E, 4)
|
||||||
|
|
Loading…
Reference in New Issue