I made a fuller fix for 2.1. Search-and-replace gets the game to start, but fuel distribution into burner machines is still broken. In 2.1, LuaItemPrototype.fuel_categories is an array of strings (nil when the item isn't a fuel). Code like burner.fuel_categories[prototype.fuel_categories] indexes with a table, so it is always nil.
Unzip even-distribution_2.1.0.zip, make the changes below, and zip the folder again (the zip must contain the even-distribution_2.1.0 folder).
1. scripts/util.lua - add these two functions just above function util.enablesRobots(tech):
function util.fuelCategories(prototype)
return prototype.fuel_categories or {}
end
function util.burnerAccepts(burner, prototype)
if not burner then return false end
for __,category in pairs(util.fuelCategories(prototype)) do
if burner.fuel_categories[category] then return true end
end
return false
end
2. scripts/setup.lua, around line 46 - replace the whole storage.fuelList = _(prototypes.item) ... :toPlain() block with:
storage.fuelList = {}
for __,prototype in pairs(prototypes.item) do
for __,category in pairs(util.fuelCategories(prototype)) do
storage.fuelList[category] = storage.fuelList[category] or {}
table.insert(storage.fuelList[category], prototype)
end
end
for __,fuels in pairs(storage.fuelList) do
table.sort(fuels, function(a,b)
if a.fuel_value ~= b.fuel_value then return a.fuel_value < b.fuel_value end
return a.name < b.name
end)
end
(The old :sort() never actually sorted anything, because it ran table.sort on the grouped table, which is keyed by category. "Replace inferior fuel" needs the lists in ascending order.)
3. scripts/setup.lua, around line 297:
if item.fuel_category and not defaultTrash[name] then
becomes
if item.fuel_categories and not defaultTrash[name] then
4. scripts/drag.lua, line 315:
elseif entity.burner and entity.burner.fuel_categories[prototype.fuel_category] then
becomes
elseif util.burnerAccepts(entity.burner, prototype) then
5. scripts/cleanup.lua, line 267:
if entity.burner and entity.burner.fuel_categories[prototype.fuel_category] and entity:inventory("fuel").can_insert(item) then
becomes
if util.burnerAccepts(entity.burner, prototype) and entity:inventory("fuel").can_insert(item) then
6. scripts/helpers.lua, line 63 - the "fuel" condition:
["fuel"] = function(obj) return obj.object_name == "LuaItemStack" and obj.prototype.fuel_categories ~= nil or obj.object_name == "LuaItemPrototype" and obj.fuel_categories ~= nil end,
7. scripts/helpers/LuaControl.lua, around line 169 - replace
for __,inferiorFuel in pairs(storage.fuelList[prototype.fuel_category]) do
if inferiorFuel.name == prototype.name or limit <= 0 then break end
with
local burner = self.burner
local inferiorFuels = {}
for __,category in pairs(scripts.util.fuelCategories(prototype)) do
if burner and burner.fuel_categories[category] then
for __,fuel in pairs(storage.fuelList[category] or {}) do
if fuel.name == prototype.name then break end
inferiorFuels[#inferiorFuels + 1] = fuel
end
end
end
for __,inferiorFuel in pairs(inferiorFuels) do
if limit <= 0 then break end
The rest of that loop stays as it is.
Alternatively, the Even Distribution Fork (2.1.1) says it handles multiple fuel categories, so switching to it is probably easiest until the original is updated.