From bdddd3c0de83405d44e54ac723299d6b2c784065 Mon Sep 17 00:00:00 2001 From: compiling <8335770+compiling@users.noreply.github.com> Date: Sun, 8 Nov 2020 12:33:31 +1100 Subject: [PATCH] Set location's parent_region when moving it. Fix copy_world to handle moved locations --- Main.py | 3 +++ PotShuffle.py | 1 + 2 files changed, 4 insertions(+) diff --git a/Main.py b/Main.py index 7015a501..c06e4e6d 100644 --- a/Main.py +++ b/Main.py @@ -421,6 +421,9 @@ def copy_world(world): copied_region = ret.get_region(region.name, region.player) copied_region.is_light_world = region.is_light_world copied_region.is_dark_world = region.is_dark_world + copied_region.locations = [copy.copy(location) for location in region.locations] + for location in copied_region.locations: + location.parent_region = copied_region for entrance in region.entrances: ret.get_entrance(entrance.name, entrance.player).connect(copied_region) diff --git a/PotShuffle.py b/PotShuffle.py index 1b24edf7..5fb99a86 100644 --- a/PotShuffle.py +++ b/PotShuffle.py @@ -314,6 +314,7 @@ def shuffle_pots(world, player): key = next(location for location in world.get_region(old_pot.room, player).locations if location.name in key_drop_data) world.get_region(old_pot.room, player).locations.remove(key) world.get_region(new_pot.room, player).locations.append(key) + key.parent_region = world.get_region(new_pot.room, player) elif new_pot.item == PotItem.Switch and (new_pot.flags & PotFlags.SwitchLogicChange): if new_pot.room == 'PoD Basement Ledge': basement = world.get_region(old_pot.room, player)