Factorio: add new Recipe Time randomize options
This commit is contained in:
parent
33c8d307ed
commit
39ff471772
|
@ -47,6 +47,12 @@ recipe_time_scales = {
|
||||||
Options.RecipeTime.option_vanilla: None
|
Options.RecipeTime.option_vanilla: None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recipe_time_ranges = {
|
||||||
|
Options.RecipeTime.option_new_fast: (0.25, 2),
|
||||||
|
Options.RecipeTime.option_new_normal: (0.25, 10),
|
||||||
|
Options.RecipeTime.option_slow: (5, 10)
|
||||||
|
}
|
||||||
|
|
||||||
def generate_mod(world, output_directory: str):
|
def generate_mod(world, output_directory: str):
|
||||||
player = world.player
|
player = world.player
|
||||||
multiworld = world.world
|
multiworld = world.world
|
||||||
|
@ -95,7 +101,8 @@ def generate_mod(world, output_directory: str):
|
||||||
"starting_items": multiworld.starting_items[player], "recipes": recipes,
|
"starting_items": multiworld.starting_items[player], "recipes": recipes,
|
||||||
"random": random, "flop_random": flop_random,
|
"random": random, "flop_random": flop_random,
|
||||||
"static_nodes": multiworld.worlds[player].static_nodes,
|
"static_nodes": multiworld.worlds[player].static_nodes,
|
||||||
"recipe_time_scale": recipe_time_scales[multiworld.recipe_time[player].value],
|
"recipe_time_scale": recipe_time_scales.get(multiworld.recipe_time[player].value, None),
|
||||||
|
"recipe_time_range": recipe_time_ranges.get(multiworld.recipe_time[player].value, None),
|
||||||
"free_sample_blacklist": {item : 1 for item in free_sample_blacklist},
|
"free_sample_blacklist": {item : 1 for item in free_sample_blacklist},
|
||||||
"progressive_technology_table": {tech.name : tech.progressive for tech in
|
"progressive_technology_table": {tech.name : tech.progressive for tech in
|
||||||
progressive_technology_table.values()},
|
progressive_technology_table.values()},
|
||||||
|
|
|
@ -99,13 +99,25 @@ class TechTreeInformation(Choice):
|
||||||
|
|
||||||
|
|
||||||
class RecipeTime(Choice):
|
class RecipeTime(Choice):
|
||||||
"""randomize the time it takes for any recipe to craft, this includes smelting, chemical lab, hand crafting etc."""
|
"""Randomize the time it takes for any recipe to craft, this includes smelting, chemical lab, hand crafting etc.
|
||||||
|
Fast: 0.25X - 1X
|
||||||
|
Normal: 0.5X - 2X
|
||||||
|
Slow: 1X - 4X
|
||||||
|
Chaos: 0.25X - 4X
|
||||||
|
New category: ignores vanilla recipe time and rolls new one
|
||||||
|
New Fast: 0.25 - 2 seconds
|
||||||
|
New Normal: 0.25 - 10 seconds
|
||||||
|
New Slow: 5 - 10 seconds
|
||||||
|
"""
|
||||||
displayname = "Recipe Time"
|
displayname = "Recipe Time"
|
||||||
option_vanilla = 0
|
option_vanilla = 0
|
||||||
option_fast = 1
|
option_fast = 1
|
||||||
option_normal = 2
|
option_normal = 2
|
||||||
option_slow = 4
|
option_slow = 4
|
||||||
option_chaos = 5
|
option_chaos = 5
|
||||||
|
option_new_fast = 6
|
||||||
|
option_new_normal = 7
|
||||||
|
option_new_slow = 8
|
||||||
|
|
||||||
|
|
||||||
class Progressive(Choice):
|
class Progressive(Choice):
|
||||||
|
|
|
@ -100,6 +100,20 @@ function adjust_energy(recipe_name, factor)
|
||||||
end
|
end
|
||||||
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-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-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)
|
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) }})
|
adjust_energy("{{ recipe_name }}", {{ flop_random(*recipe_time_scale) }})
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor -%}
|
{%- 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{%- if silo==2 %}
|
{%- if silo==2 %}
|
||||||
|
|
Loading…
Reference in New Issue