Yes.
As part of uniformallity and the fact that having limitations in my mod is an option, not a requirement, the code for all 3 base game productivity modules is replaced with a version without the tag. (Because if the tag exists at all, even as nil, it seems to act as if you have limitations, but since it's nil, it's limited to nothing, meaning it can't be used.) They are added in again, with lots of extra additions (I think during the data-updates phase) if limitation is enabled.
Also, if you were to just bump that code back to the data updates phase, it wouldn't guarantee it to work with my mods, because the limitation key still might not exist if limitations aren't enabled.
And if you did add in a check to see if the key exists before adding to it, you still have the issue that it only works on those 3, and not the others that I add.
My recommended solution would be, not only to bump it to data-updates, but also check for the existence of my library's add productivity limitation function. if it exists, use it, if not, do what you wrote there. Alternatively, you could look at the function and copy what it does into your own mod.
Check how I do it in one of my mods, such as bobplates. it's easier to get it right with examples.
I'd give you the exact code, but I don't have access to my mods at my current location, but the check would have to be multi barrelled like...
if bobmods and bobmods.lib and.... then
all the way up to and including the function name.
Remember, all this is off the top of my head, so accuracy may be off!
Hope this helps.
EDIT:
I looked it up.
in data-updates.lua (or a file it includes) I have the following line
Code: Select all
bobmods.lib.module.add_productivity_limitations(parts)
in this case, parts is a table of things to add. if you want to do the same for single entries, the function bobmods.lib.module.add_productivity_limitation() takes a single entry.
The check code would then be as follows:
Code: Select all
if bobmods and bobmods.lib and bobmods.lib.module and bobmods.lib.module.add_productivity_limitations then
bobmods.lib.module.add_productivity_limitations(parts)
else
--your code here
end
where parts is a table including all your things to add.
My function performs the appropriate safety checks to see if tags exist before trying to add to them. it also is not limited to modules added by my own mod, it will add to any module with a limitation key, and a productivity value.