diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-22 12:05:18 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-22 12:05:18 -0400 |
commit | 424f5d4a830fb43f86c76d73d795412890d55bc2 (patch) | |
tree | e949a30d7d683cb45d3c0dcfd8f391a769c3dc7f /apworld/__init__.py | |
parent | bc3f90b6bdfdb651570a7b3f0e80fea19db14974 (diff) | |
download | lingo2-archipelago-424f5d4a830fb43f86c76d73d795412890d55bc2.tar.gz lingo2-archipelago-424f5d4a830fb43f86c76d73d795412890d55bc2.tar.bz2 lingo2-archipelago-424f5d4a830fb43f86c76d73d795412890d55bc2.zip |
[Apworld] Added worldport shuffle
Diffstat (limited to 'apworld/__init__.py')
-rw-r--r-- | apworld/__init__.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/apworld/__init__.py b/apworld/__init__.py index f1de503..2213e33 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py | |||
@@ -6,7 +6,7 @@ from worlds.AutoWorld import WebWorld, World | |||
6 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS | 6 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS |
7 | from .options import Lingo2Options | 7 | from .options import Lingo2Options |
8 | from .player_logic import Lingo2PlayerLogic | 8 | from .player_logic import Lingo2PlayerLogic |
9 | from .regions import create_regions | 9 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut |
10 | from .static_logic import Lingo2StaticLogic | 10 | from .static_logic import Lingo2StaticLogic |
11 | from .version import APWORLD_VERSION | 11 | from .version import APWORLD_VERSION |
12 | 12 | ||
@@ -46,12 +46,25 @@ class Lingo2World(World): | |||
46 | 46 | ||
47 | player_logic: Lingo2PlayerLogic | 47 | player_logic: Lingo2PlayerLogic |
48 | 48 | ||
49 | port_pairings: dict[int, int] | ||
50 | |||
49 | def generate_early(self): | 51 | def generate_early(self): |
50 | self.player_logic = Lingo2PlayerLogic(self) | 52 | self.player_logic = Lingo2PlayerLogic(self) |
53 | self.port_pairings = {} | ||
51 | 54 | ||
52 | def create_regions(self): | 55 | def create_regions(self): |
53 | create_regions(self) | 56 | create_regions(self) |
54 | 57 | ||
58 | def connect_entrances(self): | ||
59 | if self.options.shuffle_worldports: | ||
60 | if hasattr(self.multiworld, "re_gen_passthrough") and "Lingo 2" in self.multiworld.re_gen_passthrough: | ||
61 | slot_value = self.multiworld.re_gen_passthrough["Lingo 2"]["port_pairings"] | ||
62 | self.port_pairings = {int(fp): int(tp) for fp, tp in slot_value.items()} | ||
63 | |||
64 | connect_ports_from_ut(self.port_pairings, self) | ||
65 | else: | ||
66 | shuffle_entrances(self) | ||
67 | |||
55 | from Utils import visualize_regions | 68 | from Utils import visualize_regions |
56 | 69 | ||
57 | visualize_regions(self.multiworld.get_region("Menu", self.player), "my_world.puml") | 70 | visualize_regions(self.multiworld.get_region("Menu", self.player), "my_world.puml") |
@@ -100,17 +113,29 @@ class Lingo2World(World): | |||
100 | "shuffle_gallery_paintings", | 113 | "shuffle_gallery_paintings", |
101 | "shuffle_letters", | 114 | "shuffle_letters", |
102 | "shuffle_symbols", | 115 | "shuffle_symbols", |
116 | "shuffle_worldports", | ||
103 | "strict_cyan_ending", | 117 | "strict_cyan_ending", |
104 | "strict_purple_ending", | 118 | "strict_purple_ending", |
105 | "victory_condition", | 119 | "victory_condition", |
106 | ] | 120 | ] |
107 | 121 | ||
108 | slot_data = { | 122 | slot_data: dict[str, object] = { |
109 | **self.options.as_dict(*slot_options), | 123 | **self.options.as_dict(*slot_options), |
110 | "version": [self.static_logic.get_data_version(), APWORLD_VERSION], | 124 | "version": [self.static_logic.get_data_version(), APWORLD_VERSION], |
111 | } | 125 | } |
112 | 126 | ||
127 | if self.options.shuffle_worldports: | ||
128 | slot_data["port_pairings"] = self.port_pairings | ||
129 | |||
113 | return slot_data | 130 | return slot_data |
114 | 131 | ||
115 | def get_filler_item_name(self) -> str: | 132 | def get_filler_item_name(self) -> str: |
116 | return "A Job Well Done" | 133 | return "A Job Well Done" |
134 | |||
135 | # for the universal tracker, doesn't get called in standard gen | ||
136 | # docs: https://github.com/FarisTheAncient/Archipelago/blob/tracker/worlds/tracker/docs/re-gen-passthrough.md | ||
137 | @staticmethod | ||
138 | def interpret_slot_data(slot_data: dict[str, object]) -> dict[str, object]: | ||
139 | # returning slot_data so it regens, giving it back in multiworld.re_gen_passthrough | ||
140 | # we are using re_gen_passthrough over modifying the world here due to complexities with ER | ||
141 | return slot_data | ||