diff options
Diffstat (limited to 'apworld/__init__.py')
| -rw-r--r-- | apworld/__init__.py | 31 |
1 files changed, 24 insertions, 7 deletions
| diff --git a/apworld/__init__.py b/apworld/__init__.py index 1af31c0..3d2f075 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py | |||
| @@ -4,6 +4,7 @@ Archipelago init file for Lingo 2 | |||
| 4 | from typing import ClassVar | 4 | from typing import ClassVar |
| 5 | 5 | ||
| 6 | from BaseClasses import ItemClassification, Item, Tutorial | 6 | from BaseClasses import ItemClassification, Item, Tutorial |
| 7 | from Options import OptionError | ||
| 7 | from settings import Group, UserFilePath | 8 | from settings import Group, UserFilePath |
| 8 | from worlds.AutoWorld import WebWorld, World | 9 | from worlds.AutoWorld import WebWorld, World |
| 9 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS | 10 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS |
| @@ -11,8 +12,7 @@ from .options import Lingo2Options | |||
| 11 | from .player_logic import Lingo2PlayerLogic | 12 | from .player_logic import Lingo2PlayerLogic |
| 12 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut | 13 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut |
| 13 | from .static_logic import Lingo2StaticLogic | 14 | from .static_logic import Lingo2StaticLogic |
| 14 | from .version import APWORLD_VERSION | 15 | from worlds.LauncherComponents import Component, Type, components, launch as launch_component, icon_paths |
| 15 | from ..LauncherComponents import Component, Type, components, launch as launch_component, icon_paths | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | class Lingo2WebWorld(WebWorld): | 18 | class Lingo2WebWorld(WebWorld): |
| @@ -34,6 +34,7 @@ class Lingo2Settings(Group): | |||
| 34 | is_exe = True | 34 | is_exe = True |
| 35 | 35 | ||
| 36 | exe_file: ExecutableFile = ExecutableFile() | 36 | exe_file: ExecutableFile = ExecutableFile() |
| 37 | start_game: bool = True | ||
| 37 | 38 | ||
| 38 | 39 | ||
| 39 | class Lingo2World(World): | 40 | class Lingo2World(World): |
| @@ -76,15 +77,18 @@ class Lingo2World(World): | |||
| 76 | if self.options.shuffle_worldports: | 77 | if self.options.shuffle_worldports: |
| 77 | if hasattr(self.multiworld, "re_gen_passthrough") and "Lingo 2" in self.multiworld.re_gen_passthrough: | 78 | if hasattr(self.multiworld, "re_gen_passthrough") and "Lingo 2" in self.multiworld.re_gen_passthrough: |
| 78 | slot_value = self.multiworld.re_gen_passthrough["Lingo 2"]["port_pairings"] | 79 | slot_value = self.multiworld.re_gen_passthrough["Lingo 2"]["port_pairings"] |
| 79 | self.port_pairings = {int(fp): int(tp) for fp, tp in slot_value.items()} | 80 | self.port_pairings = { |
| 81 | self.static_logic.port_id_by_ap_id[int(fp)]: self.static_logic.port_id_by_ap_id[int(tp)] | ||
| 82 | for fp, tp in slot_value.items() | ||
| 83 | } | ||
| 80 | 84 | ||
| 81 | connect_ports_from_ut(self.port_pairings, self) | 85 | connect_ports_from_ut(self.port_pairings, self) |
| 82 | else: | 86 | else: |
| 83 | shuffle_entrances(self) | 87 | shuffle_entrances(self) |
| 84 | 88 | ||
| 85 | from Utils import visualize_regions | 89 | #from Utils import visualize_regions |
| 86 | 90 | ||
| 87 | visualize_regions(self.multiworld.get_region("Menu", self.player), "my_world.puml") | 91 | #visualize_regions(self.multiworld.get_region("Menu", self.player), "my_world.puml") |
| 88 | 92 | ||
| 89 | def create_items(self): | 93 | def create_items(self): |
| 90 | pool = [self.create_item(name) for name in self.player_logic.real_items] | 94 | pool = [self.create_item(name) for name in self.player_logic.real_items] |
| @@ -109,6 +113,11 @@ class Lingo2World(World): | |||
| 109 | for i in range(0, item_difference): | 113 | for i in range(0, item_difference): |
| 110 | pool.append(self.create_item(self.get_filler_item_name())) | 114 | pool.append(self.create_item(self.get_filler_item_name())) |
| 111 | 115 | ||
| 116 | if not any(ItemClassification.progression in item.classification for item in pool): | ||
| 117 | raise OptionError(f"Lingo 2 player {self.player} has no progression items. Please enable at least one " | ||
| 118 | f"option that would add progression gating to your world, such as Shuffle Doors or " | ||
| 119 | f"Shuffle Letters.") | ||
| 120 | |||
| 112 | self.multiworld.itempool += pool | 121 | self.multiworld.itempool += pool |
| 113 | 122 | ||
| 114 | def create_item(self, name: str) -> Item: | 123 | def create_item(self, name: str) -> Item: |
| @@ -124,7 +133,11 @@ class Lingo2World(World): | |||
| 124 | slot_options = [ | 133 | slot_options = [ |
| 125 | "cyan_door_behavior", | 134 | "cyan_door_behavior", |
| 126 | "daedalus_roof_access", | 135 | "daedalus_roof_access", |
| 136 | "enable_gift_maps", | ||
| 137 | "enable_icarus", | ||
| 138 | "endings_requirement", | ||
| 127 | "keyholder_sanity", | 139 | "keyholder_sanity", |
| 140 | "masteries_requirement", | ||
| 128 | "shuffle_control_center_colors", | 141 | "shuffle_control_center_colors", |
| 129 | "shuffle_doors", | 142 | "shuffle_doors", |
| 130 | "shuffle_gallery_paintings", | 143 | "shuffle_gallery_paintings", |
| @@ -138,11 +151,15 @@ class Lingo2World(World): | |||
| 138 | 151 | ||
| 139 | slot_data: dict[str, object] = { | 152 | slot_data: dict[str, object] = { |
| 140 | **self.options.as_dict(*slot_options), | 153 | **self.options.as_dict(*slot_options), |
| 141 | "version": [self.static_logic.get_data_version(), APWORLD_VERSION], | 154 | "version": self.static_logic.get_data_version(), |
| 142 | } | 155 | } |
| 143 | 156 | ||
| 144 | if self.options.shuffle_worldports: | 157 | if self.options.shuffle_worldports: |
| 145 | slot_data["port_pairings"] = self.port_pairings | 158 | def get_port_ap_id(port_id): |
| 159 | return self.static_logic.objects.ports[port_id].ap_id | ||
| 160 | |||
| 161 | slot_data["port_pairings"] = {get_port_ap_id(from_id): get_port_ap_id(to_id) | ||
| 162 | for from_id, to_id in self.port_pairings.items()} | ||
| 146 | 163 | ||
| 147 | return slot_data | 164 | return slot_data |
| 148 | 165 | ||
