from typing import TYPE_CHECKING from BaseClasses import Region from .locations import Lingo2Location if TYPE_CHECKING: from . import Lingo2World def create_region(room, world: "Lingo2World") -> Region: new_region = Region(room.name, world.player, world.multiworld) for location in world.player_logic.locations_by_room.get(room.id, {}): new_location = Lingo2Location(world.player, world.static_logic.location_id_to_name[location.code], location.code, new_region) new_region.locations.append(new_location) return new_region def create_regions(world: "Lingo2World"): regions = { "Menu": Region("Menu", world.player, world.multiworld) } for room in world.static_logic.objects.rooms: regions[room.name] = create_region(room, world) world.multiworld.regions += regions.values()