Double Ingredient cost - Solved

Place to get help with not working mods / modding interface.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Double Ingredient cost - Solved

Post 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?)
Last edited by TheSAguy on Tue Nov 03, 2015 6:33 pm, edited 2 times in total.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Double Ingredient cost

Post 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
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Double Ingredient cost

Post by TheSAguy »

Thanks PRG!!

Post Reply

Return to “Modding help”