mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Factorio: implement random recipe times
This commit is contained in:
@@ -11,7 +11,7 @@ import Utils
|
||||
import shutil
|
||||
import Options
|
||||
from BaseClasses import MultiWorld
|
||||
from .Technologies import tech_table, rocket_recipes
|
||||
from .Technologies import tech_table, rocket_recipes, recipes
|
||||
|
||||
template_env: Optional[jinja2.Environment] = None
|
||||
|
||||
@@ -62,7 +62,8 @@ def generate_mod(world: MultiWorld, player: int):
|
||||
"tech_tree_layout_prerequisites": world.tech_tree_layout_prerequisites[player],
|
||||
"rocket_recipe" : rocket_recipes[world.max_science_pack[player].value],
|
||||
"slot_name": world.player_names[player][0], "seed_name": world.seed_name,
|
||||
"starting_items": world.starting_items[player]}
|
||||
"starting_items": world.starting_items[player], "recipes": recipes,
|
||||
"recipe_time": world.recipe_time[player], "random": world.random}
|
||||
|
||||
for factorio_option in Options.factorio_options:
|
||||
template_data[factorio_option] = getattr(world, factorio_option)[player].value
|
||||
|
||||
@@ -117,13 +117,14 @@ for technology, data in raw.items():
|
||||
|
||||
del (raw)
|
||||
lookup_id_to_name: Dict[int, str] = {item_id: item_name for item_name, item_id in tech_table.items()}
|
||||
|
||||
recipes = {}
|
||||
all_product_sources: Dict[str, Set[Recipe]] = {"character": set()}
|
||||
for recipe_name, recipe_data in raw_recipes.items():
|
||||
# example:
|
||||
# "accumulator":{"ingredients":["iron-plate","battery"],"products":["accumulator"],"category":"crafting"}
|
||||
|
||||
recipe = Recipe(recipe_name, recipe_data["category"], set(recipe_data["ingredients"]), set(recipe_data["products"]))
|
||||
recipes[recipe_name] = Recipe
|
||||
if recipe.products.isdisjoint(recipe.ingredients) and "empty-barrel" not in recipe.products: # prevents loop recipes like uranium centrifuging
|
||||
for product_name in recipe.products:
|
||||
all_product_sources.setdefault(product_name, set()).add(recipe)
|
||||
|
||||
Reference in New Issue
Block a user