diff options
Diffstat (limited to 'apworld/regions.py')
-rw-r--r-- | apworld/regions.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/apworld/regions.py b/apworld/regions.py index 1c8e672..fe2c99b 100644 --- a/apworld/regions.py +++ b/apworld/regions.py | |||
@@ -1,6 +1,7 @@ | |||
1 | from typing import TYPE_CHECKING | 1 | from typing import TYPE_CHECKING |
2 | 2 | ||
3 | from BaseClasses import Region | 3 | from BaseClasses import Region, ItemClassification, Entrance |
4 | from .items import Lingo2Item | ||
4 | from .locations import Lingo2Location | 5 | from .locations import Lingo2Location |
5 | from .player_logic import AccessRequirements | 6 | from .player_logic import AccessRequirements |
6 | from .rules import make_location_lambda | 7 | from .rules import make_location_lambda |
@@ -18,6 +19,12 @@ def create_region(room, world: "Lingo2World") -> Region: | |||
18 | new_location.access_rule = make_location_lambda(location.reqs, world) | 19 | new_location.access_rule = make_location_lambda(location.reqs, world) |
19 | new_region.locations.append(new_location) | 20 | new_region.locations.append(new_location) |
20 | 21 | ||
22 | for event_name, item_name in world.player_logic.event_loc_item_by_room.get(room.id, {}).items(): | ||
23 | new_location = Lingo2Location(world.player, event_name, None, new_region) | ||
24 | event_item = Lingo2Item(item_name, ItemClassification.progression, None, world.player) | ||
25 | new_location.place_locked_item(event_item) | ||
26 | new_region.locations.append(new_location) | ||
27 | |||
21 | return new_region | 28 | return new_region |
22 | 29 | ||
23 | 30 | ||
@@ -73,6 +80,13 @@ def create_regions(world: "Lingo2World"): | |||
73 | connection_name = f"{connection_name} (via panel {panel.name})" | 80 | connection_name = f"{connection_name} (via panel {panel.name})" |
74 | 81 | ||
75 | if from_region in regions and to_region in regions: | 82 | if from_region in regions and to_region in regions: |
76 | regions[from_region].connect(regions[to_region], connection_name, make_location_lambda(reqs, world)) | 83 | connection = Entrance(world.player, connection_name, regions[from_region]) |
84 | connection.access_rule = make_location_lambda(reqs, world) | ||
85 | |||
86 | regions[from_region].exits.append(connection) | ||
87 | connection.connect(regions[to_region]) | ||
88 | |||
89 | for region in reqs.rooms: | ||
90 | world.multiworld.register_indirect_condition(regions[region], connection) | ||
77 | 91 | ||
78 | world.multiworld.regions += regions.values() | 92 | world.multiworld.regions += regions.values() |