diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-16 16:59:51 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-16 16:59:51 -0400 |
| commit | 462a547f78080fbd371c318945352bf9a08001bb (patch) | |
| tree | 8ce02c0234461a4b73e45245f02e1a9870239875 /apworld/regions.py | |
| parent | b2b87691af2b9bba227735152abc2d983ed938ab (diff) | |
| download | lingo2-archipelago-462a547f78080fbd371c318945352bf9a08001bb.tar.gz lingo2-archipelago-462a547f78080fbd371c318945352bf9a08001bb.tar.bz2 lingo2-archipelago-462a547f78080fbd371c318945352bf9a08001bb.zip | |
[Apworld] Fix indirect conditions for deep reqs
Diffstat (limited to 'apworld/regions.py')
| -rw-r--r-- | apworld/regions.py | 23 |
1 files changed, 12 insertions, 11 deletions
| diff --git a/apworld/regions.py b/apworld/regions.py index 4f1dd55..fad9bc7 100644 --- a/apworld/regions.py +++ b/apworld/regions.py | |||
| @@ -17,8 +17,7 @@ def create_region(room, world: "Lingo2World") -> Region: | |||
| 17 | def create_locations(room, new_region: Region, world: "Lingo2World", regions: dict[str, Region]): | 17 | def create_locations(room, new_region: Region, world: "Lingo2World", regions: dict[str, Region]): |
| 18 | for location in world.player_logic.locations_by_room.get(room.id, {}): | 18 | for location in world.player_logic.locations_by_room.get(room.id, {}): |
| 19 | reqs = location.reqs.copy() | 19 | reqs = location.reqs.copy() |
| 20 | if new_region.name in reqs.rooms: | 20 | reqs.remove_room(new_region.name) |
| 21 | reqs.rooms.remove(new_region.name) | ||
| 22 | 21 | ||
| 23 | new_location = Lingo2Location(world.player, world.static_logic.location_id_to_name[location.code], | 22 | new_location = Lingo2Location(world.player, world.static_logic.location_id_to_name[location.code], |
| 24 | location.code, new_region) | 23 | location.code, new_region) |
| @@ -58,6 +57,10 @@ def create_regions(world: "Lingo2World"): | |||
| 58 | 57 | ||
| 59 | from_region = world.static_logic.get_room_region_name(connection.from_room) | 58 | from_region = world.static_logic.get_room_region_name(connection.from_room) |
| 60 | to_region = world.static_logic.get_room_region_name(connection.to_room) | 59 | to_region = world.static_logic.get_room_region_name(connection.to_room) |
| 60 | |||
| 61 | if from_region not in regions or to_region not in regions: | ||
| 62 | continue | ||
| 63 | |||
| 61 | connection_name = f"{from_region} -> {to_region}" | 64 | connection_name = f"{from_region} -> {to_region}" |
| 62 | 65 | ||
| 63 | reqs = AccessRequirements() | 66 | reqs = AccessRequirements() |
| @@ -95,17 +98,15 @@ def create_regions(world: "Lingo2World"): | |||
| 95 | connection_name = f"{connection_name} (via panel {panel.name})" | 98 | connection_name = f"{connection_name} (via panel {panel.name})" |
| 96 | 99 | ||
| 97 | reqs.simplify() | 100 | reqs.simplify() |
| 101 | reqs.remove_room(from_region) | ||
| 98 | 102 | ||
| 99 | if from_region in regions and to_region in regions: | 103 | connection = Entrance(world.player, connection_name, regions[from_region]) |
| 100 | connection = Entrance(world.player, connection_name, regions[from_region]) | 104 | connection.access_rule = make_location_lambda(reqs, world, regions) |
| 101 | connection.access_rule = make_location_lambda(reqs, world, regions) | ||
| 102 | 105 | ||
| 103 | regions[from_region].exits.append(connection) | 106 | regions[from_region].exits.append(connection) |
| 104 | connection.connect(regions[to_region]) | 107 | connection.connect(regions[to_region]) |
| 105 | 108 | ||
| 106 | for region in reqs.rooms: | 109 | for region in reqs.get_referenced_rooms(): |
| 107 | if region == from_region: | 110 | world.multiworld.register_indirect_condition(regions[region], connection) |
| 108 | continue | ||
| 109 | world.multiworld.register_indirect_condition(regions[region], connection) | ||
| 110 | 111 | ||
| 111 | world.multiworld.regions += regions.values() | 112 | world.multiworld.regions += regions.values() |
