ItemLinks: fix all_state not collecting event locations
This commit is contained in:
parent
de5249f99e
commit
5dbccfcbbd
|
@ -272,6 +272,7 @@ class MultiWorld():
|
||||||
|
|
||||||
def _recache(self):
|
def _recache(self):
|
||||||
"""Rebuild world cache"""
|
"""Rebuild world cache"""
|
||||||
|
self._cached_locations = None
|
||||||
for region in self.regions:
|
for region in self.regions:
|
||||||
player = region.player
|
player = region.player
|
||||||
self._region_cache[player][region.name] = region
|
self._region_cache[player][region.name] = region
|
||||||
|
|
18
Fill.py
18
Fill.py
|
@ -4,7 +4,6 @@ import collections
|
||||||
import itertools
|
import itertools
|
||||||
from collections import Counter, deque
|
from collections import Counter, deque
|
||||||
|
|
||||||
|
|
||||||
from BaseClasses import CollectionState, Location, LocationProgressType, MultiWorld, Item
|
from BaseClasses import CollectionState, Location, LocationProgressType, MultiWorld, Item
|
||||||
|
|
||||||
from worlds.AutoWorld import call_all
|
from worlds.AutoWorld import call_all
|
||||||
|
@ -14,7 +13,7 @@ class FillError(RuntimeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def sweep_from_pool(base_state: CollectionState, itempool=[]):
|
def sweep_from_pool(base_state: CollectionState, itempool: typing.Sequence[Item] = tuple()):
|
||||||
new_state = base_state.copy()
|
new_state = base_state.copy()
|
||||||
for item in itempool:
|
for item in itempool:
|
||||||
new_state.collect(item, True)
|
new_state.collect(item, True)
|
||||||
|
@ -22,8 +21,8 @@ def sweep_from_pool(base_state: CollectionState, itempool=[]):
|
||||||
return new_state
|
return new_state
|
||||||
|
|
||||||
|
|
||||||
def fill_restrictive(world: MultiWorld, base_state: CollectionState, locations, itempool: typing.List[Item],
|
def fill_restrictive(world: MultiWorld, base_state: CollectionState, locations: typing.List[Location],
|
||||||
single_player_placement=False, lock=False):
|
itempool: typing.List[Item], single_player_placement=False, lock=False):
|
||||||
unplaced_items = []
|
unplaced_items = []
|
||||||
placements: typing.List[Location] = []
|
placements: typing.List[Location] = []
|
||||||
|
|
||||||
|
@ -233,7 +232,8 @@ def distribute_items_restrictive(world: MultiWorld):
|
||||||
logging.info(f'Per-Player counts: {print_data})')
|
logging.info(f'Per-Player counts: {print_data})')
|
||||||
|
|
||||||
|
|
||||||
def fast_fill(world: MultiWorld, item_pool: typing.List, fill_locations: typing.List) -> typing.Tuple[typing.List, typing.List]:
|
def fast_fill(world: MultiWorld, item_pool: typing.List, fill_locations: typing.List) -> typing.Tuple[
|
||||||
|
typing.List, typing.List]:
|
||||||
placing = min(len(item_pool), len(fill_locations))
|
placing = min(len(item_pool), len(fill_locations))
|
||||||
for item, location in zip(item_pool, fill_locations):
|
for item, location in zip(item_pool, fill_locations):
|
||||||
world.push_item(location, item, False)
|
world.push_item(location, item, False)
|
||||||
|
@ -502,15 +502,15 @@ def distribute_planned(world: MultiWorld):
|
||||||
block['locations'] = locations
|
block['locations'] = locations
|
||||||
|
|
||||||
if not block['count']:
|
if not block['count']:
|
||||||
block['count'] = (min(len(block['items']), len(block['locations'])) if len(block['locations'])
|
block['count'] = (min(len(block['items']), len(block['locations'])) if
|
||||||
> 0 else len(block['items']))
|
len(block['locations']) > 0 else len(block['items']))
|
||||||
if isinstance(block['count'], int):
|
if isinstance(block['count'], int):
|
||||||
block['count'] = {'min': block['count'], 'max': block['count']}
|
block['count'] = {'min': block['count'], 'max': block['count']}
|
||||||
if 'min' not in block['count']:
|
if 'min' not in block['count']:
|
||||||
block['count']['min'] = 0
|
block['count']['min'] = 0
|
||||||
if 'max' not in block['count']:
|
if 'max' not in block['count']:
|
||||||
block['count']['max'] = (min(len(block['items']), len(block['locations'])) if len(block['locations'])
|
block['count']['max'] = (min(len(block['items']), len(block['locations'])) if
|
||||||
> 0 else len(block['items']))
|
len(block['locations']) > 0 else len(block['items']))
|
||||||
if block['count']['max'] > len(block['items']):
|
if block['count']['max'] > len(block['items']):
|
||||||
count = block['count']
|
count = block['count']
|
||||||
failed(f"Plando count {count} greater than items specified", block['force'])
|
failed(f"Plando count {count} greater than items specified", block['force'])
|
||||||
|
|
Loading…
Reference in New Issue