ItemLink - ensure no extra fillers are created (#316)

This commit is contained in:
Alchav 2022-03-20 11:07:51 -04:00 committed by GitHub
parent 7e314c0d7a
commit affcaf1c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -200,14 +200,17 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
itemcount = len(world.itempool)
world.itempool = new_itempool
# can produce more items than were removed
while itemcount > len(world.itempool):
items_to_add = []
for player in group["players"]:
if group["replacement_items"][player]:
world.itempool.append(AutoWorld.call_single(world, "create_item", player,
items_to_add.append(AutoWorld.call_single(world, "create_item", player,
group["replacement_items"][player]))
else:
AutoWorld.call_single(world, "create_filler", player)
items_to_add.append(AutoWorld.call_single(world, "create_filler", player))
world.random.shuffle(items_to_add)
world.itempool.extend(items_to_add[:itemcount - len(world.itempool)])
if any(world.item_links.values()):
world._recache()
world._all_state = None

View File

@ -250,8 +250,8 @@ class World(metaclass=AutoWorldRegister):
return True
return False
def create_filler(self):
self.world.itempool.append(self.create_item(self.get_filler_item_name()))
def create_filler(self) -> Item:
return self.create_item(self.get_filler_item_name())
# any methods attached to this can be used as part of CollectionState,