Item Network SA

by djmalk

This mod adds a network for transporting items and fluids. Now with QUALITY support.

Tweaks
2 months ago
2.0
830
Logistics Fluids Logistic network Storage Cheats

g Add Support for Modded Qualities

4 months ago

Hey there,

is it possible to add support for modded qualities? In my current run I somehow managed to get "Prismatic" quality into the network and it can't handle it:

The mod Item Network SA (0.9.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event item-network-sa::in_open_network_view (ID 237)
Unknown sprite "item-network-quality-prismatic"
stack traceback:
[C]: in function 'add'
item-network-sa/src/NetworkViewUi.lua:274: in function 'update_items'
item-network-sa/src/NetworkViewUi.lua:139: in function 'open_main_frame'
item-network-sa/src/NetworkChest.lua:1264: in function <item-network-sa/src/NetworkChest.lua:1263>

Thank you in advance!

4 months ago

Unknown sprite "item-network-quality-prismatic". This means the prismatic quality sprite is missing, which makes sense because I haven’t defined such a quality. It can be added (and has been requested before), but I’m way too busy to mess with it right now.

4 months ago

I have some free time today, so I decided to add the quality requests. The next patch is hitting soon.

4 months ago

Thank you for your time.
Since i also use the "Quality-Plus" mod I added the qualities into the file as you suggested in the changelog.
Sadly when i do that, Factorio throw an error during startup:

Failed to load mods: item-network-sa/data.lua:4: item-network-sa/src/Quality.lua:19: '}' expected (to close '{' at line 17) near '='
stack traceback:
[C]: in function 'require'
item-network-sa/data.lua:4: in main chunk

I stared at the file for half an hour now and compared it with your original file but i can't find the reason why it expects the '}' right next to the '{'

Here is the change to the file i did:

M.QUALITY_COLORS = {
normal = "white",
normal-plus = "white",
uncommon = "green",
uncommon-plus = "green",
rare = "blue",
rare-plus = "blue",
epic = "purple",
epic-plus = "purple",
legendary = "orange",
legendary-plus = "orange",
prismatic = "red",
mythic = "cyan"
}

M.QUALITY_COLORS gets properly closed so I realy don't know why I get this error.

Sorry if this might be a stupid question. I'm not a programmer.

Thanks for your help!

3 months ago
(updated 3 months ago)

In Lua, when you write a table like this:

M.QUALITY_COLORS = {
normal = "white",
normal-plus = "white", -- this breaks it
}
Treated as math: normal - plus
Which obviously makes no sense in this context — it's not a valid key or variable. That’s why it throws a syntax error near =.
In Lua, if a table key contains characters that are not valid in identifiers (like -), you must use both:
Quotes (to make it a string)
Square brackets (to treat it as a key expression)
Proper table
M.QUALITY_COLORS = {
["normal-plus"] = "white",
["uncommon-plus"] = "green",
["rare-plus"] = "blue",
[ "epic-plus"] = "purple",
["legendary-plus"] = "orange",
}
This feature isn’t very beginner-friendly — it’s more suited for advanced users.
I also totally forgot to mention that you need to assign the qualities in data.lua as well.
The whole system is kind of aimed at people who already know how to mod Factorio.

Replace this line in data.lua
local qualities = { "uncommon", "rare", "epic", "legendary","prismatic", "mythic" } with
local qualities = { "uncommon", "rare", "epic", "legendary", "prismatic", "mythic", "normal-plus", "uncommon-plus", "epic-plus", "legendary-plus" }
and then you need to add proper .png files to graphics/quality.
Also, the .png file names need to match the full quality name exactly, like:
quality-normal-plus.png
quality-uncommon-plus.png
quality-epic-plus.png
and so on.
Make sure the file names match exactly — that’s how the system knows which icon to load.
If you still get errors, I’ll help you out, just let me know.
Good luck with modding!

PS: I checked out the Quality Plus mod. It doesn’t have its own .PNG icons but uses layered icons, which my logic doesn’t support. Also, if you add too many qualities, my GUI breaks. I’m working on a solution and will probably have it done by the weekend, so hang tight!

3 months ago

Thanks again for your help!

I got everything working now. Just noticed one thing. When I hit the "Add Item" Button, the window that opens seems to be too small to show all the qualities (capps out at 9).
Is it possible to make that window larger or provide the qualities in a pulldown menu?

Thank you :)

3 months ago

I mentioned my GUI breaks if too many qualities are present. I'm working on it and should have a patch out tomorrow. Also fixed crashes when no .PNG is defined — you can use any quality mod now, but proper quality icons won’t show on items or the Network Chest GUI.

New response