Factorio: add new Recipe Time randomize options

This commit is contained in:
Fabian Dill
2021-11-23 19:10:26 +01:00
parent 33c8d307ed
commit 39ff471772
3 changed files with 41 additions and 2 deletions

View File

@@ -100,6 +100,20 @@ function adjust_energy(recipe_name, factor)
end
end
function set_energy(recipe_name, energy)
local recipe = data.raw.recipe[recipe_name]
if (recipe.normal ~= nil) then
recipe.normal.energy_required = energy
end
if (recipe.expensive ~= nil) then
recipe.expensive.energy_required = energy
end
if (recipe.expensive == nil and recipe.normal == nil) then
recipe.energy_required = energy
end
end
data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories = table.deepcopy(data.raw["assembling-machine"]["assembling-machine-3"].crafting_categories)
data.raw["assembling-machine"]["assembling-machine-2"].crafting_categories = table.deepcopy(data.raw["assembling-machine"]["assembling-machine-3"].crafting_categories)
data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes = table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes)
@@ -144,6 +158,12 @@ data:extend{new_tree_copy}
adjust_energy("{{ recipe_name }}", {{ flop_random(*recipe_time_scale) }})
{%- endif %}
{%- endfor -%}
{% elif recipe_time_range %}
{%- for recipe_name, recipe in recipes.items() %}
{%- if recipe.category != "mining" %}
set_energy("{{ recipe_name }}", {{ flop_random(*recipe_time_range) }})
{%- endif %}
{%- endfor -%}
{% endif %}
{%- if silo==2 %}