Factorio recipe time: adjust triangular mode

This commit is contained in:
Fabian Dill 2021-06-07 11:32:39 +02:00
parent 4b283242fe
commit 72e5acfb86
1 changed files with 11 additions and 9 deletions

View File

@ -33,12 +33,15 @@ base_info = {
recipe_time_scales = {
# using random.triangular
Options.RecipeTime.option_fast: (0.25, 1),
Options.RecipeTime.option_normal: (0.5, 2, 1),
# 0.5, 2, 0.5 average -> 1.0
Options.RecipeTime.option_normal: (0.5, 2, 0.5),
Options.RecipeTime.option_slow: (1, 4),
Options.RecipeTime.option_chaos: (0.25, 4, 1),
# 0.25, 4, 0.25 average -> 1.5
Options.RecipeTime.option_chaos: (0.25, 4, 0.25),
Options.RecipeTime.option_vanilla: None
}
def generate_mod(world: MultiWorld, player: int):
global template, locale_template, control_template
with template_load_lock:
@ -64,11 +67,11 @@ def generate_mod(world: MultiWorld, player: int):
4: 2,
5: 5,
6: 10}[world.tech_cost[player].value]
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(),
"tech_cost_scale": tech_cost, "custom_data": world.custom_data[player],
"tech_tree_layout_prerequisites": world.tech_tree_layout_prerequisites[player],
"rocket_recipe" : rocket_recipes[world.max_science_pack[player].value],
"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], "recipes": recipes,
"random": world.random,
@ -80,7 +83,7 @@ def generate_mod(world: MultiWorld, player: int):
control_code = control_template.render(**template_data)
data_final_fixes_code = template.render(**template_data)
mod_dir = Utils.output_path(mod_name)+"_"+Utils.__version__
mod_dir = Utils.output_path(mod_name) + "_" + Utils.__version__
en_locale_dir = os.path.join(mod_dir, "locale", "en")
os.makedirs(en_locale_dir, exist_ok=True)
shutil.copytree(Utils.local_path("data", "factorio", "mod"), mod_dir, dirs_exist_ok=True)
@ -97,12 +100,11 @@ def generate_mod(world: MultiWorld, player: int):
json.dump(info, f, indent=4)
# zip the result
zf_path = os.path.join(mod_dir+".zip")
zf_path = os.path.join(mod_dir + ".zip")
with zipfile.ZipFile(zf_path, compression=zipfile.ZIP_DEFLATED, mode='w') as zf:
for root, dirs, files in os.walk(mod_dir):
for file in files:
zf.write(os.path.join(root, file),
os.path.relpath(os.path.join(root, file),
os.path.join(mod_dir, '..')))
os.path.relpath(os.path.join(root, file),
os.path.join(mod_dir, '..')))
shutil.rmtree(mod_dir)