Page 1 of 1

Is it possible to expose data to other mods?

Posted: Sat Apr 11, 2015 12:26 am
by kds71
Ah I start to feel bad for spamming this subforum today with my silly questions :) Anyway, I'm trying to improve my Upgrade with construction robots mod and there is a suggestion to expose upgrade ruleset to other mods. I thought it shouldn't be that hard, but now I'm starting to lose hope. My first idea was to add custom data to prototypes defined in data.lua, but then I realized that I can't add any property that is not defined in C code - sure, I can do something like that:

Code: Select all

data.raw["transport-belt"]["basic-transport-belt"]["replacer-data"] = {
    replace_with = "fast-transport-belt"
}
but there is no way to access this data in control.lua - I assume it is totally discarded while data.lua from mods is processed at the startup.

Is there any other way to do it? I tried to use glob table in control.lua to define upgrade ruleset and then add a new rule in other mod, but it didn't work, so I don't think this is a proper way - or maybe it is and I just messed something up?

Re: Is it possible to expose data to other mods?

Posted: Sat Apr 11, 2015 3:36 am
by DaveMcW

Re: Is it possible to expose data to other mods?

Posted: Sat Apr 11, 2015 9:36 am
by kds71
Thank you! Somehow I totally missed this wiki page...