diff --git a/UndertaleClient.py b/UndertaleClient.py index d30cb8446261..fd95c6972567 100644 --- a/UndertaleClient.py +++ b/UndertaleClient.py @@ -360,7 +360,7 @@ async def process_undertale_cmd(ctx: UndertaleContext, cmd: str, args: dict): elif cmd == "Bounced": tags = args.get("tags", []) if "Online" in tags: - data = args.get("worlds/undertale/data", {}) + data = args.get("data", {}) if data["player"] != ctx.slot and data["player"] is not None: filename = f"FRISK" + str(data["player"]) + ".playerspot" with open(os.path.join(ctx.save_game_folder, filename), "w") as f: @@ -406,34 +406,40 @@ async def game_watcher(ctx: UndertaleContext): ctx.syncing = False if ctx.got_deathlink: ctx.got_deathlink = False - with open(os.path.join(ctx.save_game_folder, "/WelcomeToTheDead.youDied"), "w") as f: + with open(os.path.join(ctx.save_game_folder, "WelcomeToTheDead.youDied"), "w") as f: f.close() sending = [] victory = False found_routes = 0 for root, dirs, files in os.walk(path): for file in files: - if "DontBeMad.mad" in file and "DeathLink" in ctx.tags: + if "DontBeMad.mad" in file: os.remove(root+"/"+file) - await ctx.send_death() + if "DeathLink" in ctx.tags: + await ctx.send_death() if "scout" == file: sending = [] - with open(root+"/"+file, "r") as f: - lines = f.readlines() + try: + with open(root+"/"+file, "r") as f: + lines = f.readlines() for l in lines: if ctx.server_locations.__contains__(int(l)+12000): sending = sending + [int(l)+12000] - await ctx.send_msgs([{"cmd": "LocationScouts", "locations": sending, - "create_as_hint": int(2)}]) - os.remove(root+"/"+file) + await ctx.send_msgs([{"cmd": "LocationScouts", "locations": sending, + "create_as_hint": int(2)}]) + finally: + os.remove(root+"/"+file) if "check.spot" in file: sending = [] - with open(root+"/"+file, "r") as f: - lines = f.readlines() + try: + with open(root+"/"+file, "r") as f: + lines = f.readlines() for l in lines: sending = sending+[(int(l))+12000] - message = [{"cmd": "LocationChecks", "locations": sending}] - await ctx.send_msgs(message) + message = [{"cmd": "LocationChecks", "locations": sending}] + await ctx.send_msgs(message) + finally: + pass if "victory" in file and str(ctx.route) in file: victory = True if ".playerspot" in file and "Online" not in ctx.tags: diff --git a/worlds/undertale/Rules.py b/worlds/undertale/Rules.py index 4c8d4f4f75e1..21ae8216c65a 100644 --- a/worlds/undertale/Rules.py +++ b/worlds/undertale/Rules.py @@ -1,4 +1,4 @@ -from ..generic.Rules import set_rule, add_rule +from worlds.generic.Rules import set_rule, add_rule from BaseClasses import MultiWorld, CollectionState diff --git a/worlds/undertale/__init__.py b/worlds/undertale/__init__.py index bf2a14901aec..e0cc7034eb24 100644 --- a/worlds/undertale/__init__.py +++ b/worlds/undertale/__init__.py @@ -13,12 +13,13 @@ def run_client(): print('running undertale client') - from UndertaleClient import main # lazy import + from .UndertaleClient import main # lazy import p = Process(target=main) p.start() components.append(Component("Undertale Client", "UndertaleClient")) +# components.append(Component("Undertale Client", func=run_client)) def data_path(file_name: str): diff --git a/worlds/undertale/data/patch.bsdiff b/worlds/undertale/data/patch.bsdiff index 67d9dd1e1135..0924da2908bc 100644 Binary files a/worlds/undertale/data/patch.bsdiff and b/worlds/undertale/data/patch.bsdiff differ diff --git a/worlds/undertale/docs/en_Undertale.md b/worlds/undertale/docs/en_Undertale.md index 1cb9698fa3c5..511f32403bb8 100644 --- a/worlds/undertale/docs/en_Undertale.md +++ b/worlds/undertale/docs/en_Undertale.md @@ -13,7 +13,7 @@ the Nicecream bought in Hotland, and anything you cannot get in your chosen rout ## When the player receives an item, what happens? When the player receives an item in Undertale, it will go into their inventory if they have space, otherwise it will -wait until they do have space. That includes items that don't appear in your inventory. +wait until they do have space. ## What is the victory condition?