From 78eca37276b3cfe866f0ed8976b72f37c7fd8b3f Mon Sep 17 00:00:00 2001 From: Scipio Wright Date: Wed, 31 Jan 2024 20:35:04 -0500 Subject: [PATCH] Fixes for various settings --- worlds/tunic/__init__.py | 68 ++------------------------------------ worlds/tunic/er_scripts.py | 6 ++-- 2 files changed, 6 insertions(+), 68 deletions(-) diff --git a/worlds/tunic/__init__.py b/worlds/tunic/__init__.py index 92a35659355b..7dfb5c09c690 100644 --- a/worlds/tunic/__init__.py +++ b/worlds/tunic/__init__.py @@ -72,7 +72,7 @@ def generate_early(self) -> None: self.options.maskless.value = passthrough["maskless"] self.options.hexagon_quest.value = passthrough["hexagon_quest"] self.options.entrance_rando.value = passthrough["entrance_rando"] - + if self.options.start_with_sword and "Sword" not in self.options.start_inventory: self.options.start_inventory.value["Sword"] = 1 @@ -178,39 +178,6 @@ def create_regions(self) -> None: for portal1, portal2 in portal_pairs.items(): self.tunic_portal_pairs[portal1.scene_destination()] = portal2.scene_destination() - if hasattr(self.multiworld, "re_gen_passthrough"): - if "TUNIC" in self.multiworld.re_gen_passthrough: - passthrough = self.multiworld.re_gen_passthrough["TUNIC"] - from BaseClasses import Entrance - from .er_data import portal_mapping - entrance_dict: Dict[str, Entrance] = {entrance.name: entrance - for region in self.multiworld.get_regions(self.player) - for entrance in region.entrances} - slot_portals: Dict[str, str] = passthrough["Entrance Rando"] - self.tunic_portal_pairs = slot_portals - for portal1, portal2 in slot_portals.items(): - portal_name1: str = "" - portal_name2: str = "" - entrance1 = None - entrance2 = None - for portal in portal_mapping: - if portal.scene_destination() == portal1: - portal_name1 = portal.name - if portal.scene_destination() == portal2: - portal_name2 = portal.name - - for entrance_name, entrance in entrance_dict.items(): - if entrance_name.startswith(portal_name1): - entrance1 = entrance - if entrance_name.startswith(portal_name2): - entrance2 = entrance - if entrance1 is None: - raise Exception("entrance1 not found, portal1 is " + portal1) - if entrance2 is None: - raise Exception("entrance2 not found, portal2 is " + portal2) - entrance1.connected_region = entrance2.parent_region - entrance2.connected_region = entrance1.parent_region - self.er_portal_hints = portal_hints else: @@ -296,36 +263,7 @@ def fill_slot_data(self) -> Dict[str, Any]: return slot_data # for the universal tracker, doesn't get called in standard gen - def interpret_slot_data(self, slot_data: Dict[str, Any]) -> Dict[str, Any]: - # swapping entrances around so the mapping matches what was generated - if slot_data["entrance_rando"]: - from BaseClasses import Entrance - from .er_data import portal_mapping - entrance_dict: Dict[str, Entrance] = {entrance.name: entrance - for region in self.multiworld.get_regions(self.player) - for entrance in region.entrances} - slot_portals: Dict[str, str] = slot_data["Entrance Rando"] - for portal1, portal2 in slot_portals.items(): - portal_name1: str = "" - portal_name2: str = "" - entrance1 = None - entrance2 = None - for portal in portal_mapping: - if portal.scene_destination() == portal1: - portal_name1 = portal.name - if portal.scene_destination() == portal2: - portal_name2 = portal.name - - for entrance_name, entrance in entrance_dict.items(): - if entrance_name.startswith(portal_name1): - entrance1 = entrance - if entrance_name.startswith(portal_name2): - entrance2 = entrance - if entrance1 is None: - raise Exception("entrance1 not found, portal1 is " + portal1) - if entrance2 is None: - raise Exception("entrance2 not found, portal2 is " + portal2) - entrance1.connected_region = entrance2.parent_region - entrance2.connected_region = entrance1.parent_region + @staticmethod + def interpret_slot_data(slot_data: Dict[str, Any]) -> Dict[str, Any]: # returning slot_data so it regens, giving it back in multiworld.re_gen_passthrough return slot_data diff --git a/worlds/tunic/er_scripts.py b/worlds/tunic/er_scripts.py index 829e67a1527a..32f492fd4b9e 100644 --- a/worlds/tunic/er_scripts.py +++ b/worlds/tunic/er_scripts.py @@ -253,7 +253,7 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: two_plus.remove(portal1) dead_ends.remove(portal2) - if world.options.fixed_shop: + if world.options.fixed_shop and not hasattr(world.multiworld, "re_gen_passthrough"): fixed_shop = True portal1 = None for portal in two_plus: @@ -352,7 +352,7 @@ def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]: portal_pairs[portal1] = portal2 if len(two_plus) == 1: - raise Exception("two plus had an odd number of portals, investigate this") + raise Exception("two plus had an odd number of portals, investigate this. last portal is " + two_plus[0].name) return portal_pairs @@ -525,7 +525,7 @@ def create_plando_connections(plando_connections: List[PlandoConnection], dead_e if p_exit == portal.name: portal2 = portal break - if exit == "Shop Portal": + if p_exit == "Shop Portal": portal2 = Portal(name="Shop Portal", region=f"Shop Entrance {shop_num}", destination="Previous Region_") shop_num += 1 else: