diff --git a/Options.py b/Options.py index e362f471..3795b817 100644 --- a/Options.py +++ b/Options.py @@ -334,6 +334,7 @@ class RecipeTime(Choice): option_fast = 1 option_normal = 2 option_slow = 4 + option_chaos = 5 class FactorioStartItems(OptionDict): default = {"burner-mining-drill": 19, "stone-furnace": 19} diff --git a/data/factorio/mod_template/data-final-fixes.lua b/data/factorio/mod_template/data-final-fixes.lua index 75464b35..d6a96ee1 100644 --- a/data/factorio/mod_template/data-final-fixes.lua +++ b/data/factorio/mod_template/data-final-fixes.lua @@ -85,8 +85,8 @@ table.insert(new_tree_copy.prerequisites, "ap-{{ tech_table[prerequesite] }}-") {#- add new Technology to game #} data:extend{new_tree_copy} {% endfor %} -{% if recipe_time %} +{% if recipe_time_scale %} {%- for recipe in recipes %} -adjust_energy("{{ recipe }}", {{ 0.01 * random.randint(recipe_time*25, recipe_time*100) }}) +adjust_energy("{{ recipe }}", {{ random.triangular(*recipe_time_scale) }}) {%- endfor -%} {% endif %} \ No newline at end of file diff --git a/playerSettings.yaml b/playerSettings.yaml index 9567866e..4912d84e 100644 --- a/playerSettings.yaml +++ b/playerSettings.yaml @@ -55,11 +55,12 @@ tech_tree_layout: small_funnels: 1 medium_funnels: 1 large_funnels: 1 -recipe_time: +recipe_time: # randomize the time it takes for any recipe to craft, this includes smelting, chemical lab, hand crafting etc. vanilla: 1 fast: 0 # 25% to 100% of original time normal: 0 # 50 % to 200% of original time slow: 0 # 100% to 400% of original time + chaos: 0 # 25% to 400% of original time max_science_pack: automation_science_pack: 0 logistic_science_pack: 0 diff --git a/worlds/factorio/Mod.py b/worlds/factorio/Mod.py index 5b13dfda..e7272b7d 100644 --- a/worlds/factorio/Mod.py +++ b/worlds/factorio/Mod.py @@ -30,6 +30,14 @@ base_info = { "factorio_version": "1.1" } +recipe_time_scales = { + # using random.triangular + Options.RecipeTime.option_fast: (0.25, 1), + Options.RecipeTime.option_normal: (0.5, 2, 1), + Options.RecipeTime.option_slow: (1, 4), + Options.RecipeTime.option_chaos: (0.25, 4, 1), + Options.RecipeTime.option_vanilla: None +} def generate_mod(world: MultiWorld, player: int): global template, locale_template, control_template @@ -63,7 +71,8 @@ def generate_mod(world: MultiWorld, player: int): "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, - "recipe_time": world.recipe_time[player], "random": world.random} + "random": world.random, + "recipe_time_scale": recipe_time_scales[world.recipe_time[player].value]} for factorio_option in Options.factorio_options: template_data[factorio_option] = getattr(world, factorio_option)[player].value