From 96163c640830545fed9b5a133b6989273e8d3a30 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 23 Feb 2024 10:32:14 +0100 Subject: [PATCH] Core: provide convenience getters on World class (#2827) --- worlds/AutoWorld.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/worlds/AutoWorld.py b/worlds/AutoWorld.py index e8d48df58c53..b282c7deb8bd 100644 --- a/worlds/AutoWorld.py +++ b/worlds/AutoWorld.py @@ -15,7 +15,7 @@ if TYPE_CHECKING: import random - from BaseClasses import MultiWorld, Item, Location, Tutorial + from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance from . import GamesPackage from settings import Group @@ -458,6 +458,16 @@ def remove(self, state: "CollectionState", item: "Item") -> bool: def create_filler(self) -> "Item": return self.create_item(self.get_filler_item_name()) + # convenience methods + def get_location(self, location_name: str) -> "Location": + return self.multiworld.get_location(location_name, self.player) + + def get_entrance(self, entrance_name: str) -> "Entrance": + return self.multiworld.get_entrance(entrance_name, self.player) + + def get_region(self, region_name: str) -> "Region": + return self.multiworld.get_region(region_name, self.player) + @classmethod def get_data_package_data(cls) -> "GamesPackage": sorted_item_name_groups = {