diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-27 21:06:32 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-27 21:06:32 -0400 |
| commit | 53e0509fcb20cc824e3fe5b3d3a826f09fc9c166 (patch) | |
| tree | d83573fe2209122cc1c87d0a60ab22e6b20d4ec9 /apworld/regions.py | |
| parent | b0f474bee1c8e1111f7542bf4985136d9aedf340 (diff) | |
| download | lingo2-archipelago-53e0509fcb20cc824e3fe5b3d3a826f09fc9c166.tar.gz lingo2-archipelago-53e0509fcb20cc824e3fe5b3d3a826f09fc9c166.tar.bz2 lingo2-archipelago-53e0509fcb20cc824e3fe5b3d3a826f09fc9c166.zip | |
Treat worldports as items for tracker
Diffstat (limited to 'apworld/regions.py')
| -rw-r--r-- | apworld/regions.py | 29 |
1 files changed, 25 insertions, 4 deletions
| diff --git a/apworld/regions.py b/apworld/regions.py index a7d9a1c..9f44682 100644 --- a/apworld/regions.py +++ b/apworld/regions.py | |||
| @@ -32,6 +32,22 @@ def create_locations(room, new_region: Region, world: "Lingo2World", regions: di | |||
| 32 | new_location.place_locked_item(event_item) | 32 | new_location.place_locked_item(event_item) |
| 33 | new_region.locations.append(new_location) | 33 | new_region.locations.append(new_location) |
| 34 | 34 | ||
| 35 | if world.for_tracker and world.options.shuffle_worldports: | ||
| 36 | for port_id in room.ports: | ||
| 37 | port = world.static_logic.objects.ports[port_id] | ||
| 38 | if port.no_shuffle: | ||
| 39 | continue | ||
| 40 | |||
| 41 | new_location = Lingo2Location(world.player, f"Worldport {port.id} Entered", None, new_region) | ||
| 42 | new_location.port_id = port.id | ||
| 43 | |||
| 44 | if port.HasField("required_door"): | ||
| 45 | new_location.access_rule = \ | ||
| 46 | make_location_lambda(world.player_logic.get_door_open_reqs(port.required_door), world, regions) | ||
| 47 | |||
| 48 | new_region.locations.append(new_location) | ||
| 49 | |||
| 50 | |||
| 35 | def create_regions(world: "Lingo2World"): | 51 | def create_regions(world: "Lingo2World"): |
| 36 | regions = { | 52 | regions = { |
| 37 | "Menu": Region("Menu", world.player, world.multiworld) | 53 | "Menu": Region("Menu", world.player, world.multiworld) |
| @@ -52,7 +68,6 @@ def create_regions(world: "Lingo2World"): | |||
| 52 | 68 | ||
| 53 | regions["Menu"].connect(regions["The Entry - Starting Room"], "Start Game") | 69 | regions["Menu"].connect(regions["The Entry - Starting Room"], "Start Game") |
| 54 | 70 | ||
| 55 | # TODO: The requirements of the opposite trigger also matter. | ||
| 56 | for connection in world.static_logic.objects.connections: | 71 | for connection in world.static_logic.objects.connections: |
| 57 | if connection.roof_access and not world.options.daedalus_roof_access: | 72 | if connection.roof_access and not world.options.daedalus_roof_access: |
| 58 | continue | 73 | continue |
| @@ -176,11 +191,17 @@ def connect_ports_from_ut(port_pairings: dict[int, int], world: "Lingo2World"): | |||
| 176 | 191 | ||
| 177 | connection = Entrance(world.player, f"{from_region_name} - {from_port.name}", from_region) | 192 | connection = Entrance(world.player, f"{from_region_name} - {from_port.name}", from_region) |
| 178 | 193 | ||
| 194 | reqs = AccessRequirements() | ||
| 179 | if from_port.HasField("required_door"): | 195 | if from_port.HasField("required_door"): |
| 180 | door_reqs = world.player_logic.get_door_open_reqs(from_port.required_door) | 196 | reqs = world.player_logic.get_door_open_reqs(from_port.required_door).copy() |
| 181 | connection.access_rule = make_location_lambda(door_reqs, world, None) | ||
| 182 | 197 | ||
| 183 | for region in door_reqs.get_referenced_rooms(): | 198 | if world.for_tracker: |
| 199 | reqs.items.add(f"Worldport {fpid} Entered") | ||
| 200 | |||
| 201 | if not reqs.is_empty(): | ||
| 202 | connection.access_rule = make_location_lambda(reqs, world, None) | ||
| 203 | |||
| 204 | for region in reqs.get_referenced_rooms(): | ||
| 184 | world.multiworld.register_indirect_condition(world.multiworld.get_region(region, world.player), | 205 | world.multiworld.register_indirect_condition(world.multiworld.get_region(region, world.player), |
| 185 | connection) | 206 | connection) |
| 186 | 207 | ||
