How to check if a mod is enabled?

Hi.

So, I dont want mods overlapping other mods. In my “More PCs” mod, I would like to disable adding a platform that already exists in the other mods. How do I check if a mod is enabled? Like this?

if(this.OtherMod)

Thanks!

1 Like

That can be useful for me as well. Will be Watching the thread to receive notifications.

@Stian It depends. If you know how a mod has been called, then yes. But it could get really tedious if you want to check all modules or exclude all except one, and such things.

I would recommend you to use the following approach:

  • ModSupport.availableMods is an array containing all available mods (whether enabled or not)
  • ModSupport.currentMods is an array containing all enabled mods (whether they are available or not)
  • With ModSupport.availableMods[index] you can access a single mod object
  • A mod object has i.e. the following props:
    • id (mod id)
    • active (enabled/disabled)
    • name
    • author
    • version

So, you could check in the currentMods array if there’s a mod with a certain id. If that’s the case, you would alert and/or disable it and tell the user to restart the game or something like that.

Hope that helps.

6 Likes

Thank you! My idea was that if ExpansionPack was enabled (as example) I would disable certain features :slight_smile:

1 Like