Skip to content

Commit babd809

Browse files
committed
Factorio: fix certain recipes (like steel-plate) not getting their crafting time adjusted correctly.
1 parent 54177c7 commit babd809

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

data/factorio/mod_template/data-final-fixes.lua

+12-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@ function copy_factorio_icon(tech, tech_source)
5252
end
5353

5454
function adjust_energy(recipe_name, factor)
55-
local energy = data.raw.recipe[recipe_name].energy_required
56-
if (energy == nil) then
57-
energy = 1
55+
local recipe = data.raw.recipe[recipe_name]
56+
local energy = recipe.energy_required
57+
if (energy ~= nil) then
58+
data.raw.recipe[recipe_name].energy_required = energy * factor
59+
end
60+
if (recipe.normal ~= nil and recipe.normal.energy_required ~= nil) then
61+
energy = recipe.normal.energy_required
62+
recipe.normal.energy_required = energy * factor
63+
end
64+
if (recipe.expensive ~= nil and recipe.expensive.energy_required ~= nil) then
65+
energy = recipe.expensive.energy_required
66+
recipe.expensive.energy_required = energy * factor
5867
end
59-
data.raw.recipe[recipe_name].energy_required = energy * factor
6068
end
6169

6270
data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories = table.deepcopy(data.raw["assembling-machine"]["assembling-machine-3"].crafting_categories)

0 commit comments

Comments
 (0)