Skip to content

[bug] import preset from factorio 2.1.7 impossible #178

Description

@burninghey

Broken import in factorio 2.1.7

To Reproduce
download and install factorio experimental 2.1.7 from steam
goto import preset in foreman 2.4
import new
error message: "Foreman export could not be completed - possible mod conflict detected. Please run Factorio and ensure it can successfully load to menu before retrying."

Ofc can load to main menu. No mods other than space age and the now separate recycling mod.

Expected behavior
import works

Additional context
Factorio 2.1.7 released as experimental today

Activity

  1. minno726 commented on Jul 12, 2026

    @minno726

    I figured out the changes required, which we can manually make as a workaround before Foreman updates.

    In the foremanexport mod, the following changes are required:

    1. LuaRecipePrototype.category and LuaRecipePrototype.additional_categories were consolidated into LuaRecipePrototype.categories. In instrument-control.lua:
    trecipe['category'] = recipe.category
    trecipe['additional_categories'] = {}
    if recipe.additional_categories ~= nil then
    	for _, cat in ipairs(recipe.additional_categories) do
    		table.insert(trecipe['additional_categories'], cat)
    	end
    end

    should become

    trecipe['additional_categories'] = {}
    for i, cat in ipairs(recipe.categories) do
        if i == 1 then
            trecipe['category'] = cat
        else
            table.insert(trecipe['additional_categories'], cat)
        end
    end

    Either that, or the way Foreman models categories should be updated to match Factorio 2.1's.

    1. For the same reason,
    add_category(recipe.category)
    if recipe.additional_categories ~= nil then
    	for _, cat in ipairs(recipe.additional_categories) do
    		add_category(cat)
    	end
    end

    should become

    for _, cat in ipairs(recipe.categories) do
        add_category(cat)
    end
    1. The properties LuaEntityPrototype.pumping_speed, LuaEntityPrototype.fluid_usage_per_tick, and LuaEntityPrototype.max_power_output were removed, so accesses should be replaced with LuaEntityPrototype.get_pumping_speed(), LuaEntityPrototype.get_fluid_usage_per_tick(), and LuaEntityPrototype.get_max_power_output() respectively.

    2. The way that recipes define fractional outputs has changed. Instead of defining ItemProduct.probability, it has ItemProduct.independent_probability and ItemProduct.shared_probability. The two places that calculate

    ((product.probability == nil) and 1 or product.probability)

    should be replaced with

    (product.independent_probability * (product.shared_probability.max - product.shared_probability.min))
    1. In info.json, update "factorio_version" from 2.0 to 2.1 and "base" from 2.0.7 to 2.1.7.

    There may be other changes for features that only mods use, but with these fixes it appears to make a completely correct preset for Factorio Space Age 2.1.9.

    In addition, Foreman 2.4 is unaware that the quality mod has been split into quality and recycler, so it throw a mod consistency error. As a workaround, this can be fixed by removing the recycler mod from the game's install directory and adding it to the mod folder. For the next Foreman release, DataCaching.IconCacheProcessor.PrepareModPaths should have the recycler mod added to the list of mods included with the game.

  2. burninghey commented on Jul 19, 2026

    @burninghey
    Author

    Oh this is great. Maybe you could do a pull request?

  3. Shinhan commented on Aug 2, 2026

    @Shinhan

    After testing his suggested workaround (it worked) I made a fork and pull request with those suggested changes. I didn't try compiling the C code itself so the IconCacheProcessor.cs change is untested.

  4. linked a pull request that will close this issueShinhan fix 2.1 #181on Aug 3, 2026
  5. Olipro commented on Aug 3, 2026

    @Olipro
    Collaborator

    I've run the CI on your pull request and the build is here: https://github.com/DanielKote/Foreman2/actions/runs/30734766555/job/91697152096?pr=181

    Click on either of the Archive Foreman steps and it'll have a link to download it. I'll also make you the assignee of this issue. You don't need to do anything, it's just for posterity/credit.

  6. assigned and unassigned on Aug 3, 2026
  7. added this to the Foreman 2.4.1 milestone on Aug 3, 2026
  8. danielniccoli commented on Aug 9, 2026

    @danielniccoli

    Took @Olipro's build and tried to create a Preset for unmodded 2.1.14 and got this:
    Image

  9. aquanox commented on Aug 19, 2026

    @aquanox

    @Shinhan
    Import indeed fails on 2.1.14
    IconCacheProcessor needs to be updated for the 'recycler' mod (as it has hardcoded base game mods)

    // line 78 (hard to notice as very long single line, bad formatting, 
    // maybe replace with a IsBaseFactorioMod helper function or readonly map like 'recycler' => '__recycler__' 
                        if (foundFile == null) {
                            if (!string.Equals(mod.Key, "core", StringComparison.OrdinalIgnoreCase)
                                && !string.Equals(mod.Key, "base", StringComparison.OrdinalIgnoreCase)
                                && !string.Equals(mod.Key, "elevated-rails", StringComparison.OrdinalIgnoreCase)
                                && !string.Equals(mod.Key, "recycler", StringComparison.OrdinalIgnoreCase) // add 
                                && !string.Equals(mod.Key, "quality", StringComparison.OrdinalIgnoreCase)
                                && !string.Equals(mod.Key, "space-age", StringComparison.OrdinalIgnoreCase))
                                return false;
                            continue;
                        }

    Also ideally this part should consider ProductMinor and have 1/2/2.1 exporters to avoid breaking 2.0 compat

    string foremanModName = "foremanexport_" + factorioVersionInfo.ProductMajorPart + ".0.0";
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions