From 53e0509fcb20cc824e3fe5b3d3a826f09fc9c166 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 27 Sep 2025 21:06:32 -0400 Subject: Treat worldports as items for tracker --- apworld/regions.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'apworld/regions.py') 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 new_location.place_locked_item(event_item) new_region.locations.append(new_location) + if world.for_tracker and world.options.shuffle_worldports: + for port_id in room.ports: + port = world.static_logic.objects.ports[port_id] + if port.no_shuffle: + continue + + new_location = Lingo2Location(world.player, f"Worldport {port.id} Entered", None, new_region) + new_location.port_id = port.id + + if port.HasField("required_door"): + new_location.access_rule = \ + make_location_lambda(world.player_logic.get_door_open_reqs(port.required_door), world, regions) + + new_region.locations.append(new_location) + + def create_regions(world: "Lingo2World"): regions = { "Menu": Region("Menu", world.player, world.multiworld) @@ -52,7 +68,6 @@ def create_regions(world: "Lingo2World"): regions["Menu"].connect(regions["The Entry - Starting Room"], "Start Game") - # TODO: The requirements of the opposite trigger also matter. for connection in world.static_logic.objects.connections: if connection.roof_access and not world.options.daedalus_roof_access: continue @@ -176,11 +191,17 @@ def connect_ports_from_ut(port_pairings: dict[int, int], world: "Lingo2World"): connection = Entrance(world.player, f"{from_region_name} - {from_port.name}", from_region) + reqs = AccessRequirements() if from_port.HasField("required_door"): - door_reqs = world.player_logic.get_door_open_reqs(from_port.required_door) - connection.access_rule = make_location_lambda(door_reqs, world, None) + reqs = world.player_logic.get_door_open_reqs(from_port.required_door).copy() - for region in door_reqs.get_referenced_rooms(): + if world.for_tracker: + reqs.items.add(f"Worldport {fpid} Entered") + + if not reqs.is_empty(): + connection.access_rule = make_location_lambda(reqs, world, None) + + for region in reqs.get_referenced_rooms(): world.multiworld.register_indirect_condition(world.multiworld.get_region(region, world.player), connection) -- cgit 1.4.1