Factorio: add rocket recipe scaling by max science

This commit is contained in:
Fabian Dill 2021-05-07 21:58:46 +02:00
parent 5cb2689609
commit 298f2f652a
2 changed files with 22 additions and 1 deletions

View File

@ -1,6 +1,8 @@
-- this file gets written automatically by the Archipelago Randomizer and is in its raw form a Jinja2 Template -- this file gets written automatically by the Archipelago Randomizer and is in its raw form a Jinja2 Template
require('lib') require('lib')
data.raw["recipe"]["rocket-part"].ingredients = {{ rocket_recipe | safe }}
local technologies = data.raw["technology"] local technologies = data.raw["technology"]
local original_tech local original_tech
local new_tree_copy local new_tree_copy

View File

@ -27,6 +27,24 @@ base_info = {
"factorio_version": "1.1" "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): def generate_mod(world: MultiWorld, player: int, seedname: str):
global template, locale_template global template, locale_template
with template_load_lock: 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, 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(), "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_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: for factorio_option in Options.factorio_options:
template_data[factorio_option] = getattr(world, factorio_option)[player].value template_data[factorio_option] = getattr(world, factorio_option)[player].value
control_code = control_template.render(**template_data) control_code = control_template.render(**template_data)