Skip to content

Commit

Permalink
Core: Add some more world convenience methods (#3021)
Browse files Browse the repository at this point in the history
* Add some more convenience methods

* Typing stuff

* Rename the method

* beauxq's suggestions

* Back to Push Precollected
  • Loading branch information
NewSoupVi authored Dec 15, 2024
1 parent d1823a2 commit 728d249
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion worlds/AutoWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import time
from random import Random
from dataclasses import make_dataclass
from typing import (Any, Callable, ClassVar, Dict, FrozenSet, List, Mapping, Optional, Set, TextIO, Tuple,
from typing import (Any, Callable, ClassVar, Dict, FrozenSet, Iterable, List, Mapping, Optional, Set, TextIO, Tuple,
TYPE_CHECKING, Type, Union)

from Options import item_and_loc_options, ItemsAccessibility, OptionGroup, PerGameCommonOptions
Expand Down Expand Up @@ -534,12 +534,24 @@ def create_filler(self) -> "Item":
def get_location(self, location_name: str) -> "Location":
return self.multiworld.get_location(location_name, self.player)

def get_locations(self) -> "Iterable[Location]":
return self.multiworld.get_locations(self.player)

def get_entrance(self, entrance_name: str) -> "Entrance":
return self.multiworld.get_entrance(entrance_name, self.player)

def get_entrances(self) -> "Iterable[Entrance]":
return self.multiworld.get_entrances(self.player)

def get_region(self, region_name: str) -> "Region":
return self.multiworld.get_region(region_name, self.player)

def get_regions(self) -> "Iterable[Region]":
return self.multiworld.get_regions(self.player)

def push_precollected(self, item: Item) -> None:
self.multiworld.push_precollected(item)

@property
def player_name(self) -> str:
return self.multiworld.get_player_name(self.player)
Expand Down

0 comments on commit 728d249

Please sign in to comment.