factoriolib / flib

A set of high-quality, commonly-used utilities for creating Factorio mods.
https://mods.factorio.com/mod/flib
MIT License
64 stars 15 forks source link

Data-stage compatibility flags #5

Closed raiguard closed 4 years ago

raiguard commented 4 years ago

A thought that went through my head while preparing this morning was the idea of "compatibility flags" for prototypes in the data stage. When a prototype is created through flib, the modder can specify certain "flags" that will be stored in an flib subtable in the prototype (we can also use that table to store any other extra data we might want in the future).

For example, BigBags increases the stack size of all items naively. Some mods might not want stack sizes to change. For example, my Tapeline mod has several non-stackable capsules, and BigBags attempts to make them have a stack size of 1000. That actually makes the mod fail to load because BigBags doesn't do it properly, but you also don't need a stack of 1000 tapelines, since using the tool does not consume it anyway.

So when creating the capsule, I could add a keep_stack_size flag. When a restacking mod comes across that, it knows not to touch the stack size for that specific item.

That is a primitive example, but fleshing out what kinds of flags can be assigned, and asking major modders to use them, would make inter-mod compatibility a bit less of a nightmare than it is now.

Thoughts?

0ptera commented 4 years ago

I think you are overcomplicating things. BigBags could just provide either a whitelist or blacklist for other mods.

Having flags for keeping properties will quickly turn into a mess, where we have to add keep flags for every property and all that work will be wasted on mods editing things directly.