Even Distribution 2.1.0 — Factorio 2.1 compatibility fix (fuel_category → fuel_categories)
Hello! I found a compatibility issue with Even Distribution 2.1.0 on Factorio 2.1.
The problem
When loading the mod, Factorio reports this error:
Error while running event even-distribution::on_init()
LuaItemPrototype doesn't contain key fuel_category.
stack traceback:
[C]: in function '__index'
__even-distribution__/scripts/setup.lua:297: in function 'generateTrashItemList'
The issue is caused by references to the old fuel_category property. Factorio 2.1 uses fuel_categories, which is a list of fuel categories rather than a single category.
Simply suppressing the error is not enough: the mod must also update its fuel-detection and distribution logic, otherwise item distribution can stop working correctly.
Suggested fix
I tested a compatibility patch that updates the affected Lua scripts to use fuel_categories.
The following files need attention:
scripts/setup.lua
- Replace the old
fuel_category references.
- Group fuel items by a valid category from
fuel_categories.
-
Update the default inventory cleanup logic for fuel items.
-
scripts/cleanup.lua
-
Check whether an item's fuel categories intersect with the target entity's accepted fuel categories.
-
scripts/drag.lua
-
Apply the same category compatibility check when distributing items by dragging.
-
scripts/helpers.lua
-
Update the custom "fuel" type condition to recognize fuel_categories.
-
scripts/helpers/LuaControl.lua
- Update the fuel replacement logic to use the appropriate category and safely handle missing entries.
For entities that accept multiple fuel categories, checking all categories is safer than assuming every item has only one.
Result
With these changes, my patched version works correctly in my Factorio 2.1 setup, including the normal item distribution functionality.
This is a community-tested workaround, not yet a confirmed official fix. I recommend reviewing the changes and testing them against the supported Factorio 2.1 versions before integrating them into the official release.
I hope this helps maintain compatibility with Factorio 2.1. Thanks for maintaining this useful mod!