Skip to content

Commit

Permalink
Core: provide convenience getters on World class (ArchipelagoMW#2827)
Browse files Browse the repository at this point in the history
  • Loading branch information
Berserker66 authored Feb 23, 2024
1 parent afa5ce4 commit 96163c6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion worlds/AutoWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 96163c6

Please sign in to comment.