From 298f2f652a4d4d75499a15a53990847377f67951 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 7 May 2021 21:58:46 +0200 Subject: [PATCH] Factorio: add rocket recipe scaling by max science --- .../mod_template/data-final-fixes.lua | 2 ++ worlds/factorio/Mod.py | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/data/factorio/mod_template/data-final-fixes.lua b/data/factorio/mod_template/data-final-fixes.lua index 1ba00905..8da2b245 100644 --- a/data/factorio/mod_template/data-final-fixes.lua +++ b/data/factorio/mod_template/data-final-fixes.lua @@ -1,6 +1,8 @@ -- this file gets written automatically by the Archipelago Randomizer and is in its raw form a Jinja2 Template require('lib') +data.raw["recipe"]["rocket-part"].ingredients = {{ rocket_recipe | safe }} + local technologies = data.raw["technology"] local original_tech local new_tree_copy diff --git a/worlds/factorio/Mod.py b/worlds/factorio/Mod.py index 0ae2d231..77b1101f 100644 --- a/worlds/factorio/Mod.py +++ b/worlds/factorio/Mod.py @@ -27,6 +27,24 @@ base_info = { "factorio_version": "1.1" } +# TODO: clean this up, probably as a jinja macro; then add logic for the recipes in completion condition +rocket_recipes = { + Options.MaxSciencePack.option_space_science_pack: + '{{"rocket-control-unit", 10}, {"low-density-structure", 10}, {"rocket-fuel", 10}}', + Options.MaxSciencePack.option_utility_science_pack: + '{{"speed-module", 10}, {"steel-plate", 10}, {"solid-fuel", 10}}', + Options.MaxSciencePack.option_production_science_pack: + '{{"speed-module", 10}, {"steel-plate", 10}, {"solid-fuel", 10}}', + Options.MaxSciencePack.option_chemical_science_pack: + '{{"advanced-circuit", 10}, {"steel-plate", 10}, {"solid-fuel", 10}}', + Options.MaxSciencePack.option_military_science_pack: + '{{"defender-capsule", 10}, {"stone-wall", 10}, {"coal", 10}}', + Options.MaxSciencePack.option_logistic_science_pack: + '{{"electronic-circuit", 10}, {"stone-brick", 10}, {"coal", 10}}', + Options.MaxSciencePack.option_automation_science_pack: + '{{"copper-cable", 1}, {"iron-plate", 1}, {"wood", 1}}' +} + def generate_mod(world: MultiWorld, player: int, seedname: str): global template, locale_template with template_load_lock: @@ -51,7 +69,8 @@ def generate_mod(world: MultiWorld, player: int, seedname: str): template_data = {"locations": locations, "player_names" : player_names, "tech_table": tech_table, "mod_name": mod_name, "allowed_science_packs": world.max_science_pack[player].get_allowed_packs(), "tech_cost_scale": tech_cost, "custom_data": world.custom_data[player], - "tech_tree_layout_prerequisites": world.tech_tree_layout_prerequisites[player]} + "tech_tree_layout_prerequisites": world.tech_tree_layout_prerequisites[player], + "rocket_recipe" : rocket_recipes[world.max_science_pack[player].value]} for factorio_option in Options.factorio_options: template_data[factorio_option] = getattr(world, factorio_option)[player].value control_code = control_template.render(**template_data)