Repository navigation
[bug] import preset from factorio 2.1.7 impossible #178
Description
Activity
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:
LuaRecipePrototype.categoryandLuaRecipePrototype.additional_categorieswere consolidated intoLuaRecipePrototype.categories. Ininstrument-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.
- 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
-
The properties
LuaEntityPrototype.pumping_speed,LuaEntityPrototype.fluid_usage_per_tick, andLuaEntityPrototype.max_power_outputwere removed, so accesses should be replaced withLuaEntityPrototype.get_pumping_speed(),LuaEntityPrototype.get_fluid_usage_per_tick(), andLuaEntityPrototype.get_max_power_output()respectively. -
The way that recipes define fractional outputs has changed. Instead of defining
ItemProduct.probability, it hasItemProduct.independent_probabilityandItemProduct.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))
- 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.PrepareModPathsshould have the recycler mod added to the list of mods included with the game.Oh this is great. Maybe you could do a pull request?
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.
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 Foremansteps 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.Took @Olipro's build and tried to create a Preset for unmodded 2.1.14 and got this:

@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";
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