Hi, the problem is fixed (>=1.2.8)
Thanks! I'll check it out and report back later. :-)
And i wanted to ask you a question about what mods can do.
Is it possible for a mod to create a table and allow other mods to put data in that table?
Sure., that's an established method for mod interaction during the data stage. For example, Assembler Pipe Passthrough provides a table where other mods can enter entities they want to excempt. So, in BI, I do this in data-updates.lua:
-- Blacklist bioreactor in Assembler Pipe Passthrough
if mods["assembler-pipe-passthrough"] then
appmod.blacklist['bi-bio-reactor'] = true
end
All you need to do is declare a global table in data.lua. You should keep in mind that "global" really means "global" here -- unlike in the control stage, where each mod has its own global table, global variables/tables can be accessed by all active mods. So you should make sure you use a unique name for your table, that somehow refers to your mod (like "appmod", where "app" is short for "assembler pipe passthrough").
You could even make it that all mods can write to the table in data.lua even if they are loaded before your mod. You would put something like this at the top of your data.lua:
-- Create a global table where other mods can enter trees you want to ignore
-- unless it already has been populated by other mods
TRTF_ignore = TRTF_ignore or {}
-- List of entities that you always want to ignore
local always_ignore = { "prototype_a", "prototype_b", "prototype_c"}
for k, v in ipairs(always_ignore) do
TRTF_ignore[#TRTF_ignore + 1] = v
end
Other mod would add this to their data.lua:
if mods["Tral_robot_tree_farm"] then
-- Create or add to TRTF ignore list
TRTF_ignore = TRTF_ignore or {}
for k, v in ipairs({ ignore_a.name, ignore_b.name }) do
table.insert(TRTF_ignore, v)
end
end
In data-updates.lua or data-final-fixes.lua, you can then use these data:
local ignore
for tree_name, tree in pairs(data.raw.tree) do
ignore = false
for n, name in ipairs(TRTF_ignore) do
if tree_name == name then
ignore = true
break
end
end
if not ignore then
-- Do stuff
end
end
Sometimes it may be easier to convert the ignore list to a dictionary before using it:
local ignore = {}
for k, v in ipairs(TRTF_ignore) do
ignore[v] = true
end
for tree_name, tree in pairs(data.raw.tree) do
if not ignore[tree_name] then
-- Do stuff
end
end