From 7c3ba3bc42327f7c2f69d098022f5fbe36776776 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 19 Nov 2021 19:44:34 +0100 Subject: [PATCH] Factorio: fix cumulative advancement flagging --- worlds/__init__.py | 3 ++- worlds/factorio/__init__.py | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/worlds/__init__.py b/worlds/__init__.py index f193a9f8..4ab5b473 100644 --- a/worlds/__init__.py +++ b/worlds/__init__.py @@ -3,7 +3,8 @@ import os __all__ = {"lookup_any_item_id_to_name", "lookup_any_location_id_to_name", - "network_data_package"} + "network_data_package", + "AutoWorldRegister"} # import all submodules to trigger AutoWorldRegister for file in os.scandir(os.path.dirname(__file__)): diff --git a/worlds/factorio/__init__.py b/worlds/factorio/__init__.py index 1834e4ff..437030c6 100644 --- a/worlds/factorio/__init__.py +++ b/worlds/factorio/__init__.py @@ -32,13 +32,17 @@ class Factorio(World): game: str = "Factorio" static_nodes = {"automation", "logistics", "rocket-silo"} custom_recipes = {} - additional_advancement_technologies = set() + additional_advancement_technologies: set item_name_to_id = all_items location_name_to_id = base_tech_table data_version = 5 + def __init__(self, world, player: int): + super(Factorio, self).__init__(world, player) + self.additional_advancement_technologies = set() + def generate_basic(self): player = self.player want_progressives = collections.defaultdict(lambda: self.world.progressive[player]. @@ -189,7 +193,7 @@ class Factorio(World): fallback_pool = [] # fill all but one slot with random ingredients, last with a good match - while remaining_num_ingredients > 0 and len(pool) > 0: + while remaining_num_ingredients > 0 and pool: if remaining_num_ingredients == 1: max_raw = 1.1 * remaining_raw min_raw = 0.9 * remaining_raw @@ -226,7 +230,7 @@ class Factorio(World): # fill failed slots with whatever we got pool = fallback_pool - while remaining_num_ingredients > 0 and len(pool) > 0: + while remaining_num_ingredients > 0 and pool: ingredient = pool.pop() if ingredient not in recipes: logging.warning(f"missing recipe for {ingredient}")