mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-07 15:13:52 -08:00
Undertale: Use check_locations helper to avoid redundant sends (#5993)
This commit is contained in:
@@ -300,11 +300,8 @@ async def process_undertale_cmd(ctx: UndertaleContext, cmd: str, args: dict):
|
|||||||
if start_index == 0:
|
if start_index == 0:
|
||||||
ctx.items_received = []
|
ctx.items_received = []
|
||||||
elif start_index != len(ctx.items_received):
|
elif start_index != len(ctx.items_received):
|
||||||
sync_msg = [{"cmd": "Sync"}]
|
await ctx.check_locations(ctx.locations_checked)
|
||||||
if ctx.locations_checked:
|
await ctx.send_msgs([{"cmd": "Sync"}])
|
||||||
sync_msg.append({"cmd": "LocationChecks",
|
|
||||||
"locations": list(ctx.locations_checked)})
|
|
||||||
await ctx.send_msgs(sync_msg)
|
|
||||||
if start_index == len(ctx.items_received):
|
if start_index == len(ctx.items_received):
|
||||||
counter = -1
|
counter = -1
|
||||||
placedWeapon = 0
|
placedWeapon = 0
|
||||||
@@ -473,10 +470,9 @@ async def game_watcher(ctx: UndertaleContext):
|
|||||||
for file in files:
|
for file in files:
|
||||||
if ".item" in file:
|
if ".item" in file:
|
||||||
os.remove(os.path.join(root, file))
|
os.remove(os.path.join(root, file))
|
||||||
sync_msg = [{"cmd": "Sync"}]
|
await ctx.check_locations(ctx.locations_checked)
|
||||||
if ctx.locations_checked:
|
await ctx.send_msgs([{"cmd": "Sync"}])
|
||||||
sync_msg.append({"cmd": "LocationChecks", "locations": list(ctx.locations_checked)})
|
|
||||||
await ctx.send_msgs(sync_msg)
|
|
||||||
ctx.syncing = False
|
ctx.syncing = False
|
||||||
if ctx.got_deathlink:
|
if ctx.got_deathlink:
|
||||||
ctx.got_deathlink = False
|
ctx.got_deathlink = False
|
||||||
@@ -511,7 +507,7 @@ async def game_watcher(ctx: UndertaleContext):
|
|||||||
for l in lines:
|
for l in lines:
|
||||||
sending = sending+[(int(l.rstrip('\n')))+12000]
|
sending = sending+[(int(l.rstrip('\n')))+12000]
|
||||||
finally:
|
finally:
|
||||||
await ctx.send_msgs([{"cmd": "LocationChecks", "locations": sending}])
|
await ctx.check_locations(sending)
|
||||||
if "victory" in file and str(ctx.route) in file:
|
if "victory" in file and str(ctx.route) in file:
|
||||||
victory = True
|
victory = True
|
||||||
if ".playerspot" in file and "Online" not in ctx.tags:
|
if ".playerspot" in file and "Online" not in ctx.tags:
|
||||||
|
|||||||
Reference in New Issue
Block a user