Page 1 of 1

Double Ingredient cost - Solved

Posted: Mon Nov 02, 2015 9:25 pm
by TheSAguy
In my mod, I have a function that doubles the ingredient cost of science packs.
I currently know the ingredients used, so the function I use looks like this:
Code
This caused an incompatibility with science overhaul mod, since it changed the ingredients used for science packs.
How can I just say, take whatever the ingredients are and double it. (Without specifying what the ingredients are?)

Re: Double Ingredient cost

Posted: Mon Nov 02, 2015 9:39 pm
by prg

Code: Select all

for _, recipe in pairs({"science-pack-1", "science-pack-2", "science-pack-3", "alien-science-pack"}) do
    for _, ingredient in pairs(data.raw.recipe[recipe].ingredients) do
        ingredient[2] = ingredient[2] * 2
    end
end

Re: Double Ingredient cost

Posted: Mon Nov 02, 2015 9:47 pm
by TheSAguy
Thanks PRG!!