Make placement of dungeon items faster
This commit is contained in:
@@ -2701,8 +2701,8 @@ class Location(object):
|
|||||||
self.recursion_count = 0
|
self.recursion_count = 0
|
||||||
self.staleness_count = 0
|
self.staleness_count = 0
|
||||||
self.locked = False
|
self.locked = False
|
||||||
self.real = True
|
self.real = not crystal
|
||||||
self.always_allow = lambda item, state: False
|
self.always_allow = None
|
||||||
self.access_rule = lambda state: True
|
self.access_rule = lambda state: True
|
||||||
self.verbose_rule = None
|
self.verbose_rule = None
|
||||||
self.item_rule = lambda item: True
|
self.item_rule = lambda item: True
|
||||||
@@ -2716,7 +2716,7 @@ class Location(object):
|
|||||||
def can_fill(self, state, item, check_access=True):
|
def can_fill(self, state, item, check_access=True):
|
||||||
if not self.valid_multiworld(state, item):
|
if not self.valid_multiworld(state, item):
|
||||||
return False
|
return False
|
||||||
return self.always_allow(state, item) or (self.parent_region.can_fill(item) and self.item_rule(item) and (not check_access or self.can_reach(state)))
|
return (self.always_allow and self.always_allow(state, item)) or (self.parent_region.can_fill(item) and self.item_rule(item) and (not check_access or self.can_reach(state)))
|
||||||
|
|
||||||
def valid_multiworld(self, state, item):
|
def valid_multiworld(self, state, item):
|
||||||
if self.type == LocationType.Pot and self.player != item.player:
|
if self.type == LocationType.Pot and self.player != item.player:
|
||||||
|
|||||||
6
Fill.py
6
Fill.py
@@ -183,9 +183,13 @@ def fill_restrictive(world, base_state, locations, itempool, key_pool=None, sing
|
|||||||
spot_to_fill = None
|
spot_to_fill = None
|
||||||
|
|
||||||
item_locations = filter_locations(item_to_place, locations, world, vanilla)
|
item_locations = filter_locations(item_to_place, locations, world, vanilla)
|
||||||
|
# for dungeon items, it is worth reducing this list further by excluding locations outside of the respective dungeon
|
||||||
|
reduced_locations = item_locations if not item_to_place.dungeon else \
|
||||||
|
[location for location in item_locations if not location.always_allow and location.parent_region.can_fill(item_to_place)]
|
||||||
|
|
||||||
verify(item_to_place, item_locations, maximum_exploration_state, single_player_placement,
|
verify(item_to_place, item_locations, maximum_exploration_state, single_player_placement,
|
||||||
perform_access_check, key_pool, world)
|
perform_access_check, key_pool, world)
|
||||||
for location in item_locations:
|
for location in reduced_locations:
|
||||||
spot_to_fill = verify_spot_to_fill(location, item_to_place, maximum_exploration_state,
|
spot_to_fill = verify_spot_to_fill(location, item_to_place, maximum_exploration_state,
|
||||||
single_player_placement, perform_access_check, key_pool, world)
|
single_player_placement, perform_access_check, key_pool, world)
|
||||||
if spot_to_fill:
|
if spot_to_fill:
|
||||||
|
|||||||
Reference in New Issue
Block a user