Loader Utilities


Adds options to change how loaders function, as well as enabling stacking on loaders if possible.

Tweaks
13 days ago
2.0 - 2.1
1.46K
Logistics

g Load error

a month ago

Не удалось загрузить следующие моды: loader-utils/data-final-fixes.lua:119: bad argument #2 of 3 to 'band' (number expected, got nil)

stack traceback:
[C]: in function 'band'
loader-utils/data-final-fixes.lua:119: in main chunk

How fix it?

a month ago

I use AI for diagnostic:

I've found an incompatibility between loader-utils and Editor Extensions.

Environment:
- Factorio 2.1.11
- loader-utils 1.2.1
- Editor Extensions 2.6.1
- Space Exploration 0.7.60 (although SE is probably unrelated)

With Editor Extensions enabled, the game fails during the data stage:

loader-utils/data-final-fixes.lua:119
bad argument #2 of 3 to 'band' (number expected, got nil)

After adding a debug check before the failing line, the missing prototype was identified as:

Missing loader_id for loader: ee-infinity-loader

The crash occurs because:

loader_ids["ee-infinity-loader"] == nil

but the final loop iterates over every loader in data.raw.loader and assumes every loader has an entry in loader_ids.

The relevant code is:

```lua
for _, prototype in pairs(prototypes) do
...
bit32.band(2^(i-1), loader_ids[prototype.name])
...
end

ee-infinity-loader is added by Editor Extensions but is never registered in loader_ids, so bit32.band() receives nil.

Disabling Editor Extensions makes the game load normally.

It looks like loader-utils should either:

ignore loaders that were not registered, or
explicitly skip Editor Extensions' helper loaders.

Thanks!

a month ago
(updated a month ago)

Diff (from AI) I test it - it works!

@@
- for i = 1, 3 do
- prototype.icons[#prototype.icons+1] = {
- icon = ("loader-utils/graphics/pips/pip-%s.png"):format(bit32.band(2^(i-1), loader_ids[prototype.name]) ~= 0 and "green" or "red"),
- icon_size = 32,
- scale = 0.3,
- shift = {-14, i * 6}
- }
- end
+ local id = loader_ids[prototype.name]
+ if id then
+ for i = 1, 3 do
+ prototype.icons[#prototype.icons+1] = {
+ icon = ("loader-utils/graphics/pips/pip-%s.png"):format(
+ bit32.band(2^(i-1), id) ~= 0 and "green" or "red"
+ ),
+ icon_size = 32,
+ scale = 0.3,
+ shift = {-14, i * 6}
+ }
+ end
+ end

a month ago

Report bugs on github, not the mod portal.

I do not and will not use machine learning in debugging or development of my mods.

New response