Even Distribution


Modifies CTRL + Click Drag to evenly distribute the items over multiple buildings. Also adds Inventory Cleanup hotkey (SHIFT+C) which evenly distributes unneeded items from inventory into nearby machines.

Utilities
5 months ago
0.15 - 2.1
532K

g Crash on Factorio 2.1 - fuel_category was renamed to fuel_categories

8 days ago

Factorio 2.1 renamed the prototype field fuel_category (string)
to fuel_categories (array). Reading the old key now throws
instead of returning nil.

Error in game:
LuaItemPrototype doesn't contain key fuel_category

The mod still uses fuel_category in 6 places:

scripts/setup.lua:49
:groupBy(function(k,v) return v.fuel_category end)

scripts/setup.lua:297
if not defaultTrash[name] and item.fuel_category then

scripts/helpers.lua:63
if prototype.fuel_category then ...

scripts/cleanup.lua:267
entity.burner.fuel_inventory.get_item_count(
item.name) > 0 and prototype.fuel_category

scripts/drag.lua:315
(same pattern as cleanup.lua)

scripts/helpers/LuaControl.lua:169
storage.fuelList[prototype.fuel_category]

Suggested fix:
local fc = prototype.fuel_categories
if fc == nil or fc[1] == nil then return nil end
local category = fc[1]

Tested on: Factorio 2.1.24 (build 87808), space-age, ~240 mods.
Works after applying the above change, so this is the only blocker.

8 days ago

+1

The mod Even Distribution (2.1.0) caused a non-recoverable error.
Please report this error to the mod author.

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'
even-distribution/scripts/setup.lua:16: in function 'func'
even-distribution/framework.lua:49: in function 'handleEvent'
even-distribution/framework.lua:58: in function <even-distribution/framework.lua:58>

8 days ago

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'
even-distribution/scripts/setup.lua:16: in function 'func'
even-distribution/framework.lua:49: in function 'handleEvent'
even-distribution/framework.lua:58: in function <even-distribution/framework.lua:58>

7 days ago

+1

Error while running event even-distribution::on_configuration_changed
LuaItemPrototype doesn't contain key fuel_category.
stack traceback:
[C]: in function 'index'
__even-distribution
/scripts/setup.lua:297: in function 'generateTrashItemList'
even-distribution/scripts/setup.lua:16: in function 'func'
even-distribution/framework.lua:49: in function 'handleEvent'
even-distribution/framework.lua:58: in function <even-distribution/framework.lua:58>

6 days ago

Can confirm.

6 days ago

+1

6 days ago

+1
same error msg as everyone else

6 days ago

1+

Die Mod Even Distribution (2.1.0) hat einen Fehler verursacht, der nicht behoben werden kann.
Bitte informiere den Autor der Mod über diesen Fehler.

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'
even-distribution/scripts/setup.lua:16: in function 'func'
even-distribution/framework.lua:49: in function 'handleEvent'
even-distribution/framework.lua:58: in function <even-distribution/framework.lua:58>

5 days ago

Factorio 2.1 renamed the prototype field fuel_category (string)
to fuel_categories (array). Reading the old key now throws
instead of returning nil.

Error in game:
LuaItemPrototype doesn't contain key fuel_category

The mod still uses fuel_category in 6 places:

scripts/setup.lua:49
:groupBy(function(k,v) return v.fuel_category end)

scripts/setup.lua:297
if not defaultTrash[name] and item.fuel_category then

scripts/helpers.lua:63
if prototype.fuel_category then ...

scripts/cleanup.lua:267
entity.burner.fuel_inventory.get_item_count(
item.name) > 0 and prototype.fuel_category

scripts/drag.lua:315
(same pattern as cleanup.lua)

scripts/helpers/LuaControl.lua:169
storage.fuelList[prototype.fuel_category]

Suggested fix:
local fc = prototype.fuel_categories
if fc == nil or fc[1] == nil then return nil end
local category = fc[1]

Tested on: Factorio 2.1.24 (build 87808), space-age, ~240 mods.
Works after applying the above change, so this is the only blocker.

Can you let us please know where to place this fix (in which file) so we to may benefit. Thank You.

5 days ago

Factorio 2.1 renamed the prototype field fuel_category (string)
to fuel_categories (array). Reading the old key now throws
instead of returning nil.

Error in game:
LuaItemPrototype doesn't contain key fuel_category

The mod still uses fuel_category in 6 places:

scripts/setup.lua:49
:groupBy(function(k,v) return v.fuel_category end)

scripts/setup.lua:297
if not defaultTrash[name] and item.fuel_category then

scripts/helpers.lua:63
if prototype.fuel_category then ...

scripts/cleanup.lua:267
entity.burner.fuel_inventory.get_item_count(
item.name) > 0 and prototype.fuel_category

scripts/drag.lua:315
(same pattern as cleanup.lua)

scripts/helpers/LuaControl.lua:169
storage.fuelList[prototype.fuel_category]

Suggested fix:
local fc = prototype.fuel_categories
if fc == nil or fc[1] == nil then return nil end
local category = fc[1]

Tested on: Factorio 2.1.24 (build 87808), space-age, ~240 mods.
Works after applying the above change, so this is the only blocker.

While simply renaming it prevents the crash, it can interfere with fuel distribution using Ctrl + Drag and Shift + C.

4 days ago

My log of crash

O mod Even Distribution (2.1.0) causou um erro não recuperável.
Por favor, reporte este erro ao autor do mod.

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'
even-distribution/scripts/setup.lua:16: in function 'func'
even-distribution/framework.lua:49: in function 'handleEvent'
even-distribution/framework.lua:58: in function <even-distribution/framework.lua:58>

3 days ago

Just switched to stable 2.1.24 and hoped this is solved, but same "fuel_category" crash

5 hours ago

Yeah love that you took the time to update since I LOVE this mod sucks about the bug.
The mod Even Distribution (2.1.0) caused a non-recoverable error.
Please report this error to the mod author.

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'
even-distribution/scripts/setup.lua:16: in function 'func'
even-distribution/framework.lua:49: in function 'handleEvent'
even-distribution/framework.lua:58: in function <even-distribution/framework.lua:58>

New response