Check if mod exist

Started by Cattleya, November 08, 2020, 09:18:30 AM

Previous topic - Next topic

Cattleya

Hello
Is there any way to check if some mod exist or not in ThingDefs folder xml? I know about PatchOperationFindMod but it for patching. What if I need create new ThingDef only if some mod existing ?

For example:

<Find "ModName">
      <ThingDef Name="name1" ParentName="name2">
            <defName>defname</defName>
      ...

Shinzy

There's a very simple way of doing this!
Create yourself "LoadFolders.xml" and place it right at the base of the mod, where all the about/def/texture folders are

it should look something like this
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<loadFolders>
  <v1.2>
    <li>/</li>
<li IfModActive="PackageID.of.the.mod.from.the.about.xml">FolderNameWithYourPatches</li>
  </v1.2>
</loadFolders>


Then create a folder for your patches, again at the very base of the mod
the name of the folder doesn't matter, then, inside that folder
you should have the typical mod structure again, Defs, Patches, etc. and place your xmls there accordingly

then when running the game it should check for the specified mod and if it's active it'll run the patches or any other defs in the new folder you've created and specified in the LoadFolders.xml


Cattleya