diff --git a/Main.py b/Main.py index e8a9d647..b35a1bec 100644 --- a/Main.py +++ b/Main.py @@ -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 diff --git a/worlds/AutoWorld.py b/worlds/AutoWorld.py index 5445f2cf..fd3b44af 100644 --- a/worlds/AutoWorld.py +++ b/worlds/AutoWorld.py @@ -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,