AutoWorld: add spoiler hooks

Factorio: Move Recipes to new spoiler hooks
This commit is contained in:
Fabian Dill
2021-11-02 12:29:29 +01:00
parent e4838f6d2b
commit e019ec5ff7
3 changed files with 30 additions and 8 deletions

View File

@@ -167,6 +167,15 @@ class Factorio(World):
options = factorio_options
@classmethod
def stage_write_spoiler(cls, world, spoiler_handle):
factorio_players = world.get_game_players(cls.game)
spoiler_handle.write('\n\nFactorio Recipes:\n')
for player in factorio_players:
name = world.get_player_name(player)
for recipe in world.worlds[player].custom_recipes.values():
spoiler_handle.write(f"\n{recipe.name} ({name}): {recipe.ingredients} -> {recipe.products}")
def make_balanced_recipe(self, original: Recipe, pool: list, factor: float = 1) -> Recipe:
"""Generate a recipe from pool with time and cost similar to original * factor"""
new_ingredients = {}