Page 1 of 1

How to check for other mods in 0.13+?

Posted: Wed Jun 29, 2016 4:53 am
by Versepelles
I'm trying to check to see if the user has some mods loaded, and I would prefer to do this in a config file, but I'm not sure the new way to do this is 0.13.

Specifically, I'm trying to check for a mod like Natural Convergence to add it's entities to a list for which I generate other items that spawn those entities. The check should probably occur in "config" which is then loaded by "entities" in the prototypes folder which is, in turn, loaded by the standard "data".

How does one check for specific mods installed? I see game.active_mods, but "game" is nil at the time of loading for "data.lua".

Re: How to check for other mods in 0.13+?

Posted: Wed Jun 29, 2016 2:47 pm
by DedlySpyder
You'll have to check to see if one if its entities exist (make it an optional dependency). That was the old way atleast, IIRC, so I assume it'll still work

Re: How to check for other mods in 0.13+?

Posted: Thu Jun 30, 2016 4:42 pm
by patmo98
DedlySpyder wrote:You'll have to check to see if one if its entities exist (make it an optional dependency). That was the old way atleast, IIRC, so I assume it'll still work
I think you also need a soft dependency on that other mod, to make sure it loads before yours. Then you can just look to see if the thing you want to add support for exists, rather than checking if the mod is loaded.

Re: How to check for other mods in 0.13+?

Posted: Fri Jul 01, 2016 4:03 am
by Ranakastrasz
Added LuaGameScript::active_mods - a table of active mod names to mod versions.
Presumably this has something to do with it.

Re: How to check for other mods in 0.13+?

Posted: Fri Jul 01, 2016 2:28 pm
by DedlySpyder
Ranakastrasz wrote:
Added LuaGameScript::active_mods - a table of active mod names to mod versions.
Presumably this has something to do with it.
You can't access game during the data loading phase though

Re: How to check for other mods in 0.13+?

Posted: Fri Jul 01, 2016 9:30 pm
by Ranakastrasz
Wut?
....

What is the point of adding that?

Re: How to check for other mods in 0.13+?

Posted: Sat Jul 02, 2016 3:22 am
by DedlySpyder
Ranakastrasz wrote:Wut?
....

What is the point of adding that?
So that you can check on_init. I have a mod that has arrays of entities, so I can check active mods after the game starts to correct any values in the arrays. Link

Re: How to check for other mods in 0.13+?

Posted: Sat Jul 02, 2016 3:34 am
by Ranakastrasz
I should say, why is it not set on program load instead? You can't change it without restarting, and it would fix the ridiculous mod checking method we use now...

Re: How to check for other mods in 0.13+?

Posted: Sun Jul 03, 2016 2:01 pm
by DedlySpyder
Ranakastrasz wrote:I should say, why is it not set on program load instead? You can't change it without restarting, and it would fix the ridiculous mod checking method we use now...
Why does active_mods not set on program load? I can't say for sure, I guess it's a matter of how would you access it otherwise? Data.raw only contains information for prototypes AFAIK, so they'd have to expand it to allow us to check it I guess.