Compare commits

...

5 Commits

Author SHA1 Message Date
NewSoupVi
e7632670a6 respect single_player_placement 2025-10-14 20:16:35 +02:00
NewSoupVi
65cf8080b1 rewrite more 2025-10-14 11:47:58 +02:00
NewSoupVi
45eef7d097 Merge branch 'main' into NewSoupVi-patch-26 2025-10-14 10:21:21 +02:00
NewSoupVi
26c1e9b8c3 Remove the overindentation 2024-11-22 16:23:40 +01:00
NewSoupVi
6bca1cbdac Fix Fill choking on itself in minimal + full games 2024-11-22 16:09:24 +01:00

39
Fill.py
View File

@@ -210,12 +210,43 @@ def fill_restrictive(multiworld: MultiWorld, base_state: CollectionState, locati
_log_fill_progress(name, placed, total)
if cleanup_required:
relevant_locations = multiworld.get_filled_locations(item.player if single_player_placement else None)
# validate all placements and remove invalid ones
state = sweep_from_pool(
base_state, [], multiworld.get_filled_locations(item.player)
if single_player_placement else None)
cleanup_state = sweep_from_pool(base_state, [], relevant_locations)
# accessibilty_corrections can clean up any case where locations are unreachable as a result of
# a full player's item being on a minimal player's unreachable location.
# So, we make a state where we collect all such minimal->full items to check against.
changed = False
for location in relevant_locations:
if location.item is None:
continue
if location in cleanup_state.locations_checked:
continue
if multiworld.worlds[location.player].options.accessibility == "minimal":
if multiworld.worlds[location.item.player].options.accessibility != "minimal":
changed |= cleanup_state.collect(location.item, prevent_sweep=True)
if changed:
cleanup_state.sweep_for_advancements(relevant_locations)
for placement in placements:
if multiworld.worlds[placement.item.player].options.accessibility != "minimal" and not placement.can_reach(state):
# If the item's player is minimal, we don't care that it's unreachable.
if multiworld.worlds[placement.item.player].options.accessibility == "minimal":
continue
# This item belongs to a full player.
# If the location's player is minimal, we don't need to be concerned.
# Even if the location is inaccessible, accessibility_corrections will clean this up.
if multiworld.worlds[placement.player].options.accessibility == "minimal":
continue
# This is a full player's item on a full player's location.
# If this item is unreachable, we have a problem - UNLESS the location is just stuck behind a full player's
# item on a minimal player's location. That case will transitively get solved by accessibility_corrections.
# This is why we use our special "cleanup_state", not just the maximum exploration state.
if not placement.can_reach(cleanup_state):
placement.item.location = None
unplaced_items.append(placement.item)
placement.item = None