if mod exists

Started by skullywag, September 10, 2014, 02:45:42 AM

Previous topic - Next topic

skullywag

Hi there, is there any way to do a "if such and such mod exists" in any way. For example i have 2 mods moreWeapons and moreTurrets the weapon mod has a flamethrower in it, right now if i wanted to use said flamethrower in the turret mod for a recipe I have to add the thingdef etc to it as well. What id like is almost like the research dependency but for mods. So if weapon mod exists then you can build this turret, if not its not available.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

RawCode

checking mod list is trivial task, list is public and easy to find

if you want to do this via XML - answer is NO.

mrofa

Quote from: RawCode on September 10, 2014, 03:00:06 AM
checking mod list is trivial task, list is public and easy to find

if you want to do this via XML - answer is NO.

Cool can you write a example of it?
All i do is clutter all around.

RawCode

foreach ( Mod ResolvedMod in LoadedModManager.LoadedMods)
{
here you can check name of mod and other params of mod, loadedmods is not hashmap, you must iterate over it to check names
if you found mod you like
DefDatabase.Remove(def you no longer need)
}

skullywag

Im cool with it in the dll so thanks for the example. Wondering how hard it would be to add the functionality to the xml now though...doesnt seem difficult but ive said that before..
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

RawCode

i am working on API that will allow to perform such hacks without any issues, process is slow but later will allow many features without any hacks from side of developers.