Move Death Link change tag to Common Client
This commit is contained in:
parent
1f61d8322c
commit
1f5d1532e3
|
@ -315,6 +315,15 @@ class CommonContext():
|
||||||
self.input_requests -= 1
|
self.input_requests -= 1
|
||||||
self.keep_alive_task.cancel()
|
self.keep_alive_task.cancel()
|
||||||
|
|
||||||
|
async def update_death_link(self, death_link):
|
||||||
|
old_tags = self.tags.copy()
|
||||||
|
if death_link:
|
||||||
|
self.tags.add("DeathLink")
|
||||||
|
else:
|
||||||
|
self.tags -= {"DeathLink"}
|
||||||
|
if old_tags != self.tags and self.server and not self.server.socket.closed:
|
||||||
|
await self.send_msgs([{"cmd": "ConnectUpdate", "tags": self.tags}])
|
||||||
|
|
||||||
|
|
||||||
async def keep_alive(ctx: CommonContext, seconds_between_checks=100):
|
async def keep_alive(ctx: CommonContext, seconds_between_checks=100):
|
||||||
"""some ISPs/network configurations drop TCP connections if no payload is sent (ignore TCP-keep-alive)
|
"""some ISPs/network configurations drop TCP connections if no payload is sent (ignore TCP-keep-alive)
|
||||||
|
|
|
@ -905,14 +905,7 @@ async def game_watcher(ctx: Context):
|
||||||
death_link = await snes_read(ctx, DEATH_LINK_ACTIVE_ADDR if ctx.game == GAME_ALTTP else
|
death_link = await snes_read(ctx, DEATH_LINK_ACTIVE_ADDR if ctx.game == GAME_ALTTP else
|
||||||
SM_DEATH_LINK_ACTIVE_ADDR, 1)
|
SM_DEATH_LINK_ACTIVE_ADDR, 1)
|
||||||
if death_link:
|
if death_link:
|
||||||
death_link = bool(death_link[0] & 0b1)
|
await ctx.update_death_link(bool(death_link[0] & 0b1))
|
||||||
old_tags = ctx.tags.copy()
|
|
||||||
if death_link:
|
|
||||||
ctx.tags.add("DeathLink")
|
|
||||||
else:
|
|
||||||
ctx.tags -= {"DeathLink"}
|
|
||||||
if old_tags != ctx.tags and ctx.server and not ctx.server.socket.closed:
|
|
||||||
await ctx.send_msgs([{"cmd": "ConnectUpdate", "tags": ctx.tags}])
|
|
||||||
if not ctx.prev_rom or ctx.prev_rom != ctx.rom:
|
if not ctx.prev_rom or ctx.prev_rom != ctx.rom:
|
||||||
ctx.locations_checked = set()
|
ctx.locations_checked = set()
|
||||||
ctx.locations_scouted = set()
|
ctx.locations_scouted = set()
|
||||||
|
|
Loading…
Reference in New Issue