[Core] Fix priority location handling in accessibility corrections (#1121)
* Fix priority location handling in accessibility corrections * Don't lock empty locations * black sliver's suggested change Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
This commit is contained in:
parent
04b6c31076
commit
f18df4c1df
22
Fill.py
22
Fill.py
|
@ -232,13 +232,13 @@ def accessibility_corrections(world: MultiWorld, state: CollectionState, locatio
|
||||||
if location in state.events:
|
if location in state.events:
|
||||||
state.events.remove(location)
|
state.events.remove(location)
|
||||||
locations.append(location)
|
locations.append(location)
|
||||||
|
if pool and locations:
|
||||||
if pool:
|
locations.sort(key=lambda loc: loc.progress_type != LocationProgressType.PRIORITY)
|
||||||
fill_restrictive(world, state, locations, pool)
|
fill_restrictive(world, state, locations, pool)
|
||||||
|
|
||||||
|
|
||||||
def inaccessible_location_rules(world: MultiWorld, state: CollectionState, locations):
|
def inaccessible_location_rules(world: MultiWorld, state: CollectionState, locations):
|
||||||
maximum_exploration_state = sweep_from_pool(state, [])
|
maximum_exploration_state = sweep_from_pool(state)
|
||||||
unreachable_locations = [location for location in locations if not location.can_reach(maximum_exploration_state)]
|
unreachable_locations = [location for location in locations if not location.can_reach(maximum_exploration_state)]
|
||||||
if unreachable_locations:
|
if unreachable_locations:
|
||||||
def forbid_important_item_rule(item: Item):
|
def forbid_important_item_rule(item: Item):
|
||||||
|
@ -285,15 +285,10 @@ def distribute_items_restrictive(world: MultiWorld) -> None:
|
||||||
nonlocal lock_later
|
nonlocal lock_later
|
||||||
lock_later.append(location)
|
lock_later.append(location)
|
||||||
|
|
||||||
# "priority fill"
|
|
||||||
fill_restrictive(world, world.state, prioritylocations, progitempool, swap=False, on_place=mark_for_locking)
|
|
||||||
accessibility_corrections(world, world.state, prioritylocations, progitempool)
|
|
||||||
|
|
||||||
for location in lock_later:
|
|
||||||
location.locked = True
|
|
||||||
del mark_for_locking, lock_later
|
|
||||||
|
|
||||||
if prioritylocations:
|
if prioritylocations:
|
||||||
|
# "priority fill"
|
||||||
|
fill_restrictive(world, world.state, prioritylocations, progitempool, swap=False, on_place=mark_for_locking)
|
||||||
|
accessibility_corrections(world, world.state, prioritylocations, progitempool)
|
||||||
defaultlocations = prioritylocations + defaultlocations
|
defaultlocations = prioritylocations + defaultlocations
|
||||||
|
|
||||||
if progitempool:
|
if progitempool:
|
||||||
|
@ -304,6 +299,11 @@ def distribute_items_restrictive(world: MultiWorld) -> None:
|
||||||
f'Not enough locations for progress items. There are {len(progitempool)} more items than locations')
|
f'Not enough locations for progress items. There are {len(progitempool)} more items than locations')
|
||||||
accessibility_corrections(world, world.state, defaultlocations)
|
accessibility_corrections(world, world.state, defaultlocations)
|
||||||
|
|
||||||
|
for location in lock_later:
|
||||||
|
if location.item:
|
||||||
|
location.locked = True
|
||||||
|
del mark_for_locking, lock_later
|
||||||
|
|
||||||
inaccessible_location_rules(world, world.state, defaultlocations)
|
inaccessible_location_rules(world, world.state, defaultlocations)
|
||||||
|
|
||||||
remaining_fill(world, excludedlocations, filleritempool)
|
remaining_fill(world, excludedlocations, filleritempool)
|
||||||
|
|
Loading…
Reference in New Issue