WARNING!
When using FQ Core as dependency, there are two things you might want to be aware of:
1. FQ Core is currently experimental. Breaking changes may happen on any update.
You are heavily advised to pin the FQ Core version in your info.json
.
"dependencies": [
"fq-core = 0.1.0"
]
2. Only Lua files in __fq-core__/lib/
can be imported from other mods.
Importing any other file may or may not cause problems. You have been warned.
The main reason for this is that Factorio gives each mod a separate Lua interpreter. Mod A can't access global variables accessible by mod B (except for engine data structures exposed to Lua, e.g. data.raw
).
This means when two different mods require()
the same module (e.g. __fq-core__/runtime/motion.lua
) there are now two copies of the module hanging around. Each copy has their own set of global variables and isn't even aware that the other copy exists. As you can imagine, this can cause some problems. In case of motion.lua
- crash damage will be calculated incorrectly and motion stopping on impact with an object may not work at all. Other modules outside __fq-core__/lib/
may have similar problems.