Quality Lib


Provides a library for modders to easily interface with Quality and add quality stats to any item/entity.

Internal
3 months ago
2.0
2.23K
Transportation Logistics Trains Combat Armor Mining Fluids Logistic network Manufacturing Power Storage

g Modify Existing Quality Values

3 months ago

Can this mod be used to modify existing quality values for base and space age items? I'm trying to make a mod that changes these values but I can't seem to find in the .lua files where these values are being defined.

3 months ago
(updated 3 months ago)

Yes, but it's a little funky. The reason you can't find anything in the Lua files regarding Quality stats is because almost all Quality stats are completely hardcoded, not exposed to modders, and applied no matter what. That's why this mod exists at all.

As for modifying existing Quality stats, you absolutely can, but you have to keep in mind that the original Quality stat modifier is going to be applied on top of your own stats.

Here is a good example. This is from Better Quality, a mod that uses this library extensively. In order for Substations to fit an entire tile, they need to have a Wire Reach of 32. However, Better Quality only increases them to 22. This is because the game adds +10 Wire Reach to every single Legendary power pole regardless of if you want it or not, thus resulting in a Wire Reach of 32 after all is said and done. There's no way around this, so you have to be mindful of it.

3 months ago

Thanks for the help! One more question. Do you have an extensive list of commands and values that the library uses?

3 months ago

The library is fairly simple in it's current state, with only two methods to interact with it.

quality_lib.add(new) Is described in the mod description, and quality_lib.get_changes() returns a table containing all prototypes tracked by the library with the same format that is used for quality_lib.add(new).

23 days ago

Circling back around to this discussion. I'm not sure what you mean by using quality_lib.get_changes() to show me all prototypes tracked by the library. I'm looking for a list of prototype types, names, and fields. For example, I tried using the official prototype documentation and using your storage tank code as an example, but couldn't find "volume" listed as a field in the storage tank prototype so I don't know where that value or other values are being defined.

Does your Better Quality mod encompass all prototypes that the quality lib mod interfaces with?

New response