Factorio: fix cumulative advancement flagging

This commit is contained in:
Fabian Dill 2021-11-19 19:44:34 +01:00
parent c638a2cfb6
commit 7c3ba3bc42
2 changed files with 9 additions and 4 deletions

View File

@ -3,7 +3,8 @@ import os
__all__ = {"lookup_any_item_id_to_name", __all__ = {"lookup_any_item_id_to_name",
"lookup_any_location_id_to_name", "lookup_any_location_id_to_name",
"network_data_package"} "network_data_package",
"AutoWorldRegister"}
# import all submodules to trigger AutoWorldRegister # import all submodules to trigger AutoWorldRegister
for file in os.scandir(os.path.dirname(__file__)): for file in os.scandir(os.path.dirname(__file__)):

View File

@ -32,13 +32,17 @@ class Factorio(World):
game: str = "Factorio" game: str = "Factorio"
static_nodes = {"automation", "logistics", "rocket-silo"} static_nodes = {"automation", "logistics", "rocket-silo"}
custom_recipes = {} custom_recipes = {}
additional_advancement_technologies = set() additional_advancement_technologies: set
item_name_to_id = all_items item_name_to_id = all_items
location_name_to_id = base_tech_table location_name_to_id = base_tech_table
data_version = 5 data_version = 5
def __init__(self, world, player: int):
super(Factorio, self).__init__(world, player)
self.additional_advancement_technologies = set()
def generate_basic(self): def generate_basic(self):
player = self.player player = self.player
want_progressives = collections.defaultdict(lambda: self.world.progressive[player]. want_progressives = collections.defaultdict(lambda: self.world.progressive[player].
@ -189,7 +193,7 @@ class Factorio(World):
fallback_pool = [] fallback_pool = []
# fill all but one slot with random ingredients, last with a good match # 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: if remaining_num_ingredients == 1:
max_raw = 1.1 * remaining_raw max_raw = 1.1 * remaining_raw
min_raw = 0.9 * remaining_raw min_raw = 0.9 * remaining_raw
@ -226,7 +230,7 @@ class Factorio(World):
# fill failed slots with whatever we got # fill failed slots with whatever we got
pool = fallback_pool pool = fallback_pool
while remaining_num_ingredients > 0 and len(pool) > 0: while remaining_num_ingredients > 0 and pool:
ingredient = pool.pop() ingredient = pool.pop()
if ingredient not in recipes: if ingredient not in recipes:
logging.warning(f"missing recipe for {ingredient}") logging.warning(f"missing recipe for {ingredient}")