Network: implement new packet: ConnectUpdate
This commit is contained in:
parent
0e0cc0ad16
commit
e64d5c5f17
|
@ -830,8 +830,7 @@ async def game_watcher(ctx: Context):
|
||||||
else:
|
else:
|
||||||
ctx.tags -= {"DeathLink"}
|
ctx.tags -= {"DeathLink"}
|
||||||
if old_tags != ctx.tags and ctx.server and not ctx.server.socket.closed:
|
if old_tags != ctx.tags and ctx.server and not ctx.server.socket.closed:
|
||||||
snes_logger.info("Forcing reconnect to set DeathLink state.")
|
await ctx.send_msgs([{"cmd": "ConnectUpdate", "tags": ctx.tags}])
|
||||||
await ctx.disconnect() # set correct 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()
|
||||||
|
|
|
@ -1258,7 +1258,15 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict):
|
||||||
await ctx.send_msgs(client, [{"cmd": "DataPackage",
|
await ctx.send_msgs(client, [{"cmd": "DataPackage",
|
||||||
"data": network_data_package}])
|
"data": network_data_package}])
|
||||||
elif client.auth:
|
elif client.auth:
|
||||||
if cmd == 'Sync':
|
if cmd == "ConnectUpdate":
|
||||||
|
if not args:
|
||||||
|
await ctx.send_msgs(client, [{'cmd': 'InvalidPacket', "type": "arguments", 'text': cmd}])
|
||||||
|
return
|
||||||
|
|
||||||
|
if "tags" in args:
|
||||||
|
client.tags = args["tags"]
|
||||||
|
|
||||||
|
elif cmd == 'Sync':
|
||||||
items = get_received_items(ctx, client.team, client.slot)
|
items = get_received_items(ctx, client.team, client.slot)
|
||||||
if items:
|
if items:
|
||||||
client.send_index = len(items)
|
client.send_index = len(items)
|
||||||
|
|
Loading…
Reference in New Issue